On May 13, 1:54 pm, Giovanni Bajo <[email protected]> wrote:
> There's something missing here.
>
> Jamie's issue is reproducible on the same machine where you build
> PyInstaller. In fact, Jamie's understanding is that encodings are
> *always* brokern on Python 2.6.
>
> Yours (Vinay's) issue only happens when a 2.6-built executable is run on
> a 2.5 system.
>
> They look like different issues to me. I'll have a look at reproducing
> either later today.
I turned debugging on in iu.py (and modified it slightly to add a bit
more information in the debug output). In my test script, I did (on
Ubuntu Jaunty/python2.6)
import logging
import encodings
The debugging trace starts off like this:
importHook(encodings, __main__, locals, None, -1)
importernm __main__
contexts: [None], nmparts: ['encodings']
importHook trying encodings in None
sys.modules.get(encodings) -> <module 'encodings' from '/usr/lib/
python2.6/encodings/__init__.pyc'>
importHook done with encodings __main__ None (case 2)
importHook(logging, __main__, locals, None, -1)
importernm __main__
contexts: [None], nmparts: ['logging']
importHook trying logging in None
sys.modules.get(logging) -> -1
trying logging None logging
doimport(logging, None, logging)
[...]
..found <module 'logging' from '/home/vinay/projects/py_scratch/build/
pyi.linux2/munge/outPYZ1.pyz/logging'> when looking for logging
[...]
Now, I'm not sure why importHook sees an attempt to import encodings
first, when the script imports logging first. That's one oddity.
Skipping over that for now, we see that different paths are taken in
iu.py because sys.modules.get("encodings", UNTRIED) returns the module
which is already imported from the host system. So, it appears that
encodings is already imported before importHook gets called for the
first time. However, logging has not already been imported, so iu.py
takes the expected path and eventually imports logging from the pyz
file.
So, I think (like Jamie) that encodings handling is broken for Python
2.6, period. Different errors might show up because of that
brokenness. In fact, as you said earlier in this thread:
"No, this is wrong: you can see that it is importing "encodings" from /
usr/lib, instead of using the version within the executable."
It would appear that this needs to be fixed first, and this might then
turn out to be all that needs doing to sort out the other symptoms.
Regards,
Vinay Sajip
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---