【问题标题】:pyinstaller + pymongo no workedpyinstaller + pymongo 没用
【发布时间】:2022-01-14 00:21:30
【问题描述】:

你好,在 pyinstaller 之后我的程序没有工作

  File "main.py", line 16, in <module>
  File "pymongo\mongo_client.py", line 677, in __init__
  File "pymongo\uri_parser.py", line 532, in parse_uri
  File "pymongo\srv_resolver.py", line 119, in get_hosts
  File "pymongo\srv_resolver.py", line 102, in _get_srv_response_and_hosts
  File "pymongo\srv_resolver.py", line 103, in <listcomp>
AttributeError: 'GenericRdata' object has no attribute 'target'
[19304] Failed to execute script 'main' due to unhandled exception!```

【问题讨论】:

  • 你能展示你的代码来理解问题吗?
  • 这里也有类似的问题:stackoverflow.com/a/70097128/8961170seems that the issue is with it not picking up the pymongo's dnspython dependency, and I fixed it by specifying dns in the build options
  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: python pymongo pyinstaller


【解决方案1】:

我解决了我使用旧版本连接的问题 client = pymongo.MongoClient("mongodb://&lt;login&gt;:&lt;mypassword&gt; @cluster0-shard-00-00.492oe.mongodb.net:27017,cluster0-shard-00-01.492oe.mongodb.net:27017,cluster0-shard-00-02.492oe.mongodb.net:27017/&lt;dbname&gt;?ssl=true&amp;replicaSet=atlas-qo0xpf-shard-0&amp;authSource=admin&amp;retryWrites=true&amp;w=majority")

  • 添加标志--hidden-import dns | 示例:“pyinstaller -F --hidden-import dns main.py”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-28
    • 1970-01-01
    • 1970-01-01
    • 2019-06-17
    • 2020-06-11
    • 2017-05-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多