Problems with enabling thread support in Python 2.1.x
Christopher Gardner
christopher_gardner at cuc.claremont.edu
Wed Feb 20 12:24:52 EST 2002
I can't get threads from becoming non-responsive in the version
of python (2.1.2) that I am building on H-P U/X (hpux) 10.20.
Someone mentioned that it appeared that threads isn't enabled
in my version of python running on my box. I grabbed the tar'ed
source and compiled it.
I have installed Python 2.1, PyWebLib 1.1.0+, python-ldap 2.0.0pre4
against my build of OpenLDAP 2.0.18 on H-P U/X (hpux) 10.20 on a
E35 (e.g., 735) H-P based workstation. I get the following error
when trying to start web2ldap in stand-alone mode with the HPPD
Software Porting & Archive <http://hpux.connect.org.uk> version:
--
# python /opt/web2ldap/sbin/web2ldap.py
Traceback (most recent call last):
File "/opt/web2ldap/sbin/web2ldap.py", line 28, in ?
import w2lapp.core,w2lapp.handler,msHTTPServer,msHTTPHandler,ipadr
File "/opt/web2ldap/pylib/w2lapp/core.py", line 77, in ?
crossCheckVars = w2lapp.cnf.misc.session_checkvars,
File "/opt/python/lib/python2.1/site-packages/pyweblib/session.py",
line 122, in __init__
self._session_lock = threading.Lock()
NameError: global name 'threading' is not defined
I used Gnu C (gcc) 2.95.2, binutils 2.9.1, Gnu make 3.78.1, Gnu sed
3.02 to build the python 2.1.2 source against the DB 3.2.9, Pth 1.4
gdbm 1.8, ncurses 5.2, readline x.x and tcp-wrappers 7.6 with the
"-D_REENTRANT" and "-D_XOPEN_SOURCE_EXTENDED" options (OPT) during
building and the libs (-l)pthread and (-l)pth libs flagged.
I seem to be able to compile Python 2.1.2 with POSIX threads
support. The problem is now that web2ldap starts up in stand-alone
mode -- I'm not able to connect to it. When I run 'make test' from
the untar'ed source, I get this:
[..]
test_asynchat
Connected
**********************************************************************
Then ...
We expected (repr): "Received: 'hello world'\n"
But instead we got: "error: uncaptured python exception, closing
channel <echo_client connected at 4023fa04> (socket.error:(239,
'Connection refused')
[./python/src/Lib/asynchat.py|handle_read|82]
[./python/src/Lib/asyncore.py|recv|352])"
[..]
When ./Lib/test/test_asynchat.py & ./Lib/test/test_socketserver.py
are run seperated, I get the following:
--
./python ../Lib/test/test_asynchat.py
Traceback (most recent call last):
File "../Lib/test/test_asynchat.py", line 4, in ?
import asyncore, asynchat, socket, threading, time
File "../../src/Lib/asyncore.py", line 511, in ?
import FCNTL
ImportError: No module named FCNTL
--
./python ../Lib/test/test_socketserver.py
ADDR = ('localhost', 15251)
CLASS = SocketServer.TCPServer
server created
server running
test client 0
Traceback (most recent call last):
File "../Lib/test/test_socketserver.py", line 162, in ?
main()
File "../Lib/test/test_socketserver.py", line 158, in main
testall()
File "../Lib/test/test_socketserver.py", line 148, in testall
testloop(socket.AF_INET, tcpservers, MyStreamHandler, teststream)
File "../Lib/test/test_socketserver.py", line 124, in testloop
testfunc(proto, addr)
File "../Lib/test/test_socketserver.py", line 63, in teststream
s.connect(addr)
socket.error: (239, 'Connection refused')
thread: creating server
thread: serving three times
However, when I start web2ldap, I get this:
--
./src/python /opt/web2ldap/sbin/web2ldap.py
Accepted IP address ranges: 0.0.0.0/0.0.0.0
Running mode: multi-threaded
SSL: disabled
Point your favourite browser to
<http://127.0.0.1:1760/web2ldap>
to access the web application.
... I am running tcp-wrappers 7.6 on my box. Could that cause a
problem as well?
More information about the Python-list
mailing list