[issue24794] PyZipFile mixes compiled files from different python versions.

2015-08-05 Thread Amund Hov

New submission from Amund Hov:

In my project I have a mixture of scripts using Python 2.7 and 3.4.
Some of the scripts using python 3.4 are packaged into archives using
PyZipFile.

Through some combination I ended up with 2.7 compiled packages in my archive 
when packaging using python 3.4. In combination with issue 24792 "zipimporter 
masks import errors" this led to many grey hairs figuring out why my packaging 
scripts suddenly broke.

Are there sufficient provisions in PyZipFile to prevent this? It seems it will 
happily mix compiled files with differing magic bytes.

--
messages: 248024
nosy: Amund Hov
priority: normal
severity: normal
status: open
title: PyZipFile mixes compiled files from different python versions.
type: behavior

___
Python tracker 
<http://bugs.python.org/issue24794>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24792] zipimporter masks import errors

2015-08-05 Thread Amund Hov

Changes by Amund Hov :


--
type: behavior -> enhancement

___
Python tracker 
<http://bugs.python.org/issue24792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24792] zipimporter masks import errors

2015-08-05 Thread Amund Hov

New submission from Amund Hov:

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]: 

In [5]: zf.load_module('kitconsole')
---
ZipImportErrorTraceback (most recent call last)
 in ()
> 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.

--
messages: 248022
nosy: Amund Hov
priority: normal
severity: normal
status: open
title: zipimporter masks import errors
type: behavior
versions: Python 3.4

___
Python tracker 
<http://bugs.python.org/issue24792>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com