Hi Experts,
Good morning.
I am trying to convert my hello.py to hello .exe file.
I followed the steps as mentioned in the documentation but getting errors in the end. Please help.
What I did as below--
Created hello.py file
print ("Hello world!")
raw_input('')
Then created setup.py in the same folder.
from distutils.core import setup
import py2exe
setup(console=['hello.py'])
I did install and it ran fine
python setup.py install
running install
running build
running install_egg_info
Removing C:\Python33\Lib\site-packages\UNKNOWN-0.0.0-py3.3.egg-info
Writing C:\Python33\Lib\site-packages\UNKNOWN-0.0.0-py3.3.egg-info
While in the last step when I run
python setup.py py2exe
it gives error.
Traceback (most recent call last):
File "setup.py", line 4, in <module>
setup(console=['hello.py'])
File "C:\Python33\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python33\lib\distutils\dist.py", line 917, in run_commands
self.run_command(cmd)
File "C:\Python33\lib\distutils\dist.py", line 936, in run_command
cmd_obj.run()
File "C:\Python33\lib\site-packages\py2exe\distutils_buildexe.py", line 188, i
n run
self._run()
File "C:\Python33\lib\site-packages\py2exe\distutils_buildexe.py", line 267, i
n _run
builder.analyze()
File "C:\Python33\lib\site-packages\py2exe\runtime.py", line 157, in analyze
self.mf.import_package(modname[:-2])
File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 91, in import_package
self.import_hook(name)
File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 117, in import_hook
module = self._gcd_import(name)
File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 267, in _gcd_import
return self._find_and_load(name)
File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 320, in _find_and_loa
d
self._scan_code(module.__code__, module)
File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 358, in _scan_code
self.safe_import_hook(name, mod, fromlist, level)
File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 135, in safe_import_h
ook
self.import_hook(name, caller, fromlist, level)
File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 117, in import_hook
module = self._gcd_import(name)
File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 267, in _gcd_import
return self._find_and_load(name)
File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 320, in _find_and_loa
d
self._scan_code(module.__code__, module)
File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 358, in _scan_code
self.safe_import_hook(name, mod, fromlist, level)
File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 135, in safe_import_h
ook
self.import_hook(name, caller, fromlist, level)
File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 117, in import_hook
module = self._gcd_import(name)
File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 267, in _gcd_import
return self._find_and_load(name)
File "C:\Python33\lib\site-packages\py2exe\mf3.py", line 297, in _find_and_loa
d
loader = importlib.find_loader(name, path)
File "C:\Python33\lib\importlib\__init__.py", line 62, in find_loader
loader = sys.modules[name].__loader__
AttributeError: 'module' object has no attribute '__loader__'