On Apr 14, 6:31 am, "Gabriel Genellina" <gagsl-...@yahoo.com.ar> wrote: > En Tue, 13 Apr 2010 18:02:07 -0300, Luis Quesada <l.ques...@4c.ucc.ie> > escribi : > > > I am getting an "expected string without null bytes" error when using > > cxfreeze for creating a standalone application (in Linux-Ubuntu). None > > of my files has null bytes. > > Are you sure? A text file saved as, e.g., UTF-16, does contain null bytes. > > > cxfreeze's output > > ... > > File "/usr/lib/pymodules/python2.6/cx_Freeze/finder.py", line 386, in > > IncludeFile > > deferredImports) > > File "/usr/lib/pymodules/python2.6/cx_Freeze/finder.py", line 259, in > > _LoadModule > > module.code = compile(fp.read() + "\n", path, "exec") > > TypeError: compile() expected string without null bytes > > I would add a few 'print' statements in finder.py to determine which file > is failing. >
I did what you suggested: I modified finder.py so that it prints the name of the module before the compile statement that triggers the exception. This is what I get now: lques...@lquesada-laptop:~/workspace/MetroNode/src/models$ cxfreeze uncovered.py --target-dir dist compiling os compiling posixpath compiling stat compiling genericpath compiling warnings compiling linecache compiling types compiling re compiling sre_compile compiling sre_parse compiling sre_constants compiling copy_reg compiling UserDict compiling _abcoll compiling abc compiling copy compiling repr compiling subprocess compiling traceback compiling threading compiling functools compiling _strptime compiling locale compiling encodings compiling codecs compiling encodings.aliases compiling calendar compiling optparse compiling textwrap compiling string compiling gettext compiling struct compiling StringIO compiling token compiling tokenize compiling dummy_thread compiling collections compiling keyword compiling doctest compiling __future__ compiling inspect compiling dis compiling opcode compiling unittest compiling getopt compiling difflib compiling heapq compiling bisect compiling pdb compiling cmd compiling bdb compiling pprint compiling shlex compiling tempfile compiling random compiling _threading_local compiling pickle compiling __main__ compiling Numberjack compiling Decomp copying /usr/lib/pymodules/python2.6/cx_Freeze/bases/Console -> dist/ uncovered copying /usr/lib/libpython2.6.so.1.0 -> dist/libpython2.6.so.1.0 compiling cx_Freeze__init__ Traceback (most recent call last): File "/usr/bin/cxfreeze", line 5, in <module> main() File "/usr/lib/pymodules/python2.6/cx_Freeze/main.py", line 170, in main freezer.Freeze() File "/usr/lib/pymodules/python2.6/cx_Freeze/freezer.py", line 405, in Freeze self._FreezeExecutable(executable) File "/usr/lib/pymodules/python2.6/cx_Freeze/freezer.py", line 173, in _FreezeExecutable exe.copyDependentFiles, scriptModule) File "/usr/lib/pymodules/python2.6/cx_Freeze/freezer.py", line 333, in _WriteModules initModule = finder.IncludeFile(initScript, "cx_Freeze__init__") File "/usr/lib/pymodules/python2.6/cx_Freeze/finder.py", line 387, in IncludeFile deferredImports) File "/usr/lib/pymodules/python2.6/cx_Freeze/finder.py", line 260, in _LoadModule module.code = compile(fp.read() + "\n", path, "exec") TypeError: compile() expected string without null bytes Now I even more confused since it seems the problem is taking place when trying cx_Freeze__init__ .... Cheers, Luis -- http://mail.python.org/mailman/listinfo/python-list