Pywikipediabot: Difference between revisions
wikademia>Millosh |
wikademia>Millosh |
||
| Line 106: | Line 106: | ||
#!/usr/bin/python | #!/usr/bin/python | ||
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||
</source> | |||
However, we will use Python interpreter for examples, invoked by simple typing "python". Interpreter doesn't require first two lines, but scripts written into a file have to have the first line and should have the second line. | |||
If you are writing examples into the file and you want to execute it, you should choose one of two approaches: | |||
* You may give to your file executable mode (you need to do that only once!): | |||
<source lang="bash"> | |||
$ chmod +x mybot.py | |||
</source> | |||
... after which you would be able to execute your script directly: | |||
<source lang="bash"> | |||
$ ./mybot.py | |||
</source> | |||
* Or you may invoke scripts by typing "python" before them: | |||
<source lang="bash"> | |||
$ python mybot.py | |||
</source> | </source> | ||