Jump to content


Photo

Chapter7 Error Running Simple_Httpd.py


  • Please log in to reply
3 replies to this topic

#1 djpython

djpython

    Active Member

  • Members
  • PipPip
  • 14 posts

Posted 20 May 2013 - 08:07 PM

HERE IS MY SERVER CODE:


from http.server import HTTPServer, CGIHTTPRequestHandler

port = 8080

httpd = HTTPServer(('', port), CGIHTTPRequestHandler)
print("Starting simple_httpd on port: " + str(httpd.server_port))
httpd.serve_forever()


HERE IS MY ERROR MESSAGE:

bash-3.2# simple_httpd.py
from: can't read /var/mail/http.server
Error: Unrecognized action "port ="
/usr/local/webapp/simple_httpd.py: line 6: syntax error near unexpected token `('
/usr/local/webapp/simple_httpd.py: line 6: `httpd = HTTPServer(('', port), CGIHTTPRequestHandler)'


I would really appreciate some help.

#2 djpython

djpython

    Active Member

  • Members
  • PipPip
  • 14 posts

Posted 20 May 2013 - 08:10 PM

Sorry. I have been going around in circles on this so long I missed an easy mistake. Let me make the first line read "python3 simple_httpd.py" and I'll get right back with the results. Thanks

#3 djpython

djpython

    Active Member

  • Members
  • PipPip
  • 14 posts

Posted 20 May 2013 - 08:39 PM

THIS IS MY ERROR MESSAGE WITH THE AMENDED CALL TO THE simple_httpd.py:

Error response

Error code: 404

Message: No such CGI script ('/cgi-bin/generate_list.py').

Error code explanation: 404 - Nothing matches the given URI.


BUT, unlike the error for generate_timing_data.py in the book, I have a generate_list.py (functions well when run in isolation) in the cgi-bin folder in 'webapp' folder.

I need a break. But it would be nice to get this working before I take it.

Thank You All, I am very much enjoying learning from Head First Python.

#4 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 30 May 2013 - 11:57 PM

Can you please post the code you are running (all of it) as well as a screenshot of the error message you are seeing.

Thanks.

--Paul.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users