0

I've learned quite a bit since my last post, i.e. it kept disappearing on me just because of syntax, but now I'm interested in something:

Is it possible to make it so that when you run the .py as is , that it opens another program or directory? I.e. when you run it, it opens internet explorer? or another python script?

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by max.yevs
0

what i'm really asking is is there any way to get a program to open something in a new window from a command?

0

Yeah you can do open internet things with the webbrowser module.
Oh and also execfile is good if you want to start executables or python files.

>>> import webbrowser
>>> webbrowser.open("www.google.com")

And execfile

#its a built in!
execfile("Path \\ to\\ exe or py \\ file.exe")

Hope that helps

0

If you want to run something arbitrary:

import os
os.system('your\path\here')

Using the webbrowser module would make more sense for that specific problem, as said above.

0

wow thanks, those all work great!

what i was really thinking of was just to make a program that opens the same program in a new window and kind of 'short circuits'

i did end up doing it, but instead of a program simply a command in command prompt (see it here if you want, but its not very interesting)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.