Answer the question
In order to leave comments, you need to log in
Is it possible to execute a script from the python interpreter at the address?
My program, written in C#, runs python scripts by creating a process of the python module installed on the computer, then by passing data to the standard input stream, data is entered, and data is read from the output stream.
This all works, but it seems to me that the program spends a lot of time starting the python process. And besides, there can be several such scripts, and moreover, they must be called almost once a second.
Is it possible, within a single python process, to specify which scripts I want to execute? That is, is there any python interpreter command like execute("file address") ?
Answer the question
In order to leave comments, you need to log in
Have you tried googling?
exec() takes a Python string, so you have to load the contents of the script yourself. But then all you need is a tiny wrapper that reads the script from stdin and feeds it to exec().
In general, I would think about whether it is worth transferring more functions to the python script, and making it a full-fledged program, instead of a "attached" script interpreter.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question