data_garden data_garden - 1 year ago 100
Python Question

Python - tracing module execution

I am running a large
with many
, like:

from module import *

when I run it, I am printing some undesired result
[u'Brewer and Shipley']
, at importing time, which I'm not being able to trace back to its
and stop it from being executed.

Is there something I can use to trace and stop this?

Answer Source

While blowing to find out who blew is excellent suggestion by @FMc, Here is another trick I use

import X print 'X imported' import Y print 'Y imported' import Z print 'Z imported'

This will also help you narrow down module with a problem. :)

You can optimize this by doing binary search by printing middle points, but I guess that's over-engg.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download