Solved

executing php script with python

Posted on 2015-01-16
2
822 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
noX challenge 17 115
wordmultiple challenge 12 131
what is the main difference between git clone and fetch ann pull and push commands 2 85
How does this Python sort work? 5 86
A set of related code is known to be a Module, it helps us to organize our code logically which is much easier for us to understand and use it. Module is an object with arbitrarily named attributes which can be used in binding and referencing. …
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.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

776 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