Something works in Python but not in cgi.

A

atalucas

Hi,
I need to make work a programm on the Web. I make tests like Hello
World and also with GET and it works good. The problem comes in the
line gas = importPhase("gri30.cti") The computer don´t find the file
"gri30.cti"(this file was not in workspace), then I put it in the same
folder and the program crash.

Knows someone where is the problem???


#!D:\Python25\python.exe
print "Content-Type: text/html\n"
import cgitb; cgitb.enable()
import cgi
from workplace import *

gas = importPhase("gri30.cti")

print "<HTML><HEAD><TITLE>Cantera</TITLE></HEAD><BODY>"

print '<INPUT type="submit" value="Absenden" name="Send">'
print '</FORM>'
print "</BODY></HTML>"
 
M

Miki Tebeka

The working directory of the webserver is probably not the one of the script. You should specify full path to the file. One way to do it is:

from os.path import dirname, join
filename = join(dirname(__file__), 'gri30.cti')

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top