467,114 Members | 1,410 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,114 developers. It's quick & easy.

Learning which modules were loaded

I am rolling up a distribution of a program I wrote. It uses matplotlib
with tkagg so the bundle is HUGE (47 MB, 14 MB after bz compression). Is
there any way to run the program, put it through all of its paces, and
then inspect which modules were loaded. I would like to gather these in
a list and delete any others that py2app and py2exe attempt to include.
Currently, these (or py2app, at least) use dependency graphing and
icnlude everything belonging to pylab, matplotlib, and numpy by default.
I don't want everything, I only want what my program needs to run. For
example, some modules are imported by functions (in Pmw, for example)
that never get called. I don't want to include these.

Thanks in advance for any help.

James
Jun 27 '08 #1
  • viewed: 943
Share:
1 Reply
James Stroud wrote:
I am rolling up a distribution of a program I wrote. It uses
matplotlib with tkagg so the bundle is HUGE (47 MB, 14 MB after bz
compression). Is there any way to run the program, put it through all
of its paces, and then inspect which modules were loaded. I would like
to gather these in a list and delete any others that py2app and py2exe
attempt to include. Currently, these (or py2app, at least) use
dependency graphing and icnlude everything belonging to pylab,
matplotlib, and numpy by default. I don't want everything, I only want
what my program needs to run. For example, some modules are imported
by functions (in Pmw, for example) that never get called. I don't want
to include these.

Thanks in advance for any help.

James
--
http://mail.python.org/mailman/listinfo/python-list
Import sys, then look at sys.modules. It's a dictionary that contains
all the imported modules, but I suspect you'll find that it's much
easier to let py2app and py2exe determine what's imported than it is to
go through sys.modules yourself.

Gary Herron

Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by saidev@gmail.com | last post: by
1 post views Thread by Remy Cool | last post: by
7 posts views Thread by Lauren Quantrell | last post: by
26 posts views Thread by mfasoccer@gmail.com | last post: by
4 posts views Thread by Frank | last post: by
2 posts views Thread by Marco | last post: by
1 post views Thread by bernhard.voigt@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.