[Tutor] Apparent incosistency with Python interperter in IDLE

Karen Palen karen_palen at yahoo.com
Thu Jun 18 07:53:19 CEST 2009


I am an experienced C/C++/C# programmer who is just starting out with Python. My first attempt at IDLE worked great with the tutorial, but seems to have a problem with my first real app!

I am trying to get the Python subprocess/Popen module working with the example from the Python 3 documentation page:
>>> import subprocess
>>> subprocess.call('ls')
Archive		       Firefox_wallpaper.png  result.txt ...

which is what I expect.

However this same input to the IDLE "Python Shell" yields:

Python 3.0.1+ (r301:69556, Apr 15 2009, 15:59:22) 
[GCC 4.3.3] on linux2
Type "copyright", "credits" or "license()" for more information.
==== No Subprocess ====
>>> import subprocess
>>> subprocess.call('ls')
0
>>> 


Which appears to be merely the return code, not the stdout!

It looks like I need to set some variable in IDLE, but I can't figure out exactly what is needed here.

Can anyone point me to an answer?

Karen


      


More information about the Tutor mailing list