I have a code that uses numpy.savetxt() and works well in a local server to create .txt files (I use my python code on a php file with shell_exec()), otherwise when I put my website online, the .txt file isn't create (or maybe somewhere but I can't find it).
Is this normal or not? I know it isn't great for the security to directly dowload files on your computer from the web browser but what would be the replacement in order to create and download the created file in the online browser (as on the picture but with a pdf file on chrome)? dowload on chrome
data_to_read is an empty folder
python is the name of the folder with all my python files
web is the name of the folder with all my php files directory picture
Python file test.py takes 4 args in argparse, 2 integers n and t, one probability p and one name s and create a txt file in the data_to_read folder:
a = list(bino_echantillon(args.n, args.p, args.taille))
name = '../data_to_read/'+args.name
if __name__ == '__main__':
np.savetxt(name, a, delimiter=',')
php:
$PATH= getcwd().'/test.py';
$PATH=str_replace('web', 'python', $PATH); #(this is a little shortcut to have $PATH= ../python/test.py)
$e=shell_exec("py $PATH -n $n -p $p -t $t -s $s ");
There might be some issues with my code but what I don't understand is that it works locally so I suppose the issue doesn't come from me.
I don't want to mess you up with details of my code but if you need more information please don't hesitate to ask me.
Thanks!
Edit: problem solved by changing py to python!