[issue16047] Tools/freeze no longer works in Python 3

Marc-Andre Lemburg report at bugs.python.org
Tue Mar 25 18:17:22 CET 2014


Marc-Andre Lemburg added the comment:

On 25.03.2014 17:47, Christian Bachmaier wrote:
> 
> Christian Bachmaier added the comment:
> 
>> To test what I asked for, please run freeze on this script:
>>
>> """
>> import _psycopg2

Sorry. The above should have read "import _psycopg".

>> print ('Works.')
>> """
> 
> $ xxx/freeze.py hello.py
> $ make
> $ ./hello
> Traceback (most recent call last):
>   File "hello.py", line 3, in <module>
>     import _psycopg2
>   File "/usr/lib/python3.4/importlib/_bootstrap.py", line 2214, in _find_and_load
>     return _find_and_load_unlocked(name, import_)
>   File "/usr/lib/python3.4/importlib/_bootstrap.py", line 2201, in _find_and_load_unlocked
>     raise ImportError(_ERR_MSG.format(name), name=name)
> ImportError: No module named '_psycopg2'
> 
> Btw the same with import psycopg2, psycopg2._psycopg, or _psycopg. Event with the subdir link as explained above. The first one (import psycopg2) is the one which operates in interpretation mode.

Ok, now we're getting closer.

Could you run this to have Python print the locations where
it looks for the shared lib:

export PYTHONVERBOSE=2
./hello

This should print a long list of messages such as these:

import os # frozen
import errno # builtin
import posix # builtin
import posixpath # frozen
...

to stderr. Of those only the lines which mention _psycopg are relevant.

Please make sure that the dir where the .so file resides is
included in this list. If not, you will need to adjust PYTHONPATH
accordingly.

If the dir is mentioned in the listing, we have to dig deeper
using strace or similar.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16047>
_______________________________________


More information about the Python-bugs-list mailing list