Author Amund Hov
Recipients Amund Hov
Date 2015-08-05.08:51:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1438764662.95.0.423222705195.issue24792@psf.upfronthosting.co.za>
In-reply-to
Content
Due to mixed version .pyc files in my zipped python application I was getting inconsistent loading of certain packages.

E.g.

n [4]: zf.find_module('kitconsole')
Out[4]: <zipimporter object "test_controller_test.zip">

In [5]: zf.load_module('kitconsole')
---------------------------------------------------------------------------
ZipImportError                            Traceback (most recent call last)
<ipython-input-5-8e75885cc952> in <module>()
----> 1 zf.load_module('kitconsole')

ZipImportError: can't find module 'kitconsole'


Unpacking the archive and doing the import from the file system revealed the  real issue, ImportError: Bad Magic Number.

As an end user it was confusing that zipimporter reported being able to find the module in find_module(), but not in load_module(). Is it possible to have load_module provide a better error message when import fails? The wording now does not give any hints when searching the bug-tracker / Google.
History
Date User Action Args
2015-08-05 08:51:03Amund Hovsetrecipients: + Amund Hov
2015-08-05 08:51:02Amund Hovsetmessageid: <1438764662.95.0.423222705195.issue24792@psf.upfronthosting.co.za>
2015-08-05 08:51:02Amund Hovlinkissue24792 messages
2015-08-05 08:51:01Amund Hovcreate