Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

[SOLVED] Using Python to Control another Python script?

NEVERMIND! Here's a working example for anyone interested:

PHP Code

<?php 
import subprocess
cmd 
= 'script.py' #How I'd start the script in cmd

p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
out, err = p.communicate() 
result = out.split('\n')
for 
lin in result:
    if 
not lin.startswith('#'):
        print(
lin) 
[Image: 5BgQiIm.gif]
Best way always import files.
(Apr 14, 2017 10:59 AM)SIM-1866423 Wrote:  Best way always import files.

Yes however I need the output - or what it's printing. I could rewrite the old code but that would take forever
[Image: 5BgQiIm.gif]
(Apr 14, 2017 11:21 AM)TheWarOwl Wrote:  Yes however I need the output - or what it's printing. I could rewrite the old code but that would take forever

I'm struggling to understand, you can still use variables to do that.Or basically just return things


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 630 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[Python] by SIM-1517404Jul 21, 2017 06:54 AM 9 238 Jul 21, 2017 06:54 AM
Last Post: koolkid
[Python] by MalentorJul 14, 2017 10:27 AM 16 516 Jul 14, 2017 10:27 AM
Last Post: Malentor