-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run multiple scripts in same environment #45
Comments
|
hey @codablock thanks for responding. Could you suggest a way to approach this? cmd := a.ep.PythonCmd("-c", script)
cmd.Stdout = &stdoutBuf
cmd.Stderr = &stderrBuf
err := cmd.Run() but that won't result in me having the variables in a python 'world' if i do this, just the outputs. |
You could run the python cmd without a script and then redirect stdout/stdin in a way so that you can do live coding. It's then the same as running |
I think you mean cmd := a.ep.PythonCmd()
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Run() which i think you are suggesting would keep the session open and then i somehow pipe input python to this with stdinputs or something... |
A bit like Jupyter notebooks, I want to run cells of code against the same context
in my case I have a variable in Go,
a = 2
and i run this.Then later I want to do
b = a + 2
and run that from Go.Currently doing this will result in an error
a does not exist
.It seems then that all scripts must be run from top to bottom and include everything.
Is there a way to share the context in which previous python has been run?
I thought that the
EmbeddedPython
object would hold its state but apparently not?Is this possible?
The text was updated successfully, but these errors were encountered: