Welcome to Dream.In.Code
Become an Expert!

Join 150,239 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,353 people online right now. Registration is fast and FREE... Join Now!




Open another program with python

 
Reply to this topicStart new topic

Open another program with python

Jacobpsp
13 Nov, 2007 - 01:24 PM
Post #1

New D.I.C Head
*

Joined: 6 Sep, 2007
Posts: 38


My Contributions
What function or command could i use to open or start another program on my computer.

thanks

oh yeah and this is with python smile.gif
User is offlineProfile CardPM
+Quote Post

gl3thr0
RE: Open Another Program With Python
14 Nov, 2007 - 09:05 AM
Post #2

D.I.C Head
**

Joined: 27 Oct, 2007
Posts: 210



Thanked: 4 times
My Contributions
do you want to open a phython program or like a game?
User is offlineProfile CardPM
+Quote Post

gl3thr0
RE: Open Another Program With Python
14 Nov, 2007 - 09:11 AM
Post #3

D.I.C Head
**

Joined: 27 Oct, 2007
Posts: 210



Thanked: 4 times
My Contributions
haha well if its a another program u have to first import os and then us chose ur directory and the start the file
this is a realllllly simple example i wrote ages ago bt it should start u off.. u will want to add a try and catch statement to it bt this is the basic

CODE

ya = '666'
password = raw_input("Password: ")

if password == ya: #hi
    print ('good job')
    import os     # this all u need to look at the rest is just from be4
    os.chdir(r'C:\program files\halo')   #
    os.startfile("halo.exe")       #
else:
    print ('try again')
    password = raw_input('password: ')

dont worry bout the other stuff it wa a school project thing tongue.gif

This post has been edited by gl3thr0: 14 Nov, 2007 - 09:12 AM
User is offlineProfile CardPM
+Quote Post

Jacobpsp
RE: Open Another Program With Python
14 Nov, 2007 - 02:12 PM
Post #4

New D.I.C Head
*

Joined: 6 Sep, 2007
Posts: 38


My Contributions
QUOTE(gl3thr0 @ 14 Nov, 2007 - 10:11 AM) *

haha well if its a another program u have to first import os and then us chose ur directory and the start the file
this is a realllllly simple example i wrote ages ago bt it should start u off.. u will want to add a try and catch statement to it bt this is the basic

CODE

ya = '666'
password = raw_input("Password: ")

if password == ya: #hi
    print ('good job')
    import os     # this all u need to look at the rest is just from be4
    os.chdir(r'C:\program files\halo')   #
    os.startfile("halo.exe")       #
else:
    print ('try again')
    password = raw_input('password: ')

dont worry bout the other stuff it wa a school project thing tongue.gif


thanks mate

User is offlineProfile CardPM
+Quote Post

gl3thr0
RE: Open Another Program With Python
15 Nov, 2007 - 01:00 PM
Post #5

D.I.C Head
**

Joined: 27 Oct, 2007
Posts: 210



Thanked: 4 times
My Contributions
np
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 06:16AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month