[issue43229] freeze searches libpython3.9.so in /usr/lib instead /usr/lib/x86_64-linux-gnu

2021-03-09 Thread Christian Bachmaier


Christian Bachmaier  added the comment:

As for some time now, first I have to manually fix 
https://bugs.python.org/issue40350 first, i.e., use the recommended workaround 
not None check for spec.loader in /usr/lib/python3.9/modulefinder.py.


Setting LIBDIR to /usr/lib/x86_64-linux-gnu in 
/usr/lib/python3.9/_sysconfigdata__x86_64-linux-gnu.py
setting seams to fixe the issue linking issue of libpython3.9.so .


However, then the missing PyInit_lazr problem (as indicated in my first 
posting) stays:

...ml__sax__handler.o M_xml__sax__saxutils.o M_xml__sax__xmlreader.o M_xmlrpc.o 
M_xmlrpc__client.o M_zipfile.o M_zipimport.o 
/usr/lib/x86_64-linux-gnu/libpython3.9.so -lexpat   
-L/usr/lib -lz-lexpat  -lcrypt -lpthread -ldl  -lutil 
-lm -lm  -o helloworld
/usr/bin/ld: config.o:(.data.rel+0x278): undefined reference to `PyInit_lazr'
collect2: error: ld returned 1 exit status
make: *** [Makefile:900: helloworld] Error 1

--

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



[issue43229] freeze searches libpython3.9.so in /usr/lib instead /usr/lib/x86_64-linux-gnu

2021-02-28 Thread Christian Bachmaier


Christian Bachmaier  added the comment:

Anyone?

--

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



[issue43229] freeze searches libpython3.9.so in /usr/lib instead /usr/lib/x86_64-linux-gnu

2021-02-23 Thread Christian Bachmaier


Change by Christian Bachmaier :


--
type:  -> compile error

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



[issue43229] freeze searches libpython3.9.so in /usr/lib instead /usr/lib/x86_64-linux-gnu

2021-02-23 Thread Christian Bachmaier


Christian Bachmaier  added the comment:

The same situation in Ubuntu development branch's package python3.9.2-0ubuntu2 .

Inserting the follwing

if sysconfig.get_config_var('MULTIARCH'):
masd = sysconfig.get_config_var('multiarchsubdir')
if masd.startswith(os.sep):
masd = masd[len(os.sep):]
libdir = os.path.join(libdir, masd)

directly after line ~ 247 in freeze.py

libdir = sysconfig.get_config_var('LIBDIR')

seems to fix the first problem.

--

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



[issue43229] freeze searches libpython3.9.so in /usr/lib instead /usr/lib/x86_64-linux-gnu

2021-02-15 Thread Christian Bachmaier


Christian Bachmaier  added the comment:

Sorry, my Ubuntu version I mentioned above is the development version of 21.04 
and not 20.04.

I you would like or this would be a comfortable option for you, I can show this 
live/interactively in a shell of my test system to track down the error, say 
via a skype session.

--

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



[issue43229] freeze searches libpython3.9.so in /usr/lib instead /usr/lib/x86_64-linux-gnu

2021-02-15 Thread Christian Bachmaier


New submission from Christian Bachmaier :

Now that the patch from issue 42591 (https://bugs.python.org/issue42591), i.e., 
msg383154 from 12/16/20  has made it to Ubuntu 20.04 with packet version 
python3.9.1-1, there show some problems with that.

I did:
> freeze/freeze.py -o frozen helloworld.py
> cd frozen
> make

This delivers a linker error
...xml__parsers.o M_xml__parsers__expat.o M_xml__sax.o 
M_xml__sax___exceptions.o M_xml__sax__expatreader.o M_xml__sax__handler.o 
M_xml__sax__saxutils.o M_xml__sax__xmlreader.o M_xmlrpc.o M_xmlrpc__client.o 
M_zipfile.o M_zipimport.o /usr/lib/libpython3.9.so -lexpat  
 -L/usr/lib -lz-lexpat  -lcrypt -lpthread -ldl  -lutil 
-lm -lm  -o helloworld
x86_64-linux-gnu-gcc: error: /usr/lib/libpython3.9.so: No such file or directory
make: *** [Makefile:1234: helloworld] Error 1

The linker searches libpython3.9 in /usr/lib instead in 
/usr/lib/x86_64-linux-gnu . The "hot-fix"
> ln -s /usr/lib/x86_64-linux-gnu/libpython3.9.so /usr/lib/libpython3.9.so
fixes that, but brings another error:

> freeze/freeze.py -o frozen helloworld.py
> cd frozen
> make
 
...xml__parsers.o M_xml__parsers__expat.o M_xml__sax.o 
M_xml__sax___exceptions.o M_xml__sax__expatreader.o M_xml__sax__handler.o 
M_xml__sax__saxutils.o M_xml__sax__xmlreader.o M_xmlrpc.o M_xmlrpc__client.o 
M_zipfile.o M_zipimport.o /usr/lib/libpython3.9.so -lexpat  
 -L/usr/lib -lz-lexpat  -lcrypt -lpthread -ldl  -lutil 
-lm -lm  -o helloworld
/usr/bin/ld: config.o:(.data.rel+0x278): undefined reference to `PyInit_lazr'
collect2: error: ld returned 1 exit status
make: *** [Makefile:1234: helloworld] Error 1

@Victor: I know there are alternatives to freeze, however, I have to keep a 
larger legacy project running, and I am not that expert. Maybe you could have a 
look on the above.

--
components: Library (Lib)
messages: 387015
nosy: chba
priority: normal
severity: normal
status: open
title: freeze searches libpython3.9.so in /usr/lib instead 
/usr/lib/x86_64-linux-gnu
versions: Python 3.9

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



[issue42591] Method Py_FrozenMain missing in libpython3.9

2020-12-16 Thread Christian Bachmaier


Christian Bachmaier  added the comment:

Vistor Stinner:
> If you can test it, I can backport the fix to stable branches.

Seems to work like a charm. Basically I used the same testing setup as 
previously on Dec 10th under Debian testing/bullseye without step 2, as master 
already contains your fix.

Victor, many thanks again, you are great!

--

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



[issue42591] Method Py_FrozenMain missing in libpython3.9

2020-12-16 Thread Christian Bachmaier


Christian Bachmaier  added the comment:

> Do you mean freeze.py from Tools/freeze/freeze.py?

Yes, unfortunately I have to keep a large old system running and there are only 
few options left. It is a University learning system, where students upload 
program code and then a huge amount of automtic quality checks are executed 
within a sandbox. The grading is done in a half automtic way. A real 
alternative is not existing, we tried hard to find one...

> This tool seems to 
> be broken for 4 years, since Python 3.6: bpo-42613.
> 4. freeze.py wants wants this for a very long time:
>ln -s /usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu
>  /usr/local/lib/python3.10/config-3.10

The symlink does the trick. So it may be easy for you to fix that, so it does 
operate out of the box again.

--

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



[issue42591] Method Py_FrozenMain missing in libpython3.9

2020-12-10 Thread Christian Bachmaier


Christian Bachmaier  added the comment:

Dear Victor,

a simple test with the tools/freeze/hello.py example was successfull with your 
patch and the newest cpython from github.

1. git clone https://github.com/python/cpython.git
2. Applied a patch of your pull request
3. configure, make, amke install to xxx
4. freeze.py wants wants this for a very long time:
   ln -s /usr/local/lib/python3.10/config-3.10-x86_64-linux-gnu
 /usr/local/lib/python3.10/config-3.10
5. python3 cpython/Tools/freeze.py -o frozen hello.py
6. cd frozen; make; ./hello
   Helo world...

Thanks again,
Chris

--

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



[issue42591] Method Py_FrozenMain missing in libpython3.9

2020-12-10 Thread Christian Bachmaier


Christian Bachmaier  added the comment:

The file containing the source code is Python/frozenmain.c .

--

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



[issue42591] Method Py_FrozenMain missing in libpython3.9

2020-12-10 Thread Christian Bachmaier


Christian Bachmaier  added the comment:

The same under Python 3.9.1 (Package from Debian bullseye/testing). As the 
method Py_FrozenMain is contained in the source code, maybe ist has something 
to do with the build process, a change in makefile? As far as I can see, the 
builder of the distribution packages call the makefile as provided.

Chris

--

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



[issue42591] Method Py_FrozenMain missing in libpython3.9

2020-12-07 Thread Christian Bachmaier


Change by Christian Bachmaier :


--
components: +Library (Lib) -C API

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



[issue42591] Method Py_FrozenMain missing in libpython3.9

2020-12-07 Thread Christian Bachmaier


New submission from Christian Bachmaier :

In Python 3.9.0 and 3.9.1rc1 (Packages from Ubuntu Devel Branch or Fedora) the 
Method
int Py_FrozenMain(int, char**)
is missing in libpython3.9.so

Thus, when trying the provided freeze example via
freeze.py hello.py & make
one gets the linker error
/usr/bin/ld: frozen.o: in function `main': frozen/frozen.c:681: undefined 
reference to `Py_FrozenMain' .

In previous Python 3.8.x the bug does not show.

Thanks,
Chris

--
components: C API
messages: 382651
nosy: chba
priority: normal
severity: normal
status: open
title: Method Py_FrozenMain missing in libpython3.9
versions: Python 3.9

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



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

2014-03-27 Thread Christian Bachmaier

Christian Bachmaier added the comment:

Sorry guys, library loading of a freezed binary is different to interpreter 
mode. This is a bug in freeze, or at least an undocumented missing feature of 
freeze. This is no side discussion.

And, in Python 3.2 this was working! As described above, just creating a subdir 
psycopg2 in the working direktory of the frozen binary containing a link 
_psycopg.so to the library. This is a fact. I have two working production 
systems using this mechanism under Ubuntu 12.04 LTS.

Ok, psycopg2 seems to load the so file indirectly over __init__.py, however, 
the interpreter and older versions of freeze support that. The psycopg2 guys do 
not see any problem in that, see the closed entry linked above in their bug 
database.

A workaround/hack I am using successfully now is to replace any 'import 
psycopg2._psycopg' by 'import _psycopg' in all 
/usr/lib/python3/dist-packages/psycopg2/*.py files and to set 
PYTHONPATH=//usr/lib/python3/dist-packages/psycopg2 prior execution of the 
frozen binary. I found this only by playing around several days, there is NO 
documentation about that. The advices statically linking etc. given here are 
too superficial. Any more helful/concrete advices (outside of this thread) seem 
to cost money.

I wanted and still want help to fix this by giving detailed reports.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16047
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2014-03-25 Thread Christian Bachmaier

Christian Bachmaier added the comment:

Same issue with external libraries under (pachted) Python 3.4.0 final on Ubuntu 
14.04 LTS or Debian Wheezy/Sid.

Meader, is there any option/possibility zu use an external library (like 
psycopg2.psycopg.so)from the freezed binary? I alreday tried to manually add 
various -L -l options to the linker command of the generated make file or 
adjust LD_LIBRARY_PATH and so on ... always without any success. Unfortunately, 
I need this for a large productive system Praktomat. Please help.

Thanks again.

Chris

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16047
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2014-03-25 Thread Christian Bachmaier

Christian Bachmaier added the comment:

I also issued a ticket at the bugtracker of the psycopg2 project:
http://psycopg.lighthouseapp.com/projects/62710/tickets/201

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16047
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com




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

2014-03-25 Thread Christian Bachmaier

Christian Bachmaier added the comment:

Martin: this is clearly a bug, as it is now (Python 3.3 onwards) impossible to 
use an external module (in a .so) from a frozen binary. 
The phrase please help was intended to fix the bug. If there is a new option 
then this would also result in some kind of a bug, since nowhere documented. It 
turns freeze.py unusable in many situations. At least it cannot be done as in 
Python 3.2 (described above) and the many other methods I tried. The mailing 
list can only be a last option, since Meador's patches are nowhere officially 
included and thus not very widespread. Unfortunately, both of your advices only 
work in theory for me. However, I am glad to have found in you a person who 
gives at least some advices.

Meanwhile, the psycopg guys are do (also) not see a bug on their side:
http://psycopg.lighthouseapp.com/projects/62710/tickets/201

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16047
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2014-03-25 Thread Christian Bachmaier

Christian Bachmaier added the comment:

# ldd hello
linux-vdso.so.1 =  (0x7fffd677e000)
libpython3.4m.so.1.0 = /usr/lib/x86_64-linux-gnu/libpython3.4m.so.1.0 
(0x7f968c6c2000)
libpthread.so.0 = /lib/x86_64-linux-gnu/libpthread.so.0 
(0x7f968c4a4000)
libc.so.6 = /lib/x86_64-linux-gnu/libc.so.6 (0x7f968c0dd000)
libexpat.so.1 = /lib/x86_64-linux-gnu/libexpat.so.1 
(0x7f968beb3000)
libz.so.1 = /lib/x86_64-linux-gnu/libz.so.1 (0x7f968bc9a000)
libdl.so.2 = /lib/x86_64-linux-gnu/libdl.so.2 (0x7f968ba95000)
libutil.so.1 = /lib/x86_64-linux-gnu/libutil.so.1 (0x7f968b892000)
libm.so.6 = /lib/x86_64-linux-gnu/libm.so.6 (0x7f968b58c000)
/lib64/ld-linux-x86-64.so.2 (0x7f968ccfb000)

and (even strace) does not show an attempt to acces the so-file. Also tried to 
add

-L/usr/lib/python3/dist-packages/psycopg2 
-l_psycopg.cpython-34m-x86_64-linux-gnu.so

and similar without success.

Can anyone try to reproduce it, a freeze (with patches) of hello.py containing 
only

import _psycopg2

or maybe another external library? In the first case apt-get install 
python3-psycopg2 is necessary.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16047
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2014-03-25 Thread Christian Bachmaier

Christian Bachmaier added the comment:

The shared library is not linked into the resulting binary
by simply having an import in the Python file.

Yes. This is why (at least in Python 3.2) it must be in the right path 
(subdirectory), see above.

 freeze does
 support adding the external library statically, but it's not
 easy.

Unfortunately, Debian/Ubuntu does not deliver a static version of psycopg2. So 
I'd like to use the dynamic version. This is definitively possible with Python 
3.2 x86, again, see above.

 The question I raised was whether running hello will
 fail to import the shared library _pyscopg2*.so or not.

That's a good question. I think so, but how can I test that? At least the 
(only) way in Python 3.2 does not work any more. Even with Python 3.2 there 
must be a link in the subdirectory as shown above. It is not enough to have it 
only in the usual installation directory 
/usr/lib/python3/dist-packages/psycopg2/_psycopg.xxx.so
Even any set LD_LIBRARY_PATH is ignored, like also putting it in /usr/lib as 
far as I can see.

 This ticket is about getting freeze working again for
 Python 3.x

Right. So we should test the library feature which worked somehow magically in 
Python 3.2. Then we will see if it is a bug. My statement is that it is a bug.

Thanks again to all.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16047
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2014-03-25 Thread Christian Bachmaier

Christian Bachmaier added the comment:

Sorry I forgot: PyRun seems only support Python 2.x.

The only other freeze tool I know for Pyhton3 code is cx_freeze. I would 
prefere the vanilla freeze of the python distribution itself and as far as I 
can see using cx_freeze makes more problems for me as it may solve. But that is 
not a discussion for this thread or forum.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16047
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2014-03-25 Thread Christian Bachmaier

Christian Bachmaier added the comment:

 To test what I asked for, please run freeze on this script:
 
 
 import _psycopg2
 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.

 If it prints 'Works.', then your problem is unrelated to this
 ticket.

Nop, prints the error message instead of 'Works.'

 If it fails with an import error or some other error
 related to loading the shared lib, then it may be a problem
 with freeze and is likely related to the new import lib
 machinery.

= we have a bug if Marc-Andre is right. Thanks.

Chris

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16047
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2014-03-25 Thread Christian Bachmaier

Christian Bachmaier added the comment:

$ cat hello.py
import _psycopg
print('Works.')
$ export PYTHONVERBOSE=2
$ ./hello 2 res.txt
$ cat res.txt | grep psycopg   
# trying /export/scratch/chris/pgtest/_psycopg.cpython-34m-x86_64-linux-gnu.so
# trying /export/scratch/chris/pgtest/_psycopg.cpython-34m.so
# trying /export/scratch/chris/pgtest/_psycopg.abi3.so
# trying /export/scratch/chris/pgtest/_psycopg.so
# trying /export/scratch/chris/pgtest/_psycopg.py
# trying /export/scratch/chris/pgtest/_psycopg.pyc
# trying /usr/lib/python3.4/_psycopg.cpython-34m-x86_64-linux-gnu.so
# trying /usr/lib/python3.4/_psycopg.cpython-34m.so
# trying /usr/lib/python3.4/_psycopg.abi3.so
# trying /usr/lib/python3.4/_psycopg.so
# trying /usr/lib/python3.4/_psycopg.py
# trying /usr/lib/python3.4/_psycopg.pyc
# trying 
/usr/lib/python3.4/plat-x86_64-linux-gnu/_psycopg.cpython-34m-x86_64-linux-gnu.so
# trying /usr/lib/python3.4/plat-x86_64-linux-gnu/_psycopg.cpython-34m.so
# trying /usr/lib/python3.4/plat-x86_64-linux-gnu/_psycopg.abi3.so
# trying /usr/lib/python3.4/plat-x86_64-linux-gnu/_psycopg.so
# trying /usr/lib/python3.4/plat-x86_64-linux-gnu/_psycopg.py
# trying /usr/lib/python3.4/plat-x86_64-linux-gnu/_psycopg.pyc
# trying /usr/lib/python3.4/lib-dynload/_psycopg.cpython-34m-x86_64-linux-gnu.so
# trying /usr/lib/python3.4/lib-dynload/_psycopg.cpython-34m.so
# trying /usr/lib/python3.4/lib-dynload/_psycopg.abi3.so
# trying /usr/lib/python3.4/lib-dynload/_psycopg.so
# trying /usr/lib/python3.4/lib-dynload/_psycopg.py
# trying /usr/lib/python3.4/lib-dynload/_psycopg.pyc
# trying 
/usr/local/lib/python3.4/dist-packages/_psycopg.cpython-34m-x86_64-linux-gnu.so
# trying /usr/local/lib/python3.4/dist-packages/_psycopg.cpython-34m.so
# trying /usr/local/lib/python3.4/dist-packages/_psycopg.abi3.so
# trying /usr/local/lib/python3.4/dist-packages/_psycopg.so
# trying /usr/local/lib/python3.4/dist-packages/_psycopg.py
# trying /usr/local/lib/python3.4/dist-packages/_psycopg.pyc
# trying /usr/lib/python3/dist-packages/_psycopg.cpython-34m-x86_64-linux-gnu.so
# trying /usr/lib/python3/dist-packages/_psycopg.cpython-34m.so
# trying /usr/lib/python3/dist-packages/_psycopg.abi3.so
# trying /usr/lib/python3/dist-packages/_psycopg.so
# trying /usr/lib/python3/dist-packages/_psycopg.py
# trying /usr/lib/python3/dist-packages/_psycopg.pyc
import _psycopg
ImportError: No module named '_psycopg'



$ cat hello.py
import _psycopg
print('Works.')
$ export PYTHONPATH=/usr/lib/python3/dist-packages/psycopg2:$PYTHONPATH
$ ./hello
Works.



The correct import (see the doc of psycopg2) is import psycopg2. Otherwise a 
valid script does even not run in interpreted mode. The library lies in 
/usr/lib/python3/dist-packages/psycopg2/_psycopg.cpython...so Maybe there is 
the Problem. One has to Import the parent dir of the so-file, which Triggers 
the bug.

$ cat hello.py
import psycopg2
print('Works.')
$ export PYTHONVERBOSE=2
$ ./hello 2 res.txt
$ cat res.txt | grep psycopg   
import psycopg2
  File /usr/lib/python3/dist-packages/psycopg2/__init__.py, line 67, in 
module
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: No module named 'psycopg2._psycopg'
# destroy psycopg2


Marc-Andre: would you mind to install python3-psycopg2 to see that in real?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16047
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2014-03-21 Thread Christian Bachmaier

Christian Bachmaier added the comment:

Thanks for the patches. After applying issue11824-0.patch and then 
isse16047-1.patch I am successfully able to freeze a hello world python script 
under ubuntu 14.04 with python 3.4 rc3. I have attached my new site.py file, 
since the automatical patch application did not run through.

However, in my productive project I need the psycopg2 library for database 
access. Whenever using 'import psycopg2' in my code the binary shows a runtime 
error that it cannot find the module psycopg2._psycopg. A one line script 
suffices for reproduction. Executing the script without freezing it works like 
a charm. In Python 3.2 it helped to create  in the working dir a psycopg2 
subdir with a symlink  _psycopg.so - 
/usr/lib/python3/dist-packages/psycopg2/_psycopg.cpython-32mu.so . This seems 
no longer help. Is this a bug/feature of freeze or psycopg2? Thanks for your 
interest and help.

--
nosy: +chba
Added file: http://bugs.python.org/file34547/site.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16047
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com