4 Replies - 27174 Views - Last Post: 15 November 2007 - 02:00 PM Rate Topic: -----

#1 Jacobpsp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 38
  • Joined: 06-September 07

Open another program with python

Post icon  Posted 13 November 2007 - 02:24 PM

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

thanks

oh yeah and this is with python :)
Is This A Good Question/Topic? 0
  • +

Replies To: Open another program with python

#2 gl3thr0  Icon User is offline

  • D.I.C Regular

Reputation: 19
  • View blog
  • Posts: 319
  • Joined: 27-October 07

Re: Open another program with python

Posted 14 November 2007 - 10:05 AM

do you want to open a phython program or like a game?
Was This Post Helpful? 0
  • +
  • -

#3 gl3thr0  Icon User is offline

  • D.I.C Regular

Reputation: 19
  • View blog
  • Posts: 319
  • Joined: 27-October 07

Re: Open another program with python

Posted 14 November 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

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 :P

This post has been edited by gl3thr0: 14 November 2007 - 10:12 AM

Was This Post Helpful? 1

#4 Jacobpsp  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 38
  • Joined: 06-September 07

Re: Open another program with python

Posted 14 November 2007 - 03:12 PM

View Postgl3thr0, on 14 Nov, 2007 - 10:11 AM, said:

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

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 :P


thanks mate
Was This Post Helpful? 0
  • +
  • -

#5 gl3thr0  Icon User is offline

  • D.I.C Regular

Reputation: 19
  • View blog
  • Posts: 319
  • Joined: 27-October 07

Re: Open another program with python

Posted 15 November 2007 - 02:00 PM

np
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1