[Tutor] Running multiple python scripts from one python scripts

Alan Gauld alan.gauld at yahoo.co.uk
Fri Oct 25 06:10:39 EDT 2019


On 25 October 2019, at 07:46, ose micah via Tutor <tutor at python.org> wrote:

>That was my very first deployment. Calling the scripts and running them. But, that would not work in my use case. As some of the scripts are been formed in the main scripts.

Are you saying that you have a python program somewhere that is generating python code and you are then, in this program, running those dynamically created scripts?

If so, there is almost certainly a better way of doing things by creating permanent scripts and passing parameters and data to them.

Perhaps if we knew more about these script creation programs we could offer a cleaner solution.

Executing dynamically created code via os.system or subprocess is a big security hole but, if it's python code, you might as well use the exec function which is just as big a hole, but more efficient!

 One of the biggest issues with this kind of approach is the invisibility of any output, you need to rely on shared knowledge of output files or data tables. That implies a lot of checking to make sure that they exist before every access and that they are new versions and you are not reprocessing old data. It all gets very messy in any kind of real world environment.

Alan g.



More information about the Tutor mailing list