Jump to content

[SOLVED] Python Error


Recommended Posts

Please help, I don't understand what this error message means:

----------------------------------------
Exception happened during processing of request from ('97.88.237.86', 49926)
Traceback (most recent call last):
  File "C:\Python30\lib\socketserver.py", line 281, in _handle_request_noblock
    self.process_request(request, client_address)
  File "C:\Python30\lib\socketserver.py", line 307, in process_request
    self.finish_request(request, client_address)
  File "C:\Python30\lib\socketserver.py", line 320, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Python30\lib\socketserver.py", line 614, in __init__
    self.handle()
  File "C:\Python30\lib\http\server.py", line 363, in handle
    self.handle_one_request()
  File "C:\Python30\lib\http\server.py", line 357, in handle_one_request
    method()
  File "C:\Users\Administrator\Desktop\webserver\webserver.py", line 33, in do_GET
    self.wfile.write(f.read())
  File "C:\Python30\lib\socket.py", line 219, in write
    return self._sock.send(b)
TypeError: send() argument 1 must be bytes or buffer, not str
----------------------------------------

 

Here is what the code is:

f = open(root + self.path)
self.send_response(200)
self.send_header('Content-Type', 'text/html')
self.end_headers()
self.wfile.write(f.read())
f.close()

 

All I know is that there is an error with "self.wfile.write(f.read())" I don't know what though, I do know that it worked before. I was using python version 2.5, then I switched to 3.0, and I do know that it has worked before.

 

So, does anyone know what the problem is?

Link to comment
https://forums.phpfreaks.com/topic/148047-solved-python-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.