Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 19th, 2008, 7:49 PM   #1
JD-Salinger
Unknown
 
JD-Salinger's Avatar
 
Join Date: Apr 2008
Location: unknown
Posts: 87
Rep Power: 1 JD-Salinger is on a distinguished road
what is the purpose of '#!/usr/bin/env python'

i tried to run it in a interactive interpreter then it works like a comment but when i run it as a program all it does is to 'restart'? what does this mean? thanks
__________________
-------------------------------------------------------------------------
I thought what I'd Do was, I'd pretend to be one of those deaf mutes
------------------------------------------------------------------------
JD-Salinger is offline   Reply With Quote
Old Jun 19th, 2008, 10:17 PM   #2
nigel
Newbie
 
nigel's Avatar
 
Join Date: Apr 2008
Posts: 10
Rep Power: 0 nigel is on a distinguished road
Re: what is the purpose of '#!/usr/bin/env python'

#!/whatever just tells the shell you're using to execute that interpreter for that file. it's the shell that interprets the #!/whatever, not python.
nigel is offline   Reply With Quote
Old Jun 23rd, 2008, 8:35 AM   #3
MickeySoFine1972
Software Developer
 
MickeySoFine1972's Avatar
 
Join Date: Jun 2008
Posts: 4
Rep Power: 0 MickeySoFine1972 is on a distinguished road
Re: what is the purpose of '#!/usr/bin/env python'

Specifically that refers to the linux interpreter, I'm not so sure that would be right under windows for instance.

usually what you do under linux is specify that in the first line and then assign the script executable permissions, then it can be run without specifying the interpreter in the command line e.g:

:~$ python scriptname.py

Mike
__________________
There are 10 kinds of people in this world....Those who understand binary and those who don't.
MickeySoFine1972 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Perfect Python Dietrich Python 30 Jan 5th, 2007 1:38 PM
[tutorial] Python for programming beginners coldDeath Python 30 Dec 14th, 2005 12:35 PM
Convert Python script to C++ code clanotheduck Python 17 Sep 25th, 2005 9:55 AM
Advanced Python Tricks Arevos Python 19 Sep 24th, 2005 8:39 AM
Python - A Programmers Introduction coldDeath Python 17 Aug 19th, 2005 1:41 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:09 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC