Reputation: 126
I have several py files (PyQt5 small application with several windows) which I would like to compile into 1 exe file. I tried to use pyinstaller with the following command:
pyinstaller --onefile main.py
but at some point I get this error message:
File "d:\python\lib\site-packages\PyInstaller\building\build_main.py", line 244, in __init__
self.__postinit__()
File "d:\python\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
self.assemble()
File "d:\python\lib\site-packages\PyInstaller\building\build_main.py", line 422, in assemble
self.graph.process_post_graph_hooks()
File "d:\python\lib\site-packages\PyInstaller\depend\analysis.py", line 311, in process_post_graph_hooks
module_hook.post_graph()
File "d:\python\lib\site-packages\PyInstaller\depend\imphook.py", line 417, in post_graph
self._load_hook_module()
File "d:\python\lib\site-packages\PyInstaller\depend\imphook.py", line 383, in _load_hook_module
self._hook_module = importlib_load_source(
File "d:\python\lib\site-packages\PyInstaller\compat.py", line 797, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 462, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 962, in load_module
File "<frozen importlib._bootstrap_external>", line 787, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 702, in _load
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "d:\python\lib\site-packages\PyInstaller\hooks\hook-sqlalchemy.py", line 30, in <module>
dialects = eval(dialects.strip())
File "<string>", line 0
^
SyntaxError: unexpected EOF while parsing
unexpected EOF: usually means there is an open loop, or maybe a missing parenthesis somewhere. But I tried to look for it everywhere and I didn't find it, also my code is running properly from PyCharm. So Im wondering if this error really exist, or just a bug when compiling many py files together from pyinstaller? Any idea? Thanks a lot for help!
After typing...
import sqlalchemy.dialects
print(sqlalchemy.dialects.__all__)
I get :
Traceback (most recent call last):
File "C:/Users/PC/Desktop/mesprojets/nouvo/main.py", line 5, in <module>
import sqlalchemy.dialects
File "D:\PYTHON\lib\site-packages\sqlalchemy\__init__.py", line 12, in <module>
from sqlalchemy.sql import (
File "D:\PYTHON\lib\site-packages\sqlalchemy\sql\__init__.py", line 7, in <module>
from sqlalchemy.sql.expression import (
File "D:\PYTHON\lib\site-packages\sqlalchemy\sql\expression.py", line 32, in <module>
from sqlalchemy import util, exc
File "D:\PYTHON\lib\site-packages\sqlalchemy\util\__init__.py", line 7, in <module>
from .compat import callable, cmp, reduce, defaultdict, py25_dict, \
File "D:\PYTHON\lib\site-packages\sqlalchemy\util\compat.py", line 202, in <module>
time_func = time.clock
AttributeError: module 'time' has no attribute 'clock'
Process finished with exit code 1
Upvotes: 1
Views: 1150
Reputation: 1
pip install sqlalchemy --upgrade also resolved this error I was receiving while trying to create pyinstaller --onefiles for any script I was working on "from compat import callable, cmp, reduce, defaultdict, py25_dict, \ ModuleNotFoundError: No module named 'compat'". Incidentally, I also uninstalled Tensorflow as I was receiving a pip dependency resolver issue when initially running pip install sqlalchemy --upgrade
Upvotes: 0