Jump to content


Photo

Chapter 7


  • Please log in to reply
6 replies to this topic

#1 Bille_36882

Bille_36882

    New Member

  • Members
  • Pip
  • 2 posts

Posted 27 March 2014 - 02:50 PM

I am running Fedora 20
I have been trying to get this to work for a while now. i have all the files downloaded and extrated and everything simple_httpd.py starts up fine the main web page displays fine but when i click on the timing data link a window pops up asking me how i want to open generate_list.py and i get this message in the command prompt

Traceback (most recent call last):
File "/usr/lib64/python3.3/http/server.py", line 1128, in run_cgi
os.execve(scriptfile, args, env)
FileNotFoundError: [Errno 2] No such file or directory: '/home/bille/HeadFirstPython/Chapter7/webapp/cgi-bin/generate_list.py'

I have made sure that the file is executable and i have made sure the file was at that location just in case i oopsed. i even tried running simple_httpd.py from out of cgi-bin and i could not find the file either. could i please get some help

#2 Charly2001

Charly2001

    Active Member

  • Members
  • PipPip
  • 12 posts
  • Gender:Male
  • Location:Québec, Canada
  • Interests:Linux; Ubuntu 12.04

    anything Python

Posted 29 March 2014 - 01:09 PM

I'm going to try an hypothesis: I bet the path to your executable python3 file is wrong

In my distribution of Ubuntu this executable is in folder /usr/bin . So the top of my generate_list.py would be #! /usr/bin/python3
Not /usr/lib64/python3

I hope that i guessed right and that you are successfull

Chao


#3 Bille_36882

Bille_36882

    New Member

  • Members
  • Pip
  • 2 posts

Posted 29 March 2014 - 07:52 PM

This is my code for generate_list.py

#! /usr/local/bin/python3

import glob

import athletemodel
import yate

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_timing_data.py"))
print(yate.para("Select an athlete from the list to work with:"))
for each_athlete in athletes:
print(yate.radio_button("which_athlete", athletes[each_athlete].name))
print(yate.end_form("Select"))
print(yate.include_footer({"Home": "/index.html"}))

#4 Charly2001

Charly2001

    Active Member

  • Members
  • PipPip
  • 12 posts
  • Gender:Male
  • Location:Québec, Canada
  • Interests:Linux; Ubuntu 12.04

    anything Python

Posted 05 April 2014 - 01:17 PM

Bille,

third line from the bottom (after
for each_athlete in athletes: )

There is an indentation missing: it should be:

for each_athlete in athletes:
print(yate.radio_button("which_athlete", athletes[each_athlete].name))

#5 Charly2001

Charly2001

    Active Member

  • Members
  • PipPip
  • 12 posts
  • Gender:Male
  • Location:Québec, Canada
  • Interests:Linux; Ubuntu 12.04

    anything Python

Posted 05 April 2014 - 01:19 PM

Bille,

third line from the bottom (after
for each_athlete in athletes: )

There is an indentation missing: it should be:

for each_athlete in athletes:
print(yate.radio_button("which_athlete", athletes[each_athlete].name))


I tried it and it works.

Cheers
Charly


#6 Charly2001

Charly2001

    Active Member

  • Members
  • PipPip
  • 12 posts
  • Gender:Male
  • Location:Québec, Canada
  • Interests:Linux; Ubuntu 12.04

    anything Python

Posted 05 April 2014 - 01:22 PM

SORRY i'm having trouble with this editor:

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


Charly


#7 pschalkx

pschalkx

    New Member

  • Members
  • Pip
  • 1 posts

Posted 14 June 2014 - 01:15 PM

Hi Charly2001,

I also run Ubuntu and got a blank page when invoking the scripts. Per your advice I changed it to /usr/bin/python3 and it worked like a charm!

Thanks.

Philip




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users