Programming :: Run External Program From Python Script?
Dec 21, 2009
I want to be able to run a program in a python script, and capture it's output in a variable. I figured out that I can execute it with os.system(), but how do I capture it's output and store it in a variable?
View 1 Replies
ADVERTISEMENT
Jul 8, 2011
I need to execute an external command with Python from Web. I know there is subprocess module that executes external programs but I'm trying to execute a command registered for the execution of a program. In this case when I execute my file in the shell everything is Ok, but from the Web it doesn't work.
View 1 Replies
View Related
Jun 24, 2011
I need to write a program for time. like i have 2 tasks both minutes and hours.
like this
1st task=5 hours and 30 minutes
2nd task=2hours and 45 minutes
Together they will take 8 hours and 15 minutes.
I need to write a program thats called ADDTIMES to do something like this.
This is what i have so far.
H1=int(input("enter the number of hours:")) etc..
View 6 Replies
View Related
Jan 30, 2011
Is it possible to easily get the number of desktops, add/remove desktops, and get window titles, icons, and screenshots from a C++ or Python program?
View 12 Replies
View Related
Aug 28, 2010
I'm trying to figure out how to continue execution of a Python program while a background task is going on.
In bash, it is adding "&" to the end as in:
Code:
#! /bin/bash
find / -iname "*.py" > /tmp/all_pys &
echo "looking for all python scripts and putting them in /tmp/all_pys"
(yes, I know I could just put the echo BEFORE the find but I just use it for example)
Say I do that in python (not necessarily running the shell, but perhaps using scriptutil.ffind or something similar), but want to allow the user to be doing something else while running that search in the background, how would I thread, fork, subprocess (not to be confused with the module and Popen) [or whatever I should call it] that?
View 14 Replies
View Related
Dec 28, 2010
If i have a python file with a function call_me(a,b),how can I call this function from the command line ,after i compile the program?
View 5 Replies
View Related
Mar 30, 2011
Assume two applications, Application A and Application B. Both are written in C language.I had tried to use system() function in Application A to execute Application B. It success, but Application A cannot continue its own tasks before Application B exit. I want Application A to execute Application B, but Application A can continue its tasks without waiting for Application B to exit.
View 3 Replies
View Related
Mar 2, 2010
The situation is that I have an MPI-parallel fortran program. I run it and it's distributed on N processors, and each of these processes must call an external program.
This external program is also an MPI program, however I want to run it in serial, on the processor that is calling it, as if it were part of the fortran program. The fortran program waits until the external program has completed, and then continues.
The problem is that this external program seems to run on any processor, and not necessarily the (now idle) processor that called it.
how I can call the program and ensure it runs only on this processor?
Extra information that might be helpful:
If I simply run the external program from the command line (ie, type "/path/myprogram.ex <enter>"), it runs fine. If I run it within the fortran program by calling it via
CALL SYSTEM("/path/myprogram.ex")
it doesn't run at all (doesn't even start) and everything crashes. I don't know why this is.
If I call it using mpiexec:
CALL SYSTEM("mpiexec -n 1 /path/myprogram.ex")
then it does work, but I get the problem that it can go on any node.
View 2 Replies
View Related
Jul 11, 2011
I am just asking how this works in general. I know Python can wrap a C code, but here it seems Python is already integrated with this C program.Would it be correct to say one would have to understand the C code in addition to py programming in order to accomplish anything useful here?I need to control the program, and especially import its output to some algorithm that accomplishes command and control in the way of bash scripts or whatever.
View 2 Replies
View Related
Mar 22, 2009
I want to be able to do
sudo ./program.py
instead of always having to do
sudo python program.py
What do I need to change?
View 5 Replies
View Related
Nov 30, 2009
I've already used line split stuff to transform my data into something like this in a text file:
Code:
['1', '1', '3', '20.7505207']
['2', '1', '3', '23.0488319']
['3', '1', '3', '-1.5768747']
['4', '1', '3', '-26.4772491']
[code]....
How can I get this on a python program so I can manipulate it as an array?
View 3 Replies
View Related
Mar 4, 2010
I have a function definition in a Python 2.x script which take a tuple as one of its arguments, but 2to3 has no answers nor any of my searching on how to represent the same in Python 3.x
Code:
def blah(self, (string1, string2))
View 4 Replies
View Related
Dec 3, 2010
I am wanting to put a print icon into a Python program and will use printing via the command line via calling lp or lpr.
So a simple question: Whats the difference between lp and lpr?
Also when you type man lp or man lpr the man page says Apple Inc?
View 2 Replies
View Related
Dec 16, 2010
I downloaded this programs source and I'm having a hard time figuring out how to install it. I assume it is python source? I tried downloading the debian file but could not figure out how to install it aswell. I downloaded the software from [URL]
View 9 Replies
View Related
Jun 14, 2011
i have ubuntu 10.04 and python 2.6 installed how do i run, stop or restart a .py file from the command line.
btw im using Putty from a windows computer
View 1 Replies
View Related
Apr 7, 2011
How can i embed python script in C program?
View 1 Replies
View Related
Jun 3, 2011
I need to know how to make a program use a version of python older than the newest one. I am trying to run the Traipse fork of OpenRPG. Through their forums, I have learned that one of my problems is that I am running too new a version of python. I have python 2.7.1 installed.
I also have python2.6.6 installed, so I should be able to use that. My first thought was to uninstall 2.7.1 and just use the older version. The problem is that if i uninstall 2.7.1, it wants to also uninstall all the packages dependent on that program. Let's face it, in Natty Narwhal, that is pretty much everything.
Do you know how to force Traipse make it use the 2.6 version?
View 2 Replies
View Related
Feb 9, 2011
I want that I click with the mouse on the video, it paused.I notice that there is "BaconVideoWidget" which I guess is the video rendering widget but it don't have signal named "clicked":
Code:
vd = totem_object.get_video_widget()
vd.connect("clicked", vd.hide)
[code]....
View 3 Replies
View Related
Apr 16, 2010
I need to write program (preffer Python) to change range for users. Does anyone know some library which can help me to do that? Maybe someone has written program like that?
View 5 Replies
View Related
Feb 15, 2011
I will have to code this. However I am lacking of time since I have too much to do. make a short code bash/dash to prompt the country with Zenity, then, get the PLS or m3u url and prompt with another zenity which radio to play. http://www.listenlive.eu/index.html
My code to get url's radio country.htm is:
Code:
View 2 Replies
View Related
Apr 21, 2010
I'm starting to learn python and I am wondering whether I should start with python 2.x or should I just start learning python 3.x?
View 2 Replies
View Related
Apr 6, 2010
I have an existing line of code from a P2 script that I cannot find a solution to converting to P3:
Code:
for i, x in map(None, list1, list2):
I have found the information about converting the simple case:
map(None,x) becomes list(x)
But my googling was unable to find a solution when more than one iterable exists.
View 2 Replies
View Related
Jan 31, 2010
I have a python script I wrote a while ago and now I would like to call that script from inside C. I know how to do one command from C, but how would you execute an entire script from C, and passing arguments? Like:
Code:
int main(void)
{
python( myprogram(1 2 3) );
}
So I can pass arguments to my script.
View 3 Replies
View Related
Jan 19, 2010
what the equivalent function in Python 3.1.1 is for Python 2.6.4s:
Py_FindMethod
Be buggered if I can find anything in the doco to say what replaced it or what alternative code may need to be entered to replace it
View 1 Replies
View Related
Dec 17, 2010
I have decided to learn python as it seems to be powerful not just for web development (like php) but also a clean powerful language for other puposes.
Q: Can someone suggest a tutorial or book, on learning python (beginner to intermediate) which has as its focus for learning, web development?
In order of preference: 1. Comprehensive, 2. Online, 3. Free
View 2 Replies
View Related
Jan 15, 2010
Ok so Basically i have 2 questions
1. i know how to create a file with c++ using but is there a way to save it to a specific location on your computer with windows and linux
Code:
2. i need to know how to run/execute/open a file in a c++ program im using and its not working
Code:
View 4 Replies
View Related
Dec 16, 2010
I have a bash script that I want to import in to Python, mainly just to see if I can or not. However in the script I do use some piping of commands into sed to trim it down to what I need. When I tried doing it with the os.system() call, it didn't work. The exact error is
sed: -e expression #1, char 16: unterminated `s' command
However the command that was run can be run in bash without an error. Is there a better/another way to do this? For reference the command is:
Code:
locate -n 1 wp-config.php | sed 's/wp-config.php/
/g' | sed '/wp-config.php/ d' | sed '/^$/ d'
View 3 Replies
View Related
Mar 17, 2011
I am using Centos. I have written some scipts in python that access my routers and fetch the configuration, etc. Now i was thinking of creating a web interface which i can access from my windows XP. I want it to have good look n feel :-),
View 7 Replies
View Related
Jan 25, 2009
I want to create 3D animation and also make some big programs. Is python capable of that? or should I stick to C++?
View 3 Replies
View Related
Dec 11, 2010
I am trying to build an application that must link with python so as to load a python module during runtime.I have this makefile :
Code:
[alex@iskandhar src]$ cat Makefile
CFLAGS = -Wall -O3 -I ../../../SPOOLES.2.2 -DARCH="Linux" -DSPOOLES -DARPACK
[code]....
View 4 Replies
View Related