Re: noob question How do I run a Python script.



CarlP a écrit :
How do I run a Python script.

usually, it's:

$ python /path/to/somescript.py arg1 argN

on a command line prompt.

I have one that gmail loader needs to
run on my email box. Here's the script

http://www.marklyon.org/gmail/cleanmbox.py

I can't seem to find what I need to run it. I installed python, run
the interpreter and the script , but all it will do is say invalid
syntax.

Am I right if I guess you did something like :

bruno@bibi ~ $ python
Python 2.4.3 (#1, Mar 12 2007, 23:32:01)
[GCC 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> cleanmbox.py testmbox
File "<stdin>", line 1
cleanmbox.py testmbox
^
SyntaxError: invalid syntax
>>>

?-)


FWIW, I ran the script (the correct way) on a copy of a mozilla mbox dir, and it seemed to work.
.



Relevant Pages

  • Re: [1/5] 2.6.21-rc4: known regressions (v2)
    ... this syntax error when python tries to parse the script: ... SyntaxError: invalid syntax ... The reporter's client and server code seem to be C, ... they should be Python, I guess they're not the correct ones anyway. ...
    (Linux-Kernel)
  • Re: Newbie edit/compile/run cycle question
    ... syntax check a saved python ... script without running it? ... syntax check, and if it passes, moves on the next ...
    (comp.lang.python)
  • Re: Unification of Methods and Functions
    ... >would have the greatest concentration of unbound method use (my reasoning was ... staticmethod syntax is relatively new, and there is a long tradition ... in Python of using various alternatives to static methods. ...
    (comp.lang.python)
  • Re: function definition syntax
    ... :> In which case it might as well be a separate script - you don't need a function. ... :>: That's much more reliable than having to remember which syntax ... Always using POSIX ... :> not overlook restoring IFS. ...
    (comp.unix.shell)
  • Re: Unification of Methods and Functions
    ... Moving them outside the ... inside and add the 'staticmethod' wrapper. ... and clients, who don't have time to get proficient in Python, and only ... That is one benefit of the proposed syntax. ...
    (comp.lang.python)