calling programs from python

R

RR

Hello,

I am trying to call a program in python as I would call it in the command
line. For example I want to do the following from python: command > file.
Then read this file. How do I call "command > file" ? Much help
appreciated.

-RR
 
D

David MacQuigg

Hello,

I am trying to call a program in python as I would call it in the command
line. For example I want to do the following from python: command > file.
Then read this file. How do I call "command > file" ? Much help
appreciated.

Use os.system() For example, on Unix:
-- Dave
 
D

David MacQuigg

On Tue, 02 Dec 2003 16:02:26 GMT, Kristofer Wouk
import os
os.popen('command > file')

This is a little confusing. Do you intend the output from 'command'
to go to 'file' or to the pipe you just opened?

If you are opening a pipe (to be read as a file object) I would
suggest something like this:
['\tpyuic ModelSelector.ui > ModelSelector.py\n']

If you are just executing a command and not needing to process any
output from the command (other than its completion status), I would
stick with the more general:

--Dave
 
R

Richard James

David MacQuigg said:
Use os.system() For example, on Unix:

-- Dave

Windows Python os module has os.startfile()

os.startfile('C:\Python23\python.exe')

-- Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top