help regarding python CGI programming

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • python1
    New Member
    • Feb 2008
    • 3

    help regarding python CGI programming

    Hi,
    I am new to python CGI programming & am stuck with some issues. I would really appreciate if you could help me out.
    Problem: I have made a web page using Python CGI scripts; from one of the menu items on the web page, I am trying to call another python cgi script which opens a pdf file. Following is the code:

    In index.py :

    Code:
    #!C:\Python25\python.exe
    import cgi
    import cgitb; cgitb.enable()
    print "Content-type: text/html\n"
    print '''<html><head> <title>My page</title>
      <link rel="stylesheet" href="C:\Program Files\Apache Software Foundation\Apache2.2\cgi-bin\mystyle.css"/></head>
    <body><ul class="glossymenu"><li class="current">
            <a href="resume.py"><b>Resume(.pdf 25kb)</b></a></li></ul></body></html>
    '''
    In resume.py:

    Code:
    #!C:\Python25\python.exe
    import cgi,os
    import cgitb
    cgitb.enable()
    print "Content-type: text/html\n"
    os.system('c:\resume.pdf')
    When I execute http://localhost/cgi-bin/index.py the web page is displayed with 'resume' as the menu item.
    When i click on menu 'resume' the script resume.py is executed but the pdf file is not opening. 'Done' is reflected on the bottom left corner of the browser & a white page is displayed.
    I also noticed that when I click the 'resume' menu item at the same time a 'AcroRd32.exe' process starts in the system processes but no pdf file is displayed nor any error is thrown.
    Further when I execute the script resume.py from the command line the pdf file opens up but not from browser.

    Could you please throw some light on the issue?

    Thanks & Regards
    Last edited by python1; Feb 8 '08, 08:16 AM. Reason: code syntax error
Working...