该程序包括带有tkinter
,multithreading
的普通python脚本以及一些连接到sqlite
数据库的功能。该程序作为.py
文件运行非常流畅,但是在auto-py-to-exe
中编译后,它始终只显示一条消息fatal error
failed to execute script pyiboot01_bootstrap
,甚至还没有我的{{ 1}}文件。我尝试将.exe
标志设置为-d
,但它仍然从不显示错误回溯。我应该重新安装all
吗?编译时的输出如下。
auto-py-to-exe
谢谢。
编辑:
从模块Running auto-py-to-exe v2.6.6
Building in the current instances temporary directory at C:\Users\Spanish\AppData\Local\Temp\tmpb2b4goux
To get a new temporary directory, restart this application
Recursion Limit is set to 5000
Executing: pyinstaller -y -w -i "C:/LoLPingStreaming/media/icon.ico" --add-data "C:/LoLPingStreaming/testerdata.db";"." --add-data "C:/LoLPingStreaming/media";"media/" --debug all "C:/LoLPingStreaming/LoLPingStreaming.py"
68263 INFO: PyInstaller: 3.6
68263 INFO: Python: 3.7.0
68263 INFO: Platform: Windows-7-6.1.7601-SP1
68263 INFO: wrote C:\Users\Spanish\AppData\Local\Temp\tmpb2b4goux\LoLPingStreaming.spec
68273 INFO: UPX is not available.
68273 INFO: Extending PYTHONPATH with paths
['C:\\LoLPingStreaming',
'C:\\Users\\Spanish\\AppData\\Local\\Temp\\tmpb2b4goux']
68273 INFO: checking Analysis
68273 INFO: Building Analysis because Analysis-00.toc is non existent
68273 INFO: Initializing module dependency graph...
68325 INFO: Caching module graph hooks...
68668 INFO: Analyzing base_library.zip ...
79798 INFO: Caching module dependency graph...
80039 INFO: running Analysis Analysis-00.toc
80145 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\spanish\appdata\local\programs\python\python37-32\python.exe
81487 INFO: Analyzing C:\LoLPingStreaming\LoLPingStreaming.py
82097 INFO: Processing pre-safe import module hook six.moves
84947 INFO: Processing pre-find module path hook distutils
84991 INFO: distutils: retargeting to non-venv dir 'c:\\users\\spanish\\appdata\\local\\programs\\python\\python37-32\\lib'
88497 INFO: Processing pre-find module path hook site
88536 INFO: site: retargeting to fake-dir 'c:\\users\\spanish\\appdata\\local\\programs\\python\\python37-32\\lib\\site-packages\\PyInstaller\\fake-modules'
91849 INFO: Processing pre-safe import module hook setuptools.extern.six.moves
97787 INFO: Processing module hooks...
97797 INFO: Loading module hook "hook-distutils.py"...
97908 INFO: Loading module hook "hook-encodings.py"...
98130 INFO: Loading module hook "hook-gevent.py"...
99927 INFO: Determining a mapping of distributions to packages...
107866 WARNING: Unable to find package for requirement greenlet from package gevent.
107866 INFO: Packages required by gevent:
['cffi']
114026 INFO: Loading module hook "hook-lib2to3.py"...
114207 INFO: Loading module hook "hook-PIL.Image.py"...
115526 INFO: Loading module hook "hook-PIL.py"...
115536 INFO: Excluding import 'PySide'
115546 INFO: Removing import of PySide from module PIL.ImageQt
115546 INFO: Excluding import 'PyQt4'
115565 INFO: Removing import of PyQt4 from module PIL.ImageQt
115568 INFO: Import to be excluded not found: 'FixTk'
115568 INFO: Excluding import 'tkinter'
115574 INFO: Removing import of tkinter from module PIL.ImageTk
115575 INFO: Excluding import 'PyQt5'
115580 INFO: Removing import of PyQt5 from module PIL.ImageQt
115584 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
115602 INFO: Import to be excluded not found: 'FixTk'
115602 INFO: Excluding import 'tkinter'
115605 INFO: Loading module hook "hook-pkg_resources.py"...
117346 INFO: Processing pre-safe import module hook win32com
117736 INFO: Excluding import '__main__'
117736 INFO: Removing import of __main__ from module pkg_resources
117736 INFO: Loading module hook "hook-pycparser.py"...
117777 INFO: Loading module hook "hook-pydoc.py"...
117779 INFO: Loading module hook "hook-pythoncom.py"...
118986 INFO: Loading module hook "hook-pywintypes.py"...
120639 INFO: Loading module hook "hook-setuptools.py"...
122675 INFO: Loading module hook "hook-sqlite3.py"...
123465 INFO: Loading module hook "hook-sysconfig.py"...
123475 INFO: Loading module hook "hook-win32com.py"...
124662 INFO: Loading module hook "hook-xml.py"...
124855 INFO: Loading module hook "hook-_tkinter.py"...
125277 INFO: checking Tree
125277 INFO: Building Tree because Tree-00.toc is non existent
125277 INFO: Building Tree Tree-00.toc
126097 INFO: checking Tree
126097 INFO: Building Tree because Tree-01.toc is non existent
126097 INFO: Building Tree Tree-01.toc
126306 INFO: Looking for ctypes DLLs
126485 INFO: Analyzing run-time hooks ...
126505 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
126553 INFO: Including run-time hook 'pyi_rth_pkgres.py'
126573 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
126585 INFO: Including run-time hook 'pyi_rth__tkinter.py'
126618 INFO: Looking for dynamic libraries
128807 INFO: Looking for eggs
128807 INFO: Using Python library c:\users\spanish\appdata\local\programs\python\python37-32\python37.dll
128807 INFO: Found binding redirects:
[]
135234 INFO: Warnings written to C:\Users\Spanish\AppData\Local\Temp\tmpb2b4goux\build\LoLPingStreaming\warn-LoLPingStreaming.txt
135526 INFO: Graph cross-reference written to C:\Users\Spanish\AppData\Local\Temp\tmpb2b4goux\build\LoLPingStreaming\xref-LoLPingStreaming.html
135681 INFO: Appending 'datas' from .spec
135779 INFO: checking PYZ
135779 INFO: Building PYZ because PYZ-00.toc is non existent
135779 INFO: Building PYZ (ZlibArchive) C:\Users\Spanish\AppData\Local\Temp\tmpb2b4goux\build\LoLPingStreaming\PYZ-00.pyz
135779 INFO: Building PYZ (ZlibArchive) C:\Users\Spanish\AppData\Local\Temp\tmpb2b4goux\build\LoLPingStreaming\PYZ-00.pyz completed successfully.
135789 INFO: checking PKG
135799 INFO: Building PKG because PKG-00.toc is non existent
135799 INFO: Building PKG (CArchive) PKG-00.pkg
135933 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
135943 INFO: Bootloader c:\users\spanish\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\bootloader\Windows-32bit\runw_d.exe
135943 INFO: checking EXE
135943 INFO: Building EXE because EXE-00.toc is non existent
135943 INFO: Building EXE from EXE-00.toc
136023 INFO: Copying icons from ['C:\\LoLPingStreaming\\media\\icon.ico']
136080 INFO: Writing RT_GROUP_ICON 0 resource with 90 bytes
136080 INFO: Writing RT_ICON 1 resource with 24702 bytes
136080 INFO: Writing RT_ICON 2 resource with 67624 bytes
136080 INFO: Writing RT_ICON 3 resource with 16936 bytes
136080 INFO: Writing RT_ICON 4 resource with 9640 bytes
136080 INFO: Writing RT_ICON 5 resource with 4264 bytes
136080 INFO: Writing RT_ICON 6 resource with 1128 bytes
136107 INFO: Appending archive to EXE C:\Users\Spanish\AppData\Local\Temp\tmpb2b4goux\build\LoLPingStreaming\LoLPingStreaming.exe
136111 INFO: Building EXE from EXE-00.toc completed successfully.
136125 INFO: checking COLLECT
136126 INFO: Building COLLECT because COLLECT-00.toc is non existent
136128 INFO: Building COLLECT COLLECT-00.toc
155059 INFO: Building COLLECT COLLECT-00.toc completed successfully.
Moving project to: C:\Users\Spanish\output
Complete.
中发现了受影响的代码块,我试图做的是:pystray
没有提供显示系统任务栏图标的方法,因此我能够查找使用tkinter
模块实现任务栏图标并使其在另一个pystray
中运行,以便它可以与thread
主线程同时运行的另一种方法。这是我对模块的实现,在注释掉并编译后,该模块未显示上述错误:
tkinter
这是我错误地实现此模块import...
import pystray
from pystray import MenuItem as item
...
class Gui:
def __init__(self, master):
self.iconthread = threading.Thread(target=self.systray, args=())
self.iconthread.setDaemon(True)
self.iconthread.start()
...
...
def systray(self):
image = Image.open('media/icon.png')
menu = pystray.Menu(item('Show Ping', self.show, default=True, visible=False), item('Exit', app.close))
self.icon = pystray.Icon('Ping', image, 'Ping', menu)
self.icon.run()
...
或与pystray
有关系的方式,尽管也有一个thread
在运行,但这并没有引发任何问题错误。
答案 0 :(得分:0)
计算了一天后,通过在thread
以外的其他地方打开tkinter __init__()
进行了修复,编译后现在没有错误并且运行平稳。
import...
import pystray
from pystray import MenuItem as item
...
Class App:
def __init__():
...
def startthreading(self):
self.iconthread = threading.Thread(target=self.systray, args=())
self.iconthread.setDaemon(True)
self.iconthread.start()
def systray(self):
image = Image.open('media/icon.png')
menu = pystray.Menu(item('Show Ping', self.show, default=True, visible=False))
self.icon = pystray.Icon('Ping', image, 'Ping', menu)
self.icon.run()
...
class Gui:
def __init__(self, master):
app.startthreading()
#self.iconthread = threading.Thread(target=self.systray, args=())
#self.iconthread.setDaemon(True)
#self.iconthread.start()
...
...
#def systray(self):
#image = Image.open('media/icon.png')
#menu = pystray.Menu(item('Show Ping', self.show, default=True, visible=False), item('Exit', app.close))
#self.icon = pystray.Icon('Ping', image, 'Ping', menu)
#self.icon.run()
...
if __name__ == '__main__':
app = App()
gui = Gui()