I have made a python script for getting a directory tree. Now I am trying to call this script from php using system().
My Python Script is:
import os
from sys import argv
script, start = argv
def list_files(startpath):
directory = []
for root, dirs, files in os.walk(startpath, topdown=True):
for named in dirs:
directory.append(os.path.join(root, named))
for namef in files:
directory.append(os.path.join(root, namef))
return directory
dir = list_files(start)
My PHP command is:
$var = system('C:\\Python27\\python.exe generate -tree.py F:\\IET', $retval);
echo $var;
echo $retval;
The output that I am getting on the browser is the number '2', and when I was doing it a day before the output was coming as the number '1'.
I am new to PHP so couldn't really understand what I am doing wrong here. Any Guidance would be appreciated!