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

Marc-Andre Lemburg report at bugs.python.org
Tue Mar 25 21:07:45 CET 2014


Marc-Andre Lemburg added the comment:

On 25.03.2014 19:41, M.-A. Lemburg wrote:
> I'll have to have a look at how the pyscopg2 package normally
> imports its C extension. It's likely that they will have to use
> something like this to make things work for frozen apps as well:
> 
> try:
>     from psycopg2 import _psycopg
> except ImportError:
>     # try to find the module at the top-level
>     import _psyocpg
> 
> or setup the package's .__path__ to include the top-level
> dir.

The package uses absolute imports for importing the C extension, e.g.

from psycopg2._psycopg import __version__

This cannot work in Python with frozen packages. Not in Python 2 and
not in Python 3 either.

Christian: Your only option is not to freeze the psycopg2 package
and ship it along side your frozen application or to build the
frozen app with the psycopg2 C extension built statically.

In any case, freeze is not at fault here.

----------

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


More information about the Python-bugs-list mailing list