No module pymysql?

32 views
Skip to first unread message

RapidTech 1898

unread,
Nov 27, 2020, 3:34:14 AM11/27/20
to PyInstaller
Hello, i have used pyinstaller for a long time with different python-programs but now i run in trouble afer a exe-compilation:

I got this error-message:
File "StockVal.py", line 46, in <module>
    engine = create_engine ("mysql+pymysql://rapid_Reader:xyz#@nl1-ss18.a2hosting.com/xyz_stockdb")
  File "sqlalchemy\engine\__init__.py", line 500, in create_engine
  File "sqlalchemy\engine\strategies.py", line 87, in create
  File "sqlalchemy\dialects\mysql\pymysql.py", line 62, in dbapi
ModuleNotFoundError: No module named 'pym

I made the compilation (as always with other python-programs) with:
pyinstaller --onefile --hidden-import pycountry --exclude-module matplotlib StockVal.py

I also tried::
pyinstaller --onefile --hidden-import pycountry --exclude-module pymysql StockVal.py

Tried also to reinstall pymysql on the cmd - but doesn´t help either...
C:\Users\Polzi>pip install pymysql
Requirement already satisfied: pymysql in c:\users\polzi\appdata\local\programs\python\python37\lib\site-packages (0.10.0)







bwoodsend

unread,
Nov 27, 2020, 5:16:37 AM11/27/20
to PyInstaller

Does the usual --hidden-import pym not do the job? If not can you run

python -c "import pym"

and

python -m PyInstaller --onefile --hidden-import pycountry --exclude-module matplotlib StockVal.py

and report the results for each.

RapidTech 1898

unread,
Nov 27, 2020, 5:22:14 AM11/27/20
to PyInstaller
Hello,

i found a workaround - 

when i write "import pymysql" into my py-file - then the program after compiling with pyinstaller is working fine
(for the general run of the python-program in my pycharm-IDE this import is NOT necessary - but it seems that pyinstaller needs it)

KR
Reply all
Reply to author
Forward
0 new messages