Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.