.TH python pj "4 July 2005" .SH NAME Python Notes .SH DESCRIPTION Python loads modules using a PATH-like variable called PYTHONPATH. From within python, you can get this as sys.path. .PP If Python finds a module package in sys.path, it looks there for all submodules, and does not check the rest of sys.path. For instance, say you have this on your filesystem: .PP .RS .nf /a/pythonlib/MyPackage/MyModuleA /b/pythonlib/MyPackage/MyModuleA /b/pythonlib/MyPackage/MyModuleB .fi .RE .PP And say this is your sys.path: ['/a/pythonlib', '/b/pythonlib']. Then you will never find MyPackage.MyModuleB, because when Python sees MyPackage in /a/pythonlib, it will always look there for submodules. .PP If you're trying to figure out how to print stack traces, use the traceback module. Just call print_exc() if you're in an except handler, or print_stack() if you're not. There are other functions that operate on specific exception/traceback objects; see the documentation. And the exc_info() function isn't documented very well. It doesn't return a traceback object; it returns a tuple the third member of which is a traceback object. .PP If you want to format an exception for printing, you can do something along these lines: .PP .RS .nf try: a = b except: import traceback, sys print traceback.format_tb(sys.exc_info()[2])[0] .fi .RE .SH AUTHOR Paul Jungwirth .SH COPYRIGHT Copyright \(co 2005 Paul Jungwirth