[Pythonmac-SIG] Strange MacPython (2.2.1) Behavior

JR jharmon@adobe.com
Thu, 31 Oct 2002 12:10:28 -0800


I'm running into some odd behavior from MacPython and was hoping that
someone (here) might be able to provide some guidance...

I've built a module that seemingly loads correctly, etc.  If I import that
module (e.g., from foo import *) and then line by line enter Python code in
the Interpreter everything behaves fine.  Yet, the same Python code read in
from a text file (e.g., drag foo.py to PythonInterpreter) exhibits what I
can only describe as structural failures (a result of garbage collection?).
Here is some sample code:

from module import *

def _test():
    session = session_class_ctor()
    dict = session.create_dict()
    field = dict.Get("key")


_test()

...if I enter code like this interactively everything works fine.  session,
dict and field all remain uncollected (with >0 counters) and exhibit valid
types (i.e., type(session) => '<session::blah>').  Yet, if I encapsulate the
same code in a .py file and drag/drop the same on the interpreter the
interpreter complains that dict has no Get attrbiute because it is of Type:
None