Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'no module named atexit' when I run a program deployed using pyinstaller

Tags:

pyinstaller

First of all, the machine is running Fedora 13 and the version of PyInstaller is 1.5.1

I did use --onefile when generate the spec.

I did not have any error with running 'import atexit' from within Python interpreter.

Here's the traceback from running the binary:

Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/home/pyinstaller-1.5.1/iu.py", line 436, in importHook
 mod = _self_doimport(nm, ctx, fqname)
File "/home/pyinstaller-1.5.1/iu.py", line 495, in doimport
 mod = importfunc(nm)
File "/home/pyinstaller-1.5.1/iu.py", line 297, in getmod
 mod = owner.getmod(nm)
File "/home/pyinstaller-1.5.1/archive.py", line 468, in getmod
 return iu.DirOwner.getmod(self, self.prefix+'.'+nm)
File "/home/pyinstaller-1.5.1/iu.py", line 109, in getmod
 mod = imp.load_module(nm, fp, attempt, (ext, mode, typ))
File "/home/pyinstaller-1.5.1/iu.py", line 436, in importHook
 mod = _self_doimport(nm, ctx, fqname)
File "/home/pyinstaller-1.5.1/iu.py", line 505, in doimport
 mod = director.getmod(nm)
File "/home/pyinstaller-1.5.1/iu.py", line 297, in getmod
 mod = owner.getmod(nm)
File "/home/pyinstaller-1.5.1/iu.py", line 109, in getmod
 mod = imp.load_module(nm, fp, attempt, (ext, mode, typ))
File "/home/pyinstaller-1.5.1/iu.py", line 455, in importHook
 raise ImportError, "No module named %s" % fqname
ImportError: No module named atexit
like image 725
user11869 Avatar asked Feb 18 '12 03:02

user11869


1 Answers

I solved this by adding 'import atexit' into the source code. Hope this will help other people who have similar problems

like image 154
user11869 Avatar answered Oct 20 '22 20:10

user11869