Problem using compileall

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Feb 3 11:59:07 EST 2009


En Tue, 03 Feb 2009 05:53:06 -0200, Stephen Hansen <apt.shansen at gmail.com>  
escribió:

> I'm having a slight problem with pre-compiling some files for  
> distribution
> that I'm not sure where to even look for.
>
> An excerpt from an output:
>
>     C:\mother\Python24\core\application\sysconfig>python -m compileall .
>     Listing . ...
>     Compiling .\BulkListClass.py ...
>     Sorry: TypeError: ('compile() expected string without null bytes',)
>     Compiling .\BulkUserImporter.py ...
>
> The BulkListClass is then not creating a PYC.

Try this to discover whether the file actually contains a NUL byte or not:

f = open("BulkListClass.py","rb")
src = f.read()
i = src.index('\0')
print "found NUL at index", i
print repr(src[i-20:i+20])


-- 
Gabriel Genellina




More information about the Python-list mailing list