Message133877
I tried using subprocess.Popen and subprocess.call, both of which did the same behavior. Under the interpreter I get the desired string output:
>>> subprocess.call('ls')
bin Documents eclipse local Pictures tmp workspace
Desktop Downloads hamlib Music Templates Videos
0
Under Idle:
>>> subprocess.call('ls')
0
Thus the subprocess.call method provides the string output. Why should I have to use the subprocess.check_output('command').decode() when subprocess.call() gives me what I want?
Thus it does not seem to be an os.system issue, but a failure of Idle to capture the sysoutput string as the interpreter does The xterminal example highlights this. The sysoutput is echoed at the xterminal not in idle.
You are correct there are other ways to get the specific information for ls. I was using that as test command. I was experimenting with the commands in order to a write a program which will run an executable under either windows or linux. I wanted to see the output in the interpreter in order to test it. I was using Idle for the testing. It does NOT work the same as the interpreter. If Idle is to be useful as an IDE, shouldn't it's shell work the same as the interpreter? If it doesn't why use Idle ? |
|
Date |
User |
Action |
Args |
2011-04-16 01:52:29 | Thekent | set | recipients:
+ Thekent, terry.reedy |
2011-04-16 01:52:29 | Thekent | set | messageid: <1302918749.54.0.847104259546.issue11820@psf.upfronthosting.co.za> |
2011-04-16 01:52:28 | Thekent | link | issue11820 messages |
2011-04-16 01:52:28 | Thekent | create | |
|