[PyInstaller应用程序在使用pyQode时不断打开自身

问题描述 投票:0回答:1

问题:以下程序在使用PyInstaller使其可执行后,每隔5秒钟会自行启动一次。它不断地自我运行。如果我不直接使用python运行代码,则代码可以正常运行。我花了一天多的时间来解决此问题,但到目前为止还没有运气。我在Windows和Mac上尝试过。 Python 3.7版,PyInstaller 3.5和3.6版。

PyInstaller命令:

pyinstaller --onefile generic_code_edit.py

Python代码:

import logging
logging.basicConfig(level=logging.DEBUG)
import sys
from pyqode.qt import QtWidgets
from pyqode.core.widgets import GenericCodeEdit


def main():
    app = QtWidgets.QApplication(sys.argv)

    # create editor and window
    window = QtWidgets.QMainWindow()
    editor = GenericCodeEdit()

    # open a file
    editor.file.open(__file__)
    window.setCentralWidget(editor)

    # run
    window.show()
    app.exec_()
    editor.file.close()


if __name__ == "__main__":
    main()

调试日志:

DEBUG:pyqode.core.cache:获取generic_code_edit.py的编码调试:pyqode.core.managers.file:检测到的mimetype:text / x-python调试:pyqode.core.managers.file:打开的文件:generic_code_edit.py错误:pyqode.backend:调试:pyqode.qt:导入PyQt5错误:pyqode.backend:调试:pyqode.qt:导入的PyQt5错误:pyqode.backend:INFO:pyqode.qt:使用pyqt5错误:pyqode.backend:调试:pyqode.core.cache:获取编码generic_code_edit.py错误:pyqode.backend:调试:pyqode.core.managers.file:mimetype检测到:text / x-python错误:pyqode。后端:调试:pyqode.core.managers.file:文件打开:generic_code_edit.py

python pyqt5 pyinstaller
1个回答
0
投票

最后,我自己找到了解决方案。它与自动完成功能有关。 pyinstaller不能很好地加载此功能,并且会导致新的启动。尽管我无法使其与pyinstaller一起使用,但是我已经能够停止这些功能来解决启动循环问题。

我已经传递了一个空的服务器文件,因为后端目前已解决了该问题。但是我仍然想使pyinstaller的自动完成功能。

editor = GenericCodeEdit(None, 'empty_file.py')
© www.soinside.com 2019 - 2024. All rights reserved.