【问题标题】:-10003 error when trying to start Metatrader 5 from IIS尝试从 IIS 启动 Metatrader 5 时出现 -10003 错误
【发布时间】:2023-01-30 19:31:47
【问题描述】:

-10003 尝试从 IIS 启动 Metatrader 5 时出错。

我有一个在 python 3.10 和 fastapi 中创建的 API,我让它在 Windows 服务器和 IIS 6.2 上运行。

当我尝试从抛出我的 IIS 初始化 mt5 时出现错误。

{"message": "initialize() failed",
"error_code": [
    -10003,
    "IPC initialize failed, "
]}

注意:在我的本地 api 工作正常,但我使用 Uvicorn 运行它。

注 2:如果我直接在控制台中运行代码,它也可以完美运行。

【问题讨论】:

  • 请提供足够的代码,以便其他人可以更好地理解或重现问题。

标签: python fastapi windows-server-2012 metatrader5


【解决方案1】:

尝试这个:

import MetaTrader5 as mt

login= account_number
password='password'
server='sever_name'
timeout=5000 # Number of milliseconds for timeout

try: 
    mt.initialize(login=login, password=mdp, server=server, timeout=timeout)
    print(f'MT5 initialized! Status: {mt.last_error()}')
except:
    print(f'MT5 not initialized /!\
Status: {mt.last_error()}')
    mt.shutdown()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-08
    • 2013-07-23
    • 1970-01-01
    • 2014-09-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多