os.popen results differ when run in browser and DOS level 
Author Message
 os.popen results differ when run in browser and DOS level

This sample program illustrates my dilema.

I am trying to execute a command ( could be
any command ) within python and capture the
output.  It works fine when I run it at command
level, however when I invoke the script in the
browser the code does not return any values from
the os.popen(...)readlines.  I tried try: and
except: but nothing is trapped.

Any ideas?

------

"""
 test.py :
 returns correct results at command level (great)
 returns nothing through Browser !!!
"""
import os

print 'Content-Type: text/html\n\n',
for line in os.popen( 'cd','r' ).readlines():
        print '<P>...within for loop \n\n'
        cd = line

print '<P>cd = ', cd, '\n\n'

#end of test.py

Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.



Tue, 05 Mar 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. os.popen results differ run by browser vs DOS prompt

2. os.popen results diff when executed in browser vs DOS

3. Running into problems with os.popen

4. vcs results differ from nc-verilog

5. os.popen() vs os.system()

6. Using os.system and os.popen from pythonwin under Windows NT

7. os.system/os.popen ultrasparc

8. Blocking ctrl-c to os.popen() or os.system()

9. running rexx under DOS under OS/2 - possible?

10. Question on running a DOS program from OS/2 REXX script

11. Running DOS Turbo Assembler 3.0 under OS/2.

12. Running Alsys Ada 386 for DOS on OS/2

 

 
Powered by phpBB® Forum Software