[Tutor] What's wrong with this?

Alan Gauld alan.gauld at btinternet.com
Sat May 5 04:00:28 CEST 2007

"Jason Coggins" <jcoggins828 at charter.net> wrote

> I have the following function in a program:
> os.popen('filename.py')

So what happened?
Did you get an error message? If so what?

> What I want to do is launch the program in the os.popen() function.

Do you want to lasunch it or interact with it.
If its only launch then os.system might be easier.

> The file I am trying to launch is located in the same directory
> as the program the function is contained in.

That may not be the same directory you start the program from.
Its always safer to use (or build) the full path.

Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list