From: [email protected] 
[mailto:[email protected]] On Behalf Of 
Bspymaster
Sent: Thursday, August 25, 2011 5:54 PM
To: [email protected]
Subject: [Tutor] finalizing code

Hello! I recently started programming in python (I use IDLE with python 2.7 on 
ubuntu 11.04, by the way) and recently made a program (no interface) that 
launches other programs. The problem I'm having is that when I gave my friend 
the code, he had to get an editor to use the code. How do I make it so that 
when you open the program, it starts the code (so anyone can use it, not just 
those who have idle and know ow to program python)? Sorry if this is unclear. I 
basically want to make a stand- alone command line application (or one that 
boots in terminal). It's very basic and runs like so (except longer and 
slightly more complex):

loop = 1
while loop == 1:
    choice = raw_input(">")
    if choice == "prog1":
        print "Launching Prog1"
        os.system("prog1")
        loop = 0
    else:
        print "invalid program. Try again."


God Bless,
Ben Schwabe
=================================================================
If it is just in the module directly, you can probably just say 'python file.py'
It is usually recommended to stick everything into different functions then at 
the end say

If __name__=="__main__":
    function()

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423



This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to