On Aug 9, 1:11 am, stef mientki <[EMAIL PROTECTED]> wrote: > hello, > > I'm working on a rather strange program, > that is partially build dynamically, > and where users can create plugins, > without knowing any of the details of the core program. > > Of course this leads to some weird bugs, > so one of the things I want to view/log is the order (and even better > the way) modules are imported.
Set and export the environment variable: PYTHONVERBOSE=1 in your environment before you run Python. This will generate lots of internal information about what Python is up to, including details about module importing, where it is searching for modules etc etc. For example: >>> import socket # /System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/socket.pyc matches /System/Library/Frameworks/ Python.framework/Versions/2.3/lib/python2.3/socket.py import socket # precompiled from /System/Library/Frameworks/ Python.framework/Versions/2.3/lib/python2.3/socket.pyc dlopen("/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/lib-dynload/_socket.so", 2); import _socket # dynamically loaded from /System/Library/Frameworks/ Python.framework/Versions/2.3/lib/python2.3/lib-dynload/_socket.so dlopen("/System/Library/Frameworks/Python.framework/Versions/2.3/lib/ python2.3/lib-dynload/_ssl.so", 2); import _ssl # dynamically loaded from /System/Library/Frameworks/ Python.framework/Versions/2.3/lib/python2.3/lib-dynload/_ssl.so import errno # builtin Output goes to standard error. There can be quite a lot, so you may want to redirect standard error to a file. Graham -- http://mail.python.org/mailman/listinfo/python-list