I also ran into this issue, but I found an extremely cheesy hack to fix this. The problem is that cxfreeze is opening all files with universal newline support on, and as such the following happens:
cx_Freeze opens a compiled bytecode file, and scans for the magic number, '\xd1\xf2\r\n', but universal newline mode turns this into '\xd1\xf2\n', thus misidentifying the bytecode as Python source, which is then passed to compile, which crashes.
When I hit this issue, in about twenty minutes I found a cheesy workaround, namely to insert:
... before line 258 of /usr/lib/pymodules/python2.6/cx_Freeze/finder.py
# TOTAL HACK WORKAROUND BY PETER
print "Peter's horrible hack is activiating, forcing", fp.name, "into binary mode, and as compiled Python."
type = imp.PY_COMPILED
# Next, switch out of universal newline mode in this crazy case.
fp = open(fp.name, "rb")
# END TOTAL HACK
Or, as a patch:
Hope this solves your problem,
*** tmp/orginal_finder.py 2010-07-06 13:33:14.000000000 -0400
--- /usr/share/pyshared/cx_Freeze/finder.py 2010-07-05 13:09:07.000000000 -0400
*** 255,260 ****
--- 255,268 ----
module = self._AddModule(name)
module.file = path
module.parent = parent
+ # TOTAL HACK WORKAROUND BY PETER
+ if fp.name.endswith(".pyc"):
+ print "Peter's horrible hack is activiating, forcing", fp.name, "into binary mode, and as compiled Python."
+ type = imp.PY_COMPILED
+ # Next, switch out of universal newline mode in this crazy case.
+ fp = open(fp.name, "rb")
+ # END TOTAL HACK
if type == imp.PY_SOURCE:
module.code = compile(fp.read() + "\n", path, "exec")
elif type == imp.PY_COMPILED: