[Tutor] python scripting using "./"
Hank Wilkinson
hwilkinson at triad.rr.com
Tue May 24 15:24:53 CEST 2011
John-Wilkinsons-iMac:p31summerfield wilkinson$ ls -al /usr/local/bin/python
ls: /usr/local/bin/python: No such file or directory
John-Wilkinsons-iMac:p31summerfield wilkinson$ ls -al /usr/local/bin/python3
lrwxr-xr-x 1 root wheel 69 Mar 21 13:45 /usr/local/bin/python3 -> ../../../Library/Frameworks/Python.framework/Versions/3.1/bin/python3
John-Wilkinsons-iMac:p31summerfield wilkinson$
On May 24, 2011, at 9:20 AM, Flynn, Stephen (L & P - IT) wrote:
> What is your Python executable called? You refer to it as "python" on
> the command line but your "#!" line in your script refers to the
> executable as "python3.1". tried it with just "python" in the #! Line?
>
> Check the output of 'ls -al /usr/local/bin/pytho*'...
>
> S.
>
> -----Original Message-----
> From: tutor-bounces+steve.flynn=capita.co.uk at python.org
> [mailto:tutor-bounces+steve.flynn=capita.co.uk at python.org] On Behalf Of
> Hank Wilkinson
> Sent: Tuesday, May 24, 2011 2:10 PM
> To: tutor at python.org
> Subject: [Tutor] python scripting using "./"
>
> I am trying to do script in python using "./"
> Here is a session showing "bad interpreter: No such file or directory"
> Is this a python question/problem?
>
> Last login: Sat May 21 14:22:49 on ttys000
> John-Wilkinsons-iMac:~ wilkinson$ cd
> /Users/wilkinson/Documents/py32/p31summerfield
> John-Wilkinsons-iMac:p31summerfield wilkinson$ pwd
> /Users/wilkinson/Documents/py32/p31summerfield
> John-Wilkinsons-iMac:p31summerfield wilkinson$ ls hello.py
> hello.py
> John-Wilkinsons-iMac:p31summerfield wilkinson$ python hello.py
> Hello World!
> John-Wilkinsons-iMac:p31summerfield wilkinson$ chmod +X hello.py
> John-Wilkinsons-iMac:p31summerfield wilkinson$ ./hello.py
> -bash: ./hello.py: /usr/local/bin/python3.1^M: bad interpreter: No such
> file or directory
> John-Wilkinsons-iMac:p31summerfield wilkinson$ echo $PATH
> /opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/
> bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
> John-Wilkinsons-iMac:p31summerfield wilkinson$ cat hello.py
> #!/usr/local/bin/python3.1
>
> print("Hello", "World!")
> John-Wilkinsons-iMac:p31summerfield wilkinson$ python
> Python 3.1.2 (r312:79147, Mar 20 2011, 17:15:01)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import sys
>>>> sys.path
> ['',
> '/opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/python3
> 1.zip',
> '/opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/python3
> .1',
> '/opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/python3
> .1/plat-darwin',
> '/opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/python3
> .1/lib-dynload',
> '/opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/python3
> .1/site-packages']
>
> Thank you.
> Hank
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
> This email has been scanned for all viruses by the MessageLabs SkyScan
> service.
>
> This email and any attachment to it are confidential. Unless you are the intended recipient, you may not use, copy or disclose either the message or any information contained in the message. If you are not the intended recipient, you should delete this email and notify the sender immediately.
>
> Any views or opinions expressed in this email are those of the sender only, unless otherwise stated. All copyright in any Capita material in this email is reserved.
>
> All emails, incoming and outgoing, may be recorded by Capita and monitored for legitimate business purposes.
>
> Capita exclude all liability for any loss or damage arising or resulting from the receipt, use or transmission of this email to the fullest extent permitted by law.
More information about the Tutor
mailing list