You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to build a very simple Python standalone executable using Nuitka:
import serial
print 'hello'
Building the executable using nuitka --standalone --portable app.py works, but if the PC's C:\Python27 directory is missing then the program fails with:
Traceback (most recent call last):
File "C:\app\app.dist\app.py", line 6, in <module>
File "C:\app\app.dist\serial\__init__.py", line 26, in serial
File "C:\app\app.dist\serial\serialwin32.py", line 12, in serialwin32
File "C:\Python27\lib\ctypes\__init__.py", line 10, in <module>
ImportError: No module named _ctypes
I suppose technically this is an issue with Nuitka not properly finding dependencies (I will post there too), but many other modules do work. I haven't checked yet if serial/ctypes does some sort of tricky importing.
In the meantime the workaround on the pyserial side is to simply add import _ctypes at the top of serialwin32.py. If it helps I can make a pull request for this.
The text was updated successfully, but these errors were encountered:
morefigs
changed the title
ImportError for _ctypes module after building standalone executable with Nuitka
Import serial breaks Python executable built with Nuitka
Jan 11, 2016
pySerial uses ctypes with no tricks, there is only one not so common thing in __init__.py where the different platforms are imported, these are selected by an if. So far i have not have any problems packaging apps e.g. with py2exe.
I would not like to add to add the proposed "magic" import line in pySerial, it would be an import that is not used anywhere which gives minus points on the PEP-8 scoreboard ;-) Maybe you can add that import to your application or find out why Nuitka does not pick up the dependencies in this case (maybe because os.name == 'nt' is not true while it scans the sources?).
I'm attempting to build a very simple Python standalone executable using Nuitka:
Building the executable using
nuitka --standalone --portable app.py
works, but if the PC's C:\Python27 directory is missing then the program fails with:I suppose technically this is an issue with Nuitka not properly finding dependencies (I will post there too), but many other modules do work. I haven't checked yet if serial/ctypes does some sort of tricky importing.
In the meantime the workaround on the pyserial side is to simply add
import _ctypes
at the top ofserialwin32.py
. If it helps I can make a pull request for this.The text was updated successfully, but these errors were encountered: