Executing Python Scripts on Mac using Python Launcher
Hello, This is my first post so go easy on me. I am just beginning to program using Python on Mac. When I try to execute a file using Python Launcher my code seems to cause an error in terminal, when I execute the exact same piece of code and run it in windows it seems to execute as exactly intended. How can I make my python script to open up correctly using Python Launcher? I am running 10.7 on my Mac. I would upload a photo with the error I get but I can't seem to find the upload feature in this group. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: Executing Python Scripts on Mac using Python Launcher
I have installed Python 2.7.3 from Python.org also in Terminal it states that I have 2.7.3. How can I execute the script from Terminal? I've tried typing python into the window and then dragging the file to terminal but I get a syntax error. Sorry I am new to Python and just want to know how I can open such a file using 10.7. Thanks http://www.freeimagehosting.net/ilbqt http://www.freeimagehosting.net/r5ars On Monday, June 25, 2012 8:49:07 PM UTC+1, Benjamin Kaplan wrote: > On Mon, Jun 25, 2012 at 11:19 AM, David Thomas wrote: > > Hello, > > This is my first post so go easy on me. I am just beginning to program > > using Python on Mac. When I try to execute a file using Python Launcher my > > code seems to cause an error in terminal, when I execute the exact same > > piece of code and run it in windows it seems to execute as exactly intended. > > How can I make my python script to open up correctly using Python > > Launcher? I am running 10.7 on my Mac. I would upload a photo with the > > error I get but I can't seem to find the upload feature in this group. > > > > Thanks > > -- > > You can't find the upload feature because this isn't a Google Group. > It's a Usenet newsgroup that Google Groups provides access to that's > also available as a mailing list. If you want to provide an image, use > an image host and link to the image. > > As to your question, I have a few questions of my own. What version of > Python are you using? Is it the version included in Mac OS X, > installed from a python.org binary, compiled by source, or installed > through a package manager? What happens if you call the script from > the command line instead of using the Launcher application? -- http://mail.python.org/mailman/listinfo/python-list
Re: Executing Python Scripts on Mac using Python Launcher
On Tuesday, June 26, 2012 6:37:42 PM UTC+1, Dave Angel wrote: > On 06/26/2012 01:19 PM, David Thomas wrote: > > I have installed Python 2.7.3 from Python.org also in Terminal it states > > that I have 2.7.3. > > How can I execute the script from Terminal? I've tried typing python into > > the window and then dragging the file to terminal but I get a syntax error. > > Sorry I am new to Python and just want to know how I can open such a file > > using 10.7. > > > > Thanks > > Assuming python is on your PATH within that terminal, you'd normally do > something like: > > cd /fullpathtoscript (the location of your script) > python myscript.py(or whatever your script is called) > > > If that doesn't work for you, please be specific about what happens. > Best way to do that is to copy/paste the text (showing in terminal) > into your reply here. > > Also, please don't top-post. Put your new text AFTER the part you've > quoted from earlier messages. > > -- > > DaveA On Tuesday, June 26, 2012 6:37:42 PM UTC+1, Dave Angel wrote: > On 06/26/2012 01:19 PM, David Thomas wrote: > > I have installed Python 2.7.3 from Python.org also in Terminal it states > > that I have 2.7.3. > > How can I execute the script from Terminal? I've tried typing python into > > the window and then dragging the file to terminal but I get a syntax error. > > Sorry I am new to Python and just want to know how I can open such a file > > using 10.7. > > > > Thanks > > Assuming python is on your PATH within that terminal, you'd normally do > something like: > > cd /fullpathtoscript (the location of your script) > python myscript.py(or whatever your script is called) > > > If that doesn't work for you, please be specific about what happens. > Best way to do that is to copy/paste the text (showing in terminal) > into your reply here. > > Also, please don't top-post. Put your new text AFTER the part you've > quoted from earlier messages. > > -- > > DaveA On Tuesday, June 26, 2012 6:37:42 PM UTC+1, Dave Angel wrote: > On 06/26/2012 01:19 PM, David Thomas wrote: > > I have installed Python 2.7.3 from Python.org also in Terminal it states > > that I have 2.7.3. > > How can I execute the script from Terminal? I've tried typing python into > > the window and then dragging the file to terminal but I get a syntax error. > > Sorry I am new to Python and just want to know how I can open such a file > > using 10.7. > > > > Thanks > > Assuming python is on your PATH within that terminal, you'd normally do > something like: > > cd /fullpathtoscript (the location of your script) > python myscript.py(or whatever your script is called) > > > If that doesn't work for you, please be specific about what happens. > Best way to do that is to copy/paste the text (showing in terminal) > into your reply here. > > Also, please don't top-post. Put your new text AFTER the part you've > quoted from earlier messages. > > -- > > DaveA On Tuesday, June 26, 2012 6:37:42 PM UTC+1, Dave Angel wrote: > On 06/26/2012 01:19 PM, David Thomas wrote: > > I have installed Python 2.7.3 from Python.org also in Terminal it states > > that I have 2.7.3. > > How can I execute the script from Terminal? I've tried typing python into > > the window and then dragging the file to terminal but I get a syntax error. > > Sorry I am new to Python and just want to know how I can open such a file > > using 10.7. > > > > Thanks > > Assuming python is on your PATH within that terminal, you'd normally do > something like: > > cd /fullpathtoscript (the location of your script) > python myscript.py(or whatever your script is called) > > > If that doesn't work for you, please be specific about what happens. > Best way to do that is to copy/paste the text (showing in terminal) > into your reply here. > > Also, please don't top-post. Put your new text AFTER the part you've > quoted from earlier messages. > > -- > > DaveA Hi On Tuesday, June 26, 2012 6:37:42 PM UTC+1, Dave Angel wrote: > On 06/26/2012 01:19 PM, David Thomas wrote: > > I have installed Python 2.7.3 from Python.org also in Terminal it states > > that I have 2.7.3. > > How can I execute the script from Terminal? I've tried typing python into > > the window and then dragging the file t
Re: Executing Python Scripts on Mac using Python Launcher
On Monday, June 25, 2012 7:19:54 PM UTC+1, David Thomas wrote: > Hello, > This is my first post so go easy on me. I am just beginning to program using > Python on Mac. When I try to execute a file using Python Launcher my code > seems to cause an error in terminal, when I execute the exact same piece of > code and run it in windows it seems to execute as exactly intended. > How can I make my python script to open up correctly using Python Launcher? > I am running 10.7 on my Mac. I would upload a photo with the error I get but > I can't seem to find the upload feature in this group. > > Thanks Thank you for the fast response. How can I tell if Python is in the same path as Terminal? Is this located in the /usr folder? Thanks again -- http://mail.python.org/mailman/listinfo/python-list
Re: Executing Python Scripts on Mac using Python Launcher
On Tuesday, June 26, 2012 10:48:22 PM UTC+1, Hans Mulder wrote: > On 26/06/12 22:41:59, Dave Angel wrote: > > On 06/26/2012 03:16 PM, Hans Mulder wrote: > >> > >> > >> Python is an executable, and is > >> typically located in a "bin" directory. To find out where > >> it is, type > >> > >> type python > >> > >> at the shell prompt (that's the first prompt you get if you > >> open a Terminal window). > >> > >> > > > > That's a typo. You presumably meant: > > > > which python > > > > No, I meant: > > $ type python > python is /Library/Frameworks/Python.framework/Versions/2.7/bin/python > > 'type' is a bash builtin that tells you how bash would interpret > a command. 'which' is a separate program, which tells you how > csh would interpret a command. For a 'bash' user, 'type' is more > accurate than 'which'. For example, 'type' recognizes 'bash' > builtins. > > -- HansM I have the following: Is this why I keep getting an error using launcher? Also to open the script in terminal do I need to put the following at the beginning of my script: #!/bin/python On python.org it states to To run your script from the Terminal window you must make sure that /usr/local/bin is in your shell search path. How can I make sure that the Python I have installed on my Mac is in my shell search path. http://www.freeimagehosting.net/saskk Thanks again and I am sorry for all the questions, I am just getting started on Python -- http://mail.python.org/mailman/listinfo/python-list
Re: Executing Python Scripts on Mac using Python Launcher
Thank you ever so much raw_input works fine. Do you think I should stick with Python 2 before I go to 3? I have a text book which is using 3 but I've been using an online tutorial which has been helping me lots, which uses version 2. I found by just typing python then having a space and dragging the file from finder into terminal works. -- http://mail.python.org/mailman/listinfo/python-list
Recommend decent Computer Science books
Hi I know that this is a group about Python. But I am just wondering if anybody can recommend any introductory/good books on Conputer Science. Kind regards -- http://mail.python.org/mailman/listinfo/python-list
Re: Recommend decent Computer Science books
Thanks everyone for the feedback really appreciate it especially the above post cheers -- http://mail.python.org/mailman/listinfo/python-list
Following syntax error in Mac OX10.7 Terminal
Hi, I have the following error regarding a loop tutorial found on http://www.sthurlow.com/python/lesson04/ >>> a=0 >>> while a<10: ... a=a+1 File "", line 2 a=a+1 ^ IndentationError: expected an indented block When I run Python IDE it seems to work fine. The following code is: a=0 while a<10: a=a+1 print a Kind regards -- http://mail.python.org/mailman/listinfo/python-list
Re: Following syntax error in Mac OX10.7 Terminal
Thank you very much I didn't realise that the indentation was important. The IDE indents automatically whilst terminal doesn't. Thanks for pointing it out. -- http://mail.python.org/mailman/listinfo/python-list
Re: Re Following syntax error in Mac OX10.7 Terminal
On Thursday, June 28, 2012 6:30:42 PM UTC+1, Sergi Pasoev wrote: > You just have to consider that indentation matters in Python, so you > have to type the code in Python interpreter as you have written it > below, that is, press Tab before each line when you are inside the > 'while (or any other like for, if, with, etc.) block. > > a=0 > while a<10: > a=a+1 > print a > > I can guess from your message that you aren't aware of one very > important Python feature, and maybe you also didn't willingly choose to > learn Python2 instead of Python3 ? In this case I would advise you to > consider both versions before choosing. Hi yeah I'm currently learning python 2 at the moment and the tutorial that I am studying doesn't explain about indentation. -- http://mail.python.org/mailman/listinfo/python-list
Re: Re Following syntax error in Mac OX10.7 Terminal
On Friday, June 29, 2012 4:21:56 PM UTC+1, MRAB wrote:
> On 29/06/2012 16:13, David Thomas wrote:
> > On Thursday, June 28, 2012 6:30:42 PM UTC+1, Sergi Pasoev wrote:
> >> You just have to consider that indentation matters in Python, so you
> >> have to type the code in Python interpreter as you have written it
> >> below, that is, press Tab before each line when you are inside the
> >> 'while (or any other like for, if, with, etc.) block.
> >>
> >> a=0
> >> while a<10:
> >> a=a+1
> >> print a
> >>
> >> I can guess from your message that you aren't aware of one very
> >> important Python feature, and maybe you also didn't willingly choose to
> >> learn Python2 instead of Python3 ? In this case I would advise you to
> >> consider both versions before choosing.
> >
> > Hi yeah I'm currently learning python 2 at the moment and the tutorial that
> > I am studying doesn't explain about indentation.
> >
> Really? Indentation is a basic feature of Python!
while {condition that the loop continues}:
{what to do in the loop}
{have it indented, usually four spaces}
{the code here is not looped}
{because it isn't indented}
Just discovered this in the tutorial further down. I'm currently learning
Python 2 because there seems to be a lot of tutorials out there covering Python
2 rather than 3.
Thanks for the help this community is great for help.
--
http://mail.python.org/mailman/listinfo/python-list
Python and OSX 10.8
Im looking to upgrade my Mac to 10.8 and I'm worried if Python and IDLE may not run on it. When I try to run this command in Terminal: python -m idlelib.idle I can not launch IDLE which comes bundled on Mac. On Lion it's been fine but I've tried it on my friend's copy of Mountain Lion and it will not work. -- http://mail.python.org/mailman/listinfo/python-list
