[Python-bugs-list] [ python-Bugs-622953 ] import order changes with freeze

noreply@sourceforge.net noreply@sourceforge.net
Thu, 17 Oct 2002 07:34:14 -0700


Bugs item #622953, was opened at 2002-10-14 06:43
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=622953&group_id=5470

Category: Demos and Tools
Group: Python 2.2.1
>Status: Closed
>Resolution: Invalid
Priority: 3
Submitted By: Pim Buurman (pimbuur)
Assigned to: Guido van Rossum (gvanrossum)
Summary: import order changes with freeze

Initial Comment:
When you have simple .py files in packages, when you
do:
from mainp.subp import submod
both mainp and mainp.subp are imported,
i.e. mainp.__init__.py and mainp.subp.__init__.py are 
interpreted.
If you have frozen the package (Tools/freeze), 
mainp.subp.submod is found at once, and mainp and 
mainp.subp are not imported.
This breaks the code for more complex situations, where the 
__init__ does contain vital initialization code.

----------------------------------------------------------------------

Comment By: Pim Buurman (pimbuur)
Date: 2002-10-17 08:41

Message:
Logged In: YES 
user_id=157121

Sorry to bother you.
I was calling too early.
The frozen code works as expected.
I had not registered my special module for doing vital initialization 
code, and silently ignored the import failure.
Please close this bug.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-10-14 19:49

Message:
Logged In: YES 
user_id=6380

I tried to reproduce this, but did not get the result you
claim. I put "print __file__, __name__" in each of
mainp/__init__.py, mainp/subp/__init__.py, and
mainp/subp/submod.py. Then I freeze a module that contains
"from mainp.subp import submod". This prints:

<frozen> mainp
<frozen> mainp.subp
<frozen> mainp.subp.submod

Perhaps you dod something else wrong? How did you invoke
freeze.py?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=622953&group_id=5470