[Pythonmac-SIG] Interesting bundlebuilder problem & resolution...

Bill Hutten bhutten at ns.sympatico.ca
Fri Sep 17 14:08:36 CEST 2004


Here's an interesting one:  I was working on some changes to a wxPython
application, it was running correctly when launched from the command
line, etc.  So I decide to build a test standalone, using the usual
"python buildapp.py --standalone build".  Here's what I got:

-------------------------------------------------
Traceback (most recent call last):
  File "buildapp.py", line 8, in ?
    libs = ["/usr/local/lib/wxPython-2.5.2.8/lib/libwx_macd-2.5.2.dylib"], 
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/plat-mac/bundlebuilder.py", line 912, in buildapp
    main(builder)
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/plat-mac/bundlebuilder.py", line 899, in main
    builder.setup()
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/plat-mac/bundlebuilder.py", line 437, in setup
    self.findDependencies()
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/plat-mac/bundlebuilder.py", line 628, in findDependencies
    mf.run_script(self.mainprogram)
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/modulefinder.py", line 112, in run_script
    self.load_module('__main__', fp, pathname, stuff)
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/modulefinder.py", line 265, in load_module
    co = compile(fp.read()+'\n', pathname, 'exec')
TypeError: compile() expected string without null bytes
-------------------------------------------------


After a bit of freaking out, I determined that the cause was that I had a
non 7-bit ASCII character in my Python source. It was a single character,
at the end of a line. Interestingly, it was a line that I had copied from
a webpage, and for whatever reason Safari had included this character.

I used BBEdit's "Zap Gremlins" command to find the offending character
and delete it.  Once that was done, bundlebuilder.py worked fine.

What's odd to me is that the app ran fine from the command-line via
"pythonw".  It was only when the code was compiled via bundlebuilder that
the gremlin character caused a problem.



Maybe this'll help someone else...


- bill
--
bhutten at ns.sympatico.ca
     "God made man, but he used the monkey to do it" - Devo



More information about the Pythonmac-SIG mailing list