Solved

executing php script with python

Posted on 2015-01-16
2
701 Views
Last Modified: 2015-01-16
hello
I am trying to execute a .php file in my script python and i have an error. I would want to know why I have this error:)

subprocess.call("php  files/updatekey.php")

Open in new window

error
> Traceback (most recent call last):   File "adn/start.py", line 15, in
    > <module>
    >     subprocess.call("php  files/updatekey.php")   File "/usr/lib64/python2.7/subprocess.py", line 524, in call
    >     return Popen(*popenargs, **kwargs).wait()   File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    >     errread, errwrite)   File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
    >     raise child_exception OSError: [Errno 2] No such file or directory

Open in new window


ty all
0
Comment
Question by:Gaaara
2 Comments
 
LVL 25

Accepted Solution

by:
clockwatcher earned 500 total points
ID: 40554855
No such file or directory would seem to indicate that it can't find the php executable.  I would suggest providing the full path to php.  I'd also suggest breaking your command up into its parts and passing it as a list to the call method rather than passing it as a single string:

subprocess.call( ["/usr/bin/php", "files/updatekey.php"] )

Open in new window

0
 

Author Closing Comment

by:Gaaara
ID: 40554880
cool ty :)  it works ^^
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Python mysql Insert data error 3 82
method argument as final 1 74
Modbus - whats the maximum I can store in one register? 4 78
mapShare challenge 13 90
Here I am using Python IDLE(GUI) to write a simple program and save it, so that we can just execute it in future. Because when we write any program and exit from Python then program that we have written will be lost. So for not losing our program we…
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now