Here's a recipe I can use to reproduce the problem on my PC.
Environment:
* Windows 7 SP1 x64
* Python 3.4.0rc3
* cx_Freeze checkout from its current HEAD
* repository: https://bitbucket.org/anthony_tuininga/cx_freeze
* HEAD commit: 52b63b3296843cd612cfbe047a9f6529df4c0444
* I'm attaching a compressed checkout.
* TortoiseHg 2.11 - just in case you're having problems using
the cx_Freeze Hg sandbox I attached to this comment and want
to know if it is Hg version related.
* Microsoft Visual Studio 2010 C/C++ compiler.
* Exact cl.exe version information: "Microsoft (R) 32-bit
C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86"
-- 1. prepare to build cx_Freeze --
To build the given cx_Freeze project using Python 3.4 the
following tweak must first be done in Python's
Lib\distutils\msvc9compiler.py module:
Around line 649 replace the line:
if mfinfo is not None:
with:
if mfinfo is not None and target_desc != "executable":
This is an unrelated issue that still needs to be researched.
-- 2. build & install cx_Freeze --
Standard Python package installation - go to your cx_Freeze
sandbox project folder and run "py34 setup.py install".
This should result in "cx_Freeze-4.3.2-py3.4-win-amd64.egg"
folder being added under your Python 3.4 installation's
site-packages folder.
-- 3. prepare a test project --
Create a new folder and add the following files to it:
hello_world.py:
print("Hello world")
import asyncio
import sys
print(sys.version_info)
setup.py:
from cx_Freeze import setup, Executable
setup(name="HelloWorld",
version="0.1",
description="HelloWorld",
executables=[Executable("hello_world.py", base="Console")])
Note that only the 'import asyncio' line is necessary to
reproduce the issue. The rest is just useful output for the
user/tester.
-- 4. prepare a 'frozen' test project executable --
Go to the test project folder and run the following command:
py34 setup.py build_exe
This should create a new executable under:
build\exe.win-amd64-3.4\hello_world.exe
-- 5. run the prepared executable --
You should get output looking something like:
Hello world
Traceback (most recent call last):
File "C:\Program Files\Python\Python34rc3\lib\site-packages\cx_freeze-4.3.2-py3.4-win-amd64.egg\cx_Freeze\initscripts\Cons
exec(code, m.__dict__)
File "hello_world.py", line 8, in <module>
import asyncio
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 2214, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 2203, in _find_and_load_unlocked
module = _SpecMethods(spec)._load_unlocked()
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
return self._load_backward_compatible()
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
spec.loader.load_module(spec.name)
File "C:\Program Files\Python\Python34rc3\lib\asyncio\__init__.py", line 23, in <module>
from .locks import *
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 2214, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 2203, in _find_and_load_unlocked
module = _SpecMethods(spec)._load_unlocked()
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
return self._load_backward_compatible()
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
spec.loader.load_module(spec.name)
File "C:\Program Files\Python\Python34rc3\lib\asyncio\locks.py", line 9, in <module>
from . import tasks
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 2261, in _handle_fromlist
_call_with_frames_removed(import_, from_name)
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 321, in _call_with_frames_removed
return f(*args, **kwds)
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 2214, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 2203, in _find_and_load_unlocked
module = _SpecMethods(spec)._load_unlocked()
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
return self._load_backward_compatible()
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
spec.loader.load_module(spec.name)
File "C:\Program Files\Python\Python34rc3\lib\asyncio\tasks.py", line 12, in <module>
import inspect
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 2214, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 2203, in _find_and_load_unlocked
module = _SpecMethods(spec)._load_unlocked()
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked
return self._load_backward_compatible()
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible
spec.loader.load_module(spec.name)
File "C:\Program Files\Python\Python34rc3\lib\inspect.py", line 35, in <module>
import importlib.machinery
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 2214, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 2189, in _find_and_load_unlocked
_call_with_frames_removed(import_, parent)
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 321, in _call_with_frames_removed
return f(*args, **kwds)
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 2214, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 2203, in _find_and_load_unlocked
module = _SpecMethods(spec)._load_unlocked()
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 1200, in _load_unlocked
self._exec(module)
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 1129, in _exec
self.spec.loader.exec_module(module)
File "C:\Program Files\Python\Python34rc3\lib\importlib\_bootstrap.py", line 1336, in exec_module
exec(code, module.__dict__)
File "C:\Program Files\Python\Python34rc3\lib\importlib\__init__.py", line 26, in <module>
_bootstrap.__file__ = __file__.replace('__init__.py', '_bootstrap.py')
NameError: name '__file__' is not defined
Hope this helps.
Best regards,
Jurko Gospodnetić |