Python implements methods that call other python scripts

  • 2020-04-02 14:11:59
  • OfStack

This article is an example of how a python implementation can call other python scripts. Specific methods are as follows:

This instance invokes the md5get.py script in the current directory. The code is as follows:


import os 
import logging 
import subprocess 
 
log = logging.getLogger("Core.Analysis.Processing") 
 
INTERPRETER = "/usr/bin/python" 
 
 
if not os.path.exists(INTERPRETER): 
  log.error("Cannot find INTERPRETER at path "%s"." % INTERPRETER) 
   
processor = "md5get.py" 
 
pargs = [INTERPRETER, processor] 
pargs.extend(["--input=inputMd5s"]) 
subprocess.Popen(pargs) 

I hope this article has helped you with your Python programming.


Related articles: