[Pythonmac-SIG] Unable to run python application

massimo di stefano massimodisasha at yahoo.it
Wed Apr 15 21:06:50 CEST 2009


Hi,

you can run your program from the terminal.app
(Application -> Utility -> Terminal.app)


simply running :

python /path/to/first.py



if you want run it inside a python shall, you need to define a function,
to do it :

changes the code to :



#|/usr/bin/python

def first():
     print " Hello world"
     user_input = raw_input("What is your name?")
     print "Thank you", user_input




then open terminal.app
cd /directory where is your file.py
type python


macbook-pro-15-di-sasha:Desktop sasha$ python
Python 2.5.1 (r251:54863, Jan 13 2009, 10:26:13)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> from first import *
 >>> first()
  Hello world
What is your name?epi
Thank you epi
 >>>



Massimo Di Stefano
massimodisasha at yahoo.it

epifanio on   irc.freenode.net  /join gfoss







Il giorno 15/apr/09, alle ore 20:38, pbeegee beegee  
<beegee63 at gmail.com> ha scritto:

>
>
>
> Hi there, I am a beginner in python and I wrote a simple program
> called first.py (using aquamacs) and stored it on my desktop.
> I opened IDLE and wrote the command python first.py
> and I got a syntax error with 'first' being highlighted
> I have a mac os 10.4.11, python 2.6.1 on IDLE
> and I also used the aquamacs compiler for python
> /* the program i wrote was*/
> print " Hello world"
> user_input = raw_input("What is your name?")
> print "Thank you", user_input
> */
> <first.py><Picture 1.png><Picture 2.png>
>

Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 



More information about the Pythonmac-SIG mailing list