exporting imports to reduce exe size?

Chris Cioffi evenprimes at gmail.com
Tue Apr 12 12:14:38 EDT 2005


My first thought is what if the function you are using uses other
functions(maybe not exported by the module/package)?  For example:  if
some_func() makes a call to _some_weird_module_specific_func(), how
are you going to make sure you get the
_some_weird_module_specific_func function?  This doesn't even start to
work when the function you are interested in is also using functions
from other modules/packages.

Besides, what py2exe is really doing is grabbing the .pyo or .pyc
files and throwing them in a zip file.  Is it really worth the effort
to save a 100K or so, at most?

Chris

On Apr 12, 2005 10:54 AM, Ron_Adam <radam2_ at _tampabay.rr.com> wrote:
> 
> In looking at ways to reduce the size of exe's created with py2exe,
> I've noticed that it will include a whole library or module even if I
> only need one function or value from it.
> 
> What I would like to do is to import individual functions and then
> export 'write' them to a common resource file and import that with
> just the resources I need in them.
> 
> Has anyone tried this?
> 
> I'm considering using pickle to do it, but was wondering if this is
> even a viable idea?
> 
> Is it possible to pickle the name space after the imports and then
> reload the name space in place of the imports later?
> 
> Cheers,
> Ron
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
> 


-- 
"I was born not knowing and have had only a little time to change that
here and there." -- Richard Feynman



More information about the Python-list mailing list