?
Solved

executing php script with python

Posted on 2015-01-16
2
Medium Priority
?
1,376 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
clockwatcher earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Flask is a microframework for Python based on Werkzeug and Jinja 2. This requires you to have a good understanding of Python 2.7. Lets install Flask! To install Flask you can use a python repository for libraries tool called pip. Download this f…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

762 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