[Pywikipedia-l] Question about the first two lines

Dr. Trigon dr.trigon at surfeu.ch
Wed Sep 22 19:57:06 UTC 2010


Inline answers...

Am 22.09.2010 10:07, schrieb Bináris:
> The first line of pywki moduls is:
> #!/usr/bin/python
> Elsewhere I see #! /usr/bin/env/python, and (as far as I remember) this
> is stated at docs.python.org <http://docs.python.org>, too. What is the
> difference? Forgive me this question, I am a Windows-user. Is it just a
> user habit, where do you put your Python? Is any of these more canonical?

Yes, it's a matter of where python is put. This may differ from distro
to distro (in windows even from version to version ;)). But is not that
critical since ofter there are additional (sym) links, e.g.
This comment can also be omitted completely, but then you will have to
use: python script.py
to run your script. It has more or less the same function, as assigning
an applictaion to a file type in windows. So you can omitt the 'python'
in the script call...

> The second line is usually:
> # -*- coding: utf-8  -*-
> Elsewhere I see
> #coding: utf-8
> Is there any difference?

Just a guess; I think important is to have 'coding: utf-8' since it is
put into a comment anyway ;) Personally I feel more comfortable with
the first version.

Greetings



More information about the Pywikipedia-l mailing list