Pycharm Comm run script that uses python subprocess hangs/never returns

This runs from within IDLE:

>>> proc1 = subprocess.run(['python', '-m', 'speedtest'], stdout = subprocess.PIPE, text = True)
>>> print(proc1.stdout)

Testing download speed................................................................................
Download: 664.80 Mbit/s
Testing upload speed......................................................................................................
Upload: 16.75 Mbit/s


This hangs and doesn't return in Pycharm:

import subprocess

proc1 = subprocess.run(['python', '-m', 'speedtest'], stdout = subprocess.PIPE, text = True)
# proc1 = subprocess.run(['dir'], stdout = subprocess.PIPE, text = True, shell = True)
print(proc1.returncode)
print(proc1.args)
print(proc1.stdout)

I have to use task manager to end the process. The "DIR" command on the subsequent line of code runs fine from Pycharm - returns and displays stdout in the output window. https://www.screencast.com/t/syl2E40rBEEq

Have only used Pycharm a couple of times, so it's likely there's a setting / config that I don't know about / understand but should

Thanks

Mark

 

 

1 comment
Comment actions Permalink

With a bit more digging I see that this code submitted the same subprocess command 1000 times from Pycharm.

What might have caused this?

Is there something I need to know about using Pycharm with a command that takes a while to return STDOUT/ERR? Subprocess usually handles this. And, from IDLE, this same code runs in about 15 seconds and only once, of course.

From Pycharm, it eventually fails with windows error : "The paging file is too small for this operation to complete".

I've put the same code into sublime and notepad, both run just once and successfully.

What am I missing to get this to run from Pycharm? (I'd love to make the switch)

Thanks again.

 

0

Please sign in to leave a comment.