Python command in python script from another python script
Question: I read already this [What is the best way to call a python script from another
python script?](http://stackoverflow.com/questions/1186789/what-is-the-best-
way-to-call-a-python-script-from-another-python-script)

In my case I don't want to call another python script in a python script, but
I want to call for example the ssylze.py with the specific options

    
    
    $ python sslyze.py --regular www.target1.com
    

like consider in <https://code.google.com/p/sslyze/wiki/QuickStart>

So I have script test1.py and in that script I would like to use

    
    
    sslyze.py --regular www.target1.com
    

how I do that?


Answer: Not sure if I've unscrambled the code from your comment ok and whether this is
what you are trying to do. As I don't know what sslyze.py is doing I haven't
tested it. However your problem might be due to not waiting for each
subprocess to terminate:

    
    
    import subprocess 
    with open("ip.txt", "r") as file_in:
      fname = "scan.txt" 
      with open("scan.txt","w") as file_out:
        for line in file_in: 
          process = subprocess.Popen(["python", "sslyze.py", "--regular", line], stdout=subprocess.PIPE) 
          file_out.write(process.communicate()) # you might need to append \n to whatever you write
    

