微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Pyinstaller / Pyarmor IndexError

如何解决Pyinstaller / Pyarmor IndexError

我正在制作一个Python脚本,该脚本将通过.txt文件来查找实时代理。该程序在Python中运行,并在需要时调用“代理”定义,因此脚本将一直运行,直到调用“代理”为止。

(The Python source code)

def proxies():
    proxy_file = open("proxy.txt","r")
    proxy_text = proxy_file.readlines()
    line = random.choice(proxy_text)
    ip = line.replace("\n","")
    if str(ip).startswith("http"):
        pass
    else:
        https = "https://"+ip
        http = "http://"+ip
    proxy = {
        "https":https,"http":http
    }
    return proxy   

-

如果使用pyarmor对其进行混淆和打包,则无法读取文件

enter image description here

这是我用来打包pyarmor的代码:“ pyarmor pack -e”-onefile“ file.py”

-

然后,如果我尝试通过pyinstaller打包,则会遇到类似的问题

enter image description here

这是我用来打包pyinstaller的代码:pyinstaller --onefile file.py

-

如果有人知道我该如何解决此问题,将不胜感激:)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。