473,287 Members | 1,643 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

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
1 1129
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: saidev | last post by:
A quick question, I'm about to recompile PHP, last time I compiled it with alot of modules, thinking that this time I should not need that many. Is there any tool(s) that could run under the...
1
by: Remy Cool | last post by:
Hello, I've created an archive import class (with the help of importers.py from the python /demo/imputil dir) which imports packages and modules from a dictionary. So far so good. The problem...
4
by: Jelmer | last post by:
Hi I've been trying to create an addin similar to Find & Replace from Rick Fisher that looks thru your tables / queries / forms / modules etc.. for a reference to a string and optionally let's you...
7
by: Lauren Quantrell | last post by:
At running the risk of asking how big is too big... Is there a rule of thumb or a best practice that says I may have too many modules? I currently have a Access2K app with about 30 code modules,...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
26
by: mfasoccer | last post by:
I am sorry if this is an inappropriate place to put this post, if so please delete it. I am wondering about a few things. Do you guys recommend learning C as a second language, as someone who...
4
by: Frank | last post by:
Hi, I have the following weird behavior when I load modules: 8 Everything is fine. Traceback (most recent call last):
2
by: Marco | last post by:
Hi Is there a way to find out if a thread holds a handle to a loaded module? In detail: I have all IDs and handles of all running threads and loaded modules(dlls) of a process. No i want to...
1
by: bernhard.voigt | last post by:
Hey! I'm using ipython as my python shell and often run scripts with the magic command %run: In : %run script.py If modules are loaded within the script these are not reloaded when I rerun...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.