Platform independent code?

saneman asd at ad.com
Sat Jun 14 09:28:28 EDT 2008


I have read that Python is a platform independent language.  But on this 
page:

http://docs.python.org/tut/node4.html#SECTION004220000000000000000

it seems that making a python script executable is platform dependant:

2.2.2 Executable Python Scripts
On BSD'ish Unix systems, Python scripts can be made directly executable, 
like shell scripts, by putting the line


#! /usr/bin/env python
(assuming that the interpreter is on the user's PATH) at the beginning of 
the script and giving the file an executable mode. The "#!" must be the 
first two characters of the file. On some platforms, this first line must 
end with a Unix-style line ending ("\n"), not a Mac OS ("\r") or Windows 
("\r\n") line ending. Note that the hash, or pound, character, "#", is used 
to start a comment in Python.

The script can be given an executable mode, or permission, using the chmod 
command:


$ chmod +x myscript.py



Are there any guidelines (API'S) that gurantees that the python code will be 
platform independent? 





More information about the Python-list mailing list