Page 283 -
P. 283

web development
                                                        Note: If you are on a Unix-based system, don’t forget
                                                        to add “chmod +x generate_timing_data.py” to
                        Test Drive                      set the executable bit.




                       Your web server should still be running from earlier. If it isn’t, start it again. In your web browser,
                       return to the coach’s home page, then select the hyperlink to display the list of athletes, select Sarah,
                       and then press the button.




               This all
               looks OK.




              Ah, phooey!
              Something’s not
              quite right here.
              Where’s Sarah’s
             top three times?

                      File  Edit   Window  Help   HoustonWeHaveAProblem
                      $ python3 simple_httpd.py
                      Starting simple_httpd on port: 8080
          Does the    localhost - - [12/Sep/2010 14:30:03] "GET / HTTP/1.1" 200 -
                      localhost - - [12/Sep/2010 14:30:03] "GET /coach.css HTTP/1.1" 200 -
          web server’s   localhost - - [12/Sep/2010 14:30:03] "GET /images/coach-head.jpg HTTP/1.1" 200 -
          logging     localhost - - [12/Sep/2010 14:30:03] "GET /favicon.ico HTTP/1.1" 200 -
          information   localhost - - [12/Sep/2010 14:45:16] "GET /cgi-bin/generate_list.py HTTP/1.1" 200 -
                      localhost - - [12/Sep/2010 16:12:27] “GET /cgi-bin/generate_list.py HTTP/1.1” 200 -
          tell you    localhost - - [12/Sep/2010 16:12:29] “POST /cgi-bin/generate_timing_data.py HTTP/1.1” 200 -
          anything?   Traceback (most recent call last):
                        File “/Users/barryp/HeadFirstPython/chapter7/cgi-bin/generate_timing_data.py”, line 21, in <module>
                          print(yate.u_list(athletes[athlete_name].top3()))
                      TypeError: ‘list’ object is not callable
                      localhost - - [12/Sep/2010 16:12:29] CGI script exit status 0x100




          Your CGI has suffered from a TypeError exception, but other than looking at the web
           server’s logging screen, it’s not clear on the web browser screen that anything has gone wrong.






                                           What do you think is the problem here? Take a moment
                                           to study the error message before flipping the page.

                                                                                      you are here 4    247
   278   279   280   281   282   283   284   285   286   287   288