Creating a standalone application

Luis Quesada luis.omar.quesada.ramirez at
Wed Apr 14 05:10:59 EDT 2010

On Apr 14, 6:31 am, "Gabriel Genellina" <gagsl-... at>
> En Tue, 13 Apr 2010 18:02:07 -0300, Luis Quesada <l.ques... at>  
> 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/", line 386, in  
> > IncludeFile
> >      deferredImports)
> >    File "/usr/lib/pymodules/python2.6/cx_Freeze/", line 259, in  
> > _LoadModule
> >      module.code = compile( + "\n", path, "exec")
> > TypeError: compile() expected string without null bytes
> I would add a few 'print' statements in to determine which file  
> is failing.

I did what you suggested: I modified so that it prints the
name of the module before the compile statement that triggers the
exception. This is what I get now:

lquesada at lquesada-laptop:~/workspace/MetroNode/src/models$ cxfreeze --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/
copying /usr/lib/ -> dist/
compiling cx_Freeze__init__
Traceback (most recent call last):
  File "/usr/bin/cxfreeze", line 5, in <module>
  File "/usr/lib/pymodules/python2.6/cx_Freeze/", line 170, in
  File "/usr/lib/pymodules/python2.6/cx_Freeze/", line 405,
in Freeze
  File "/usr/lib/pymodules/python2.6/cx_Freeze/", line 173,
in _FreezeExecutable
    exe.copyDependentFiles, scriptModule)
  File "/usr/lib/pymodules/python2.6/cx_Freeze/", line 333,
in _WriteModules
    initModule = finder.IncludeFile(initScript, "cx_Freeze__init__")
  File "/usr/lib/pymodules/python2.6/cx_Freeze/", line 387,
in IncludeFile
  File "/usr/lib/pymodules/python2.6/cx_Freeze/", line 260,
in _LoadModule
    module.code = compile( + "\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__ ....

More information about the Python-list mailing list