-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

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.