atom-community / atom-script

:runner: Run ( scripts | selections | source ) in Atom
https://atom.io/packages/script
MIT License
733 stars 269 forks source link

Output console updates only AFTER the script has been run #425

Open nicokoch opened 9 years ago

nicokoch commented 9 years ago

The bottom console, which shows the program output will only update itself AFTER the program has terminated. Instead, it would be better if it showed the new output whenever the program outputs something.

This has been tested with the following python script:

import time
print('start')
time.sleep(5)
print('stop')

After 5 seconds, the bottom console will output

start
stop

Instead, the 'start' should be printed immediately.

rgbkrk commented 9 years ago

This seems like an artifact of us using BufferedProcess instead of the node centric process spawning.

superlou commented 9 years ago

It's something we're running into a lot with numpy/matplotlib scripts since they block execution at a plt.show() command, and traditionally plt.show() is the last line of our scripts.

rgbkrk commented 9 years ago

oooooh, how are you outputting the plots? Just pylab.show()?

I'm currently working on an electron (nee Atom shell) app to make sidecar output for Jupyter/IPython:

Jupyter sidecar

Once that's in a ready state I'll work on proper Atom integration with a full session. Just an experiment for the moment.

superlou commented 9 years ago

I've been trying to get people onto more vanilla python setups in the office to make it easier to share analysis scripts, so it's just matplotlib.pyplot.show() currently.

rgbkrk commented 9 years ago

I just realized that the image I posted above was before I was displaying plots. Silly me.

rgbkrk commented 9 years ago

@superlou there's now an Atom package called Hydrogen that people can use: https://github.com/willwhitney/hydrogen (happily contributing there). I'll certainly be contributing to it.

Gabriel-p commented 9 years ago

Came here to report exactly this. Has there been any progress with this issue? Cheers

Gabriel-p commented 9 years ago

FYI, script-runner handles this correctly.

rgbkrk commented 9 years ago

Awesome! How does it accept input?

Gabriel-p commented 9 years ago

@rgbkrk apparently it doesn't :(

It only handles correctly the printing of executed commands on the go.