python-shell icon indicating copy to clipboard operation
python-shell copied to clipboard

PythonShell cannot be instantiated without a script

Open eulertour opened this issue 5 years ago • 4 comments

Is there any reason for this? It could be useful to run an interactive session without a script, as if you had run python from a terminal.

eulertour avatar Apr 17 '20 08:04 eulertour

It can be run without a script. Take a look at https://github.com/extrabacon/python-shell/blob/master/README.md#runstringcode-options-callback

Almenon avatar Apr 17 '20 14:04 Almenon

The question is on whether it can be instantiated without a script, i.e. whether one can save it to a variable and interact with it intermittently the way it is at https://github.com/extrabacon/python-shell#sendmessage.

eulertour avatar Apr 17 '20 17:04 eulertour

Ah, I see. Feel free to submit a PR if you want that functionality.

Almenon avatar Apr 20 '20 00:04 Almenon

I've been working on a package here which does this. You can start an interactive Python process for executing individual commands, the same as running python in the terminal and entering code line by line. If anyone requires this functionality, I hope this is useful.

louislefevre avatar Aug 09 '21 03:08 louislefevre