【发布时间】:2021-02-25 14:00:31
【问题描述】:
我使用 PyInstaller 生成了一个可执行文件,但是当我想启动应用程序时,控制台窗口显示它找不到目录或文件。我检查了位置,文件夹“_MEI55762”确实不存在。
以前有人遇到过这个问题吗?
在代码部分下方,我认为应该定位错误。我认为这与“jsonrpclcient”包的导入有关。我没有发布包含所有 GUI 行的完整代码,因为我认为这无济于事。如果我错了,请告诉我。
import os
import sys
import requests
import json
import pyvisa
import time
from datetime import datetime
import threading
import signal
from jsonrpcclient import *
from jsonrpcclient.clients.http_client import HTTPClient
from jsonrpcclient.requests import Request
from tkinter import *
from tkinter import ttk
import traceback
print("-----------------------------------------")
print(" Q-Center V0.1 ")
print("-----------------------------------------")
port = ":8080"
rm = pyvisa.ResourceManager()
def listArticles():
for attempt in range (3): #Will be executed 3 times in case an error occurs
print('List Articles:')
try: #First try this
client = HTTPClient("http://" + ipEntry.get() + port)
response = client.send(Request("list_articles"), timeout=5)
print(response.data.result)
print('Success!')
except: #If an error occurs, call the print function and let the user know
print('An error occured!')
rebootPeacock()
else: #If no error occurs, stop trying
break
else: #If no attempt was successful, print that all 3 attempts failed. ONLY EXCUTED WHEN THE LOOP DOES'T BREAK.
print('All 3 attempts failed!')
answer = response.data.result
pkReply.insert(END, answer)
pkReply.insert(END, '\n\n')
【问题讨论】:
-
1.请不要张贴图片 2. 它准确地说明了问题所在。某些文件不在(大概)应该在的位置,您甚至确认了它。不确定您希望我们提供什么帮助,尤其是当您没有向我们展示任何代码时
-
1.: 为什么不能发图片?我认为这个功能是有原因的?! 2.:我在问是否有人以前遇到过这个问题。
-
1.因为这些是本网站的规则:How to Ask。 2. 假设是的,有人这样做了。如果您不向我们展示您的代码,它对您没有帮助。再次,请参阅How to Ask
-
发布图片可能会导致一些问题。由于防火墙、代理或法规,某些用户可能被阻止访问图像托管站点。用户无法快速复制粘贴代码来重新运行您正在运行的内容,从而将其变成了转录练习。除其他原因外,为视障用户设计的软件可能无法处理您的图像。请将您的代码和/或堆栈跟踪粘贴到问题中
-
另外,我相信您已经注意到张贴图片而不包含代码会导致投反对票,从而导致声誉损失和看到您的实际问题的人减少。
标签: python exe pyinstaller json-rpc