Hi, Is it possible to pass data from an html command to a python script as an argument, to create a chart from the provided data? My best try so far could be the following lines, which as you probably guessed, don't work:
[CODE] #!c:/Python24/python.exe -u import sys, os, cgi, urllib import cgitb; cgitb.enable() query = cgi.FieldStorage() TheData={'a':'ScatterPlot','x1': range(10),'y1': range(10),'l1':'First Legend','x2': range(5),'y2': range(5,0,-1),'l2':'Second Legend','t':'Some title','h':'Some X label','v':'Some Y label'} print "Content-type: text/html\n" print """ <html> <head></head> <body> <p><IMG SRC="./path2Script/myscript.py %(TheData)s"></p> </body> </html> """ %{"TheData":urllib.quote(str(TheData))} [/CODE] the error reported in the web server (modified for simplicity) is: [ERROR] [Sun Aug 10 21:38:01 2008] [error] [client 127.0.0.1] (20024)The given path is misformatted or contained invalid characters: Cannot map GET /path2Script/myscript.py%20OutputOf(urllib.quote(str(TheData))) HTTP/1.1 to file, referer: http://localhost/path2referer [/ERROR] I assume that the problem is that myscript.py is not found due to the added %20 in /myscript.py%20OutputOf(urllib.quote(str(TheData))) Any ideas of how I can pass the arguments to the python script? for reference, I am running windows XP with an apache server. Thanks. _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com