Issue #16 resolved

Failure in strange code path

Jonathan Geddes
created an issue

The stacktrace I get is:

Traceback (most recent call last): File "build.py", line 15, in <module> executables=[Executable("Agent.py", base=None)]) File "C:\Python33\lib\site-packages\cx_Freeze\dist.py", line 365, in setup distutils.core.setup(**attrs) 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\cx_Freeze\windist.py", line 363, in run self.run_command('build') File "C:\Python33\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Python33\lib\distutils\dist.py", line 936, in run_command cmd_obj.run() File "C:\Python33\lib\distutils\command\build.py", line 126, in run self.run_command(cmd_name) File "C:\Python33\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Python33\lib\distutils\dist.py", line 936, in run_command cmd_obj.run() File "C:\Python33\lib\site-packages\cx_Freeze\dist.py", line 235, in run freezer.Freeze() File "C:\Python33\lib\site-packages\cx_Freeze\freezer.py", line 570, in Freeze self.finder = self._GetModuleFinder() File "C:\Python33\lib\site-packages\cx_Freeze\freezer.py", line 325, in _GetModuleFinder finder.IncludePackage(name) File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 536, in IncludePackage self._ImportAllSubModules(module, deferredImports) File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 211, in _ImportAllSubModules recursive) File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 211, in _ImportAllSubModules recursive) File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 205, in _ImportAllSubModules deferredImports) File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 320, in _InternalImportModule parentModule, namespace) File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 367, in _LoadModule self._ScanCode(module.code, module, deferredImports) File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 455, in _ScanCode module, relativeImportIndex) File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 269, in _ImportModule deferredImports, namespace = namespace) File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 320, in _InternalImportModule parentModule, namespace) File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 367, in _LoadModule self._ScanCode(module.code, module, deferredImports) File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 492, in _ScanCode topLevel = False) File "C:\Python33\lib\site-packages\cx_Freeze\finder.py", line 452, in _ScanCode fromList, = arguments ValueError: too many values to unpack (expected 1)

Comments (13)

  1. Jonathan Geddes reporter

    I first started seeing the error when I added six to my project.

    I was able to make a temporary fix to the code (installed from sourceforge) that fixed the problem for my build:

    On the line with the error (452 of finder.py) I replaced

    fromList, = argument
    

    with

    fromList, *rest = argument
    

    but I suspect that this isn't entirely correct since the code seems to assume that argument will have either 1 or 2 items.

  2. Thomas Kluyver

    Sorry, I didn't see your reply sooner.

    This bit is pulling apart the bytecode. It's possible that the bytecode structure has changed in 3.3, but playing around with the dis module, I can't make an import statement that puts more than two values on the stack before it calls IMPORT_NAME. Or it could simply be a bug in how we handle the bytecode. So I'm interested in a minimal example that can reproduce it.

    As you say, ignoring the rest of the arguments might be overlooking something important if the bytecode structure has changed.

  3. martin_prusse

    I am using "Python 2.5.4" and "cx_Freeze 4.1.2" and faced a similar problem. It was related with an "import" inside a "finally" block, moving it out solved the problem. You could try to reproduce it with:

    try:
        pass
    finally:
        import re
        print re
    
  4. Log in to comment