Graham Dumpleton
grahamd at dscpl.com.au
Tue Aug 16 06:45:32 EDT 2005
On 16/08/2005, at 8:23 PM, Manjeet Chaudhary wrote: > command = "export > CLASSPATH=/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/lucene > -1.4.3.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/PDFBox > -0.6.7a.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/log4j > -1.2.8.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/tm-extractors > -0.4.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/ArabicAnalyzer > -1.0b.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/commons- > collections-3.1.jar" > import os > os.system(command) > command = "java -classpath > $CLASSPATH:/home/ajinkyan/cgi-bin/infoviewer SearchFiles" > check=os.system(command) That will not work. The shell invoked by each call of os.system() is independent. Exporting environment variables in one os.system() call does not make them visible in a subsequence os.system() call. Try the following instead: command = "CLASSPATH=/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/lucene -1.4.3.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/PDFBox -0.6.7a.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/log4j -1.2.8.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/tm-extractors -0.4.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/ArabicAnalyzer -1.0b.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/commons- collections-3.1.jar java -classpath $CLASSPATH:/home/ajinkyan/cgi-bin/infoviewer SearchFiles" check=os.system(command) Or better still: os.putenv("CLASSPATH","/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/ lucene-1.4.3.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/PDFBox -0.6.7a.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/log4j -1.2.8.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/tm-extractors -0.4.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/ArabicAnalyzer -1.0b.jar:/home/ajinkyan/cgi-bin/infoviewer/Jar_Files/commons- collections-3.1.jar") command = "java -classpath $CLASSPATH:/home/ajinkyan/cgi-bin/infoviewer SearchFiles" check=os.system(command) Note that the current working directory of the process when os.system() is run is probably "/" and the PATH will not necessarily be useful. You may therefore have to give the explicit path to the "java" program. Graham
|