xmlrpclib/timeoutsocket not happy together in 2.3

Larry wrbt at email.com
Tue Sep 16 15:30:15 EDT 2003


I've had a production system running for a long time that uses
xmlrpclib with timeoutsocket, and with my recent upgrade to 2.3 it's
no longer able to use xmlrpclib with the xmlrpc servers I communicate
with. I can call remote procedures still, but as soon as I import
timeoutsocket and the old socket switcharoo is done it's over.

To add to the fun I can use xmlrpc w/timeoutsocket if calling
functions at the ubiquitous betty.userland.com example, but not the
servers I've been talking to for the last two years. Example:

Python 2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import xmlrpclib
>>> s=xmlrpclib.Server('http://myrpcserver/server')
>>> s.version()
22
>>> s.localTime()
'9/16/2003 12:16:38 PM'
>>> import timeoutsocket  
>>> s.version()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python23\lib\xmlrpclib.py", line 1029, in __call__
    return self.__send(self.__name, args)
  File "C:\Python23\lib\xmlrpclib.py", line 1316, in __request
    verbose=self.__verbose
  File "C:\Python23\lib\xmlrpclib.py", line 1080, in request
    return self._parse_response(h.getfile(), sock)
  File "C:\Python23\lib\xmlrpclib.py", line 1217, in _parse_response
    p.close()
  File "C:\Python23\lib\xmlrpclib.py", line 531, in close
    self._parser.Parse("", 1) # end of data
xml.parsers.expat.ExpatError: no element found: line 1, column 0
>>> s.localTime()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python23\lib\xmlrpclib.py", line 1029, in __call__
    return self.__send(self.__name, args)
  File "C:\Python23\lib\xmlrpclib.py", line 1316, in __request
    verbose=self.__verbose
  File "C:\Python23\lib\xmlrpclib.py", line 1080, in request
    return self._parse_response(h.getfile(), sock)
  File "C:\Python23\lib\xmlrpclib.py", line 1217, in _parse_response
    p.close()
  File "C:\Python23\lib\xmlrpclib.py", line 531, in close
    self._parser.Parse("", 1) # end of data
xml.parsers.expat.ExpatError: no element found: line 1, column 0
>>> s=xmlrpclib.Server('http://betty.userland.com')
>>> s.examples.getStateName(41)
'South Dakota'

Obviously the bad element here is the remote servers I communicate
with since userland works, but this just started with 2.3 and I'm
curious if anyone else has had a similar problem before I start
digging into this.

Thanks.

- Larry




More information about the Python-list mailing list