Jump to content


Photo

Chapter7 Page239


  • Please log in to reply
3 replies to this topic

#1 foxet

foxet

    New Member

  • Members
  • Pip
  • 2 posts

Posted 18 August 2013 - 10:48 PM

127.0.0.1 - - [19/Aug/2013 14:46:48] "GET /cgi-bin/generate_list.py HTTP/1.1" 200 -
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/http/server.py", line 1128, in run_cgi
os.execve(scriptfile, args, env)
PermissionError: [Errno 13] Permission denied: '/Users/foxet/Downloads/webapp/cgi-bin/generate_list.py'
127.0.0.1 - - [19/Aug/2013 14:46:48] CGI script exit status 0x7f00


Could anyone please tell me why the generate_list.py fail?

#2 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 21 August 2013 - 08:41 AM

Please provide the code that you are trying to run (so that we can see if there is a problem with it). Also, tell us which platform you are running on. Mac? Windows? Linux?

--Paul.

#3 foxet

foxet

    New Member

  • Members
  • Pip
  • 2 posts

Posted 21 August 2013 - 05:41 PM

Please provide the code that you are trying to run (so that we can see if there is a problem with it). Also, tell us which platform you are running on. Mac? Windows? Linux?

--Paul.


The code is running on MAC....

! /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3
import athletemodel
import yate
import glob
data_files=glob.glob("../data/*.txt")
athletes=athletemodel.put_to_store(data_files)
print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_form("generate_timeing_data.py"))
print(yate.para("Select an athlete"))

for ea in athletes:
print(yate.radio_button("which_athlete",athletes[ea].name))
print(yate.end_form("Select"))
print(yate.include_footer({"Home": "../index.html"}))



THANKYOU

#4 paulbarry

paulbarry

    Advanced Member

  • O'Reilly Author
  • PipPipPipPipPipPipPipPip
  • 307 posts

Posted 23 August 2013 - 02:31 AM

Your code looks OK, so try this.

In a terminal window, issue this command:

sudo chmod +x /Users/foxet/Downloads/webapp/cgi-bin/generate_list.py

This switches on the "executable bit" on Mac OS X (see the top of page 239 in the book). Without this step, you'll get a permissions error when Python tries to run your generate_list.py code. You need to do this only once.

Hope this helps.

--Paul.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users