freeze path problem (on nt)

Lawrence Hudson lhudson at geminidataloggers.com
Mon Jul 8 12:27:59 EDT 2002


Hi Aaron,

Which version of Python are you using?  Lots of 
import-at-runtime-from-frozen-binary problems were fixed in Python 221 
and I think that this is one of them.  221 added a couple of options to 
freeze; from the docstring:
-X module     Like -x, except the module can never be imported by
               the frozen binary.

-E:           Freeze will fail if any modules can't be found (that
               were not excluded using -x or -X).

I believe that if -E is not specified then the default behaviour is 
unchanged, ie: modules which can not be found by freeze will not be 
included in the frozen program and the normal sys.path import mechanism 
will be used at runtime.

Turning on -E will require you to add -X for a few modules that the 
standard library will try to import but may not be available on your 
machine, eg TERMIOS, java.lang, Tkinter etc).  We always use the -E 
switch to be confident of avoiding weird import problems at runtime.

If you are using an earlier version then it would be worth trying 221. 
If you still have problems then try setting the PYTHONVERBOSE 
environment variable before running the frozen program to see exactly 
what is being imported from where.

Is rlextra a reportlab module?  I don't have reportlab but it is 
possible that it performs some sys.path tricks in which case freezing 
will be tricky.

Hope this helps!

Thanks,
Lawrence



Aaron Watters wrote:
> Hi guys.  I have the following problem.
> 
> I use tools/freeze to build a frozen exe (X.exe) for windows using vc++ 6.
> 
> If I run it on a machine without a python installation it runs fine.
> But if I run it on a machine with python and a package called
> 
>     rlextra.rml2pdf
> 
> then the import
> 
>     from rlextra.rml2pdf import rml2pdf
> 
> imports the python module from the file system in preference to the
> frozen pyc that is compiled into X.exe.  This is a problem, of course
> if the version of rml2pdf on the file system differs from the one in X.exe.
> 
> It must have something to do with sys.path and/or those goofy *.pth files
> right?
> 
> Anyway, how do I prevent X.exe from trying to import stuff from the
> file system first before looking internally... anybody got a clue?
> 
> thx in advance
> 
>    =- Aaron Watters
> 
> ===
> JUVENILE COURT TO TRY SHOOTING SUSPECT
>    -- from "real headlines" (that should work...)





More information about the Python-list mailing list