import behaviour on Mac and Unix

Igor V. Rafienko igorr at ifi.uio.no
Tue Aug 8 08:50:36 EDT 2000


Hi,

It seems to me that import behaves differently on Unix (Linux) and
Mac. 

I have a code that looks approximately like this (this is simplified,
of course):

file: bar.py
#!/usr/bin/env python

def foo():
    print "I'm foo!\n"


When I start the interpreter and load module bar, dir() reports that
foo is present in that module. This is the behaviour on Unix, and this
is, AFAIK, the expected behaviour.

However, on Mac, the *exactly* same file (except perhaps for
tranformation of Unix style newlines into Mac style newlines) can be
imported, *but* module bar contains nothing but __doc__, __file__ and
__builtins__. There is *no* reference to foo.

In both cases, it's a standard Python-1.5.2 distribution. Furthermore,
just to underline -- import does not fail on Mac, it simply does not
fetch function/class names from the imported module. 

Has anyone ever encountered a similar problem before? 


tia,


ivr
-- 
"This 'love' intrigs me -- teach me to fake it"
	-- Dr. Zoidberg from "Why must I be a Crustacean in love?"



More information about the Python-list mailing list