Solved

executing php script with python

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

747 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