Hi Giovanni,
I'm unable to reply to tickets on TRAC for some reason, so I'm posting
my results here.
Re-running scipy.pkgload() inside a runtime hook doesn't work. I think
this is because scipy.misc.__init__.py is overwriting the misc.info
namespace with a FUNCTION called info()! So there is no way for
pkgload (or pyinstaller, as far as I can tell) to read the
global_symbols from misc/info.py after scipy.misc.__init__.py has run.
What a mess! Someone's had lots of fun..
The only way I could get it to work was to manually copy the necessary
symbols into the scipy namespace (see runtime hook at the end of this
post).
For some reason, it wasn't necessary to create a hooks/hook-scipy.py
file - scipy.misc seems to get included automatically by pyinstaller.
It must be even cleverer than you think!
Thanks for your help, and good luck with the 1.4 release - this is a
fantastic project.
Cheers,
Pete
support/rthooks/scipy.py
# Scipy sneaks a few symbols from the scipy.misc package into the
scipy namespace.
# This behaviour needs to be duplicated by pyinstaller at runtime.
#
# NOTE: the necessary global_symbols can be verified by setting the
SCIPY_IMPORT_VERBOSE
# environment variable to 2, and typing "import scipy" in a
python session.
#
# Scipy 0.7.0 prints the following text:
#
# Imports to 'scipy' namespace
# ----------------------------
# import misc -> success
# from misc import info -> success
# Overwriting info=<function info at 0x00D16B70> from scipy.misc
# (was <function info at 0x00B9C770> from numpy.lib.utils)
# from misc import factorial -> success
# from misc import factorial2 -> success
# from misc import factorialk -> success
# from misc import comb -> success
# from misc import who -> success
# from misc import lena -> success
# from misc import central_diff_weights -> success
# from misc import derivative -> success
# from misc import pade -> success
# from misc import source -> success
#
import scipy.misc
global_symbols = {'misc' :
['info','factorial','factorial2','factorialk','comb','who',
'lena','central_diff_weights',
'derivative', 'pade', 'source',
],
}
for subpackage, symbols in global_symbols.items():
for symbol in symbols:
exec("scipy.%s = scipy.%s.%s" % (symbol, subpackage, symbol))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pyinstaller?hl=en
-~----------~----~----~----~------~----~------~--~---