[ python-Bugs-1525343 ] Webserver TypeError: expected read buffer, NoneType found

SourceForge.net noreply at sourceforge.net
Thu Aug 3 00:04:12 CEST 2006


Bugs item #1525343, was opened at 2006-07-19 10:53
Message generated for change (Comment added) made by jimjjewett
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1525343&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: jbet (jbeisert)
Assigned to: Nobody/Anonymous (nobody)
Summary: Webserver TypeError: expected read buffer, NoneType found

Initial Comment:
When I'm using the python webserver I got the 
following message for every access by my client. 
Soryy, I have no experience in Python, so I cannot 
help. This is only a report. 
  
HTTPdaemon_v1.0.0 listening on port 8001 
---------------------------------------- 
Exception happened during processing of request from 
('192.168.1.9', 33917) 
Traceback (most recent call last): 
  File "/home/jb/bin/lib/python2.5/SocketServer.py", 
line 463, in  
process_request_thread 
    self.finish_request(request, client_address) 
  File "/home/jb/bin/lib/python2.5/SocketServer.py", 
line 254, in  
finish_request 
    self.RequestHandlerClass(request, client_address, 
self) 
  File "/home/jb/bin/lib/python2.5/SocketServer.py", 
line 521, in __init__ 
    self.handle() 
  File 
"/home/jb/bin/lib/python2.5/BaseHTTPServer.py", line 
316, in handle 
    self.handle_one_request() 
  File 
"/home/jb/bin/lib/python2.5/BaseHTTPServer.py", line 
310, in  
handle_one_request 
    method() 
  File 
"./src/Myghty-1.0/lib/myghty/http/HTTPServerHandler.py", 
line 53, in  
do_GET 
    self.handle_request() 
  File 
"./src/Myghty-1.0/lib/myghty/http/HTTPServerHandler.py", 
line 56, in  
handle_request 
    httpreq = HSHTTPRequest(self) 
  File 
"./src/Myghty-1.0/lib/myghty/http/HTTPServerHandler.py", 
line 254, in  
__init__ 
    keep_blank_values = True 
  File "/home/jb/bin/lib/python2.5/cgi.py", line 462, 
in __init__ 
    fp = StringIO(qs) 
TypeError: expected read buffer, NoneType found 
---------------------------------------- 
---------------------------------------- 
Exception happened during processing of request from 
('192.168.1.9', 33918) 
Traceback (most recent call last): 
  File "/home/jb/bin/lib/python2.5/SocketServer.py", 
line 463, in  
process_request_thread 
    self.finish_request(request, client_address) 
  File "/home/jb/bin/lib/python2.5/SocketServer.py", 
line 254, in  
finish_request 
    self.RequestHandlerClass(request, client_address, 
self) 
  File "/home/jb/bin/lib/python2.5/SocketServer.py", 
line 521, in __init__ 
    self.handle() 
  File 
"/home/jb/bin/lib/python2.5/BaseHTTPServer.py", line 
316, in handle 
    self.handle_one_request() 
  File 
"/home/jb/bin/lib/python2.5/BaseHTTPServer.py", line 
310, in  
handle_one_request 
    method() 
  File 
"./src/Myghty-1.0/lib/myghty/http/HTTPServerHandler.py", 
line 53, in  
do_GET 
    self.handle_request() 
  File 
"./src/Myghty-1.0/lib/myghty/http/HTTPServerHandler.py", 
line 56, in  
handle_request 
    httpreq = HSHTTPRequest(self) 
  File 
"./src/Myghty-1.0/lib/myghty/http/HTTPServerHandler.py", 
line 254, in  
__init__ 
    keep_blank_values = True 
  File "/home/jb/bin/lib/python2.5/cgi.py", line 462, 
in __init__ 
    fp = StringIO(qs) 
TypeError: expected read buffer, NoneType found 
---------------------------------------- 

----------------------------------------------------------------------

Comment By: Jim Jewett (jimjjewett)
Date: 2006-08-02 18:04

Message:
Logged In: YES 
user_id=764593

I suspect that changing 

>>> fp = StringIO(qs)

to 

>>> fp = StringIO(qs or "")

would fix the problem.

If so, this is arguably a bug in myghty.  qs was already 
set to "" unless sys.argv[1] or environ['QUERY_STRING']had 
a value.  Neither of these should ever be None.  (They 
should be either a string, or not found.)


----------------------------------------------------------------------

Comment By: Chad Whitacre (whit537)
Date: 2006-08-01 15:04

Message:
Logged In: YES 
user_id=340931

Thanks for the report. Can I ask how you came to use the
as-yet-unreleased Python 2.5 if you have no experience with
Python? It looks like you are having this problem with
Myghty. Does that require Python 2.5? 

FWIW, this looks to me like a problem with Myghty's use of
the cgi module, not a problem with Python itself.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1525343&group_id=5470


More information about the Python-bugs-list mailing list