-1

I have a python script, which I am calling from the php file.

My output is coming as expected, when run as python test.py

But when I am trying to run the php file through the browser, I am not getting the output.

However, on commenting the following lines, I am able to get some results. But I want these lines to run.

with open(filen,'w') as f:
                     f.write(str("write date"))

I am not sure, what's happening. Can anyone explain what difference its making when php reaches these lines.

Thanks

Sherry
  • 311
  • 2
  • 4
  • 9

1 Answers1

0

the question is not clear. I'm guessing you want to execute a python script from php. Your python script does not output anything but write to a file.

executing a python file from php

<?php
print shell_exec("python test.py");
?>

this question may help you if the code above doesn't work: php shell_exec() command is not working

please edit your question for a more accurate response.

noob
  • 3
  • 3