I am trying to run a python script in php to test file reading so i can continue my work and do more code. I tried with a small txt file and php file but the output of python script is an empty string. All the files are in the same directory and i am using XAMPP in VISTA OS.
php file
<?php
$validation= exec('python script.py juliodantas.txt') ;
echo $validation ;
var_dump($validation);
?>
python file: (script.py)
#!C:\Python27\python.exe
print "Content-Type: text/html\n"
import sys
fich_input= sys.argv[1]
def test(fich):
input_fil=open(fich,'r')
s=''
cont=0
for line in input_fil:
cont+=1
s+=line
return (line,cont)
test(fich_input)
txt file is tab formated file (juliodantas.txt)
CAS Smiles InchI Mol_name LAB Institution Species Cell_type Subcellular Bio_target Conditions Asay_parameter Observations Assay_ID strain Tissue target_type value Unity Comparisons Experimental_error
12233 535 2435d 3r5rg 4t4t 4t 4t34t4 4t4t4 4trgdf vgery4 345y4 grfbg gergh hj6yu wde kukl derj,.i gjyy htht5u thyt5 tht56 thtrj4yeg
the output of php:
string(0) ""