Platform independent code?

Matthieu Brucher matthieu.brucher at gmail.com
Sat Jun 14 09:54:24 EDT 2008


Hi,

Python is a platform independent language, period. You can always
excute a Python script with python script.py. Now, with Windows, you
can execute the script by doucle-clicking on it. With Linux, it's
different, you have to use the shebang line to execute a script with
the correct interpreter. But this has nothing to do with the fact that
Python is a platform independent language.
Some modules may not be available on all platform, for the answer to
this question, see the documentation of the module ;)

Matthieu

2008/6/14 saneman <asd at ad.com>:
> 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?
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
French PhD student
Website : http://matthieu-brucher.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher



More information about the Python-list mailing list