[Tutor] problems in a python script

Gregor Lingl glingl at aon.at
Tue Jul 29 08:35:12 EDT 2003


Mário Gamito schrieb:

> Hi,
>
> I've downloaded the 30 days trial version of editize and followed the 
> instructions in http://plone.org/Members/tlynch/HowToIntegrateEditize
> to install it.
>
> Everything runs smoothly  until the creation of munge.py as explained 
> in the above link. I get an error saying
>
>  " Script line 4
>     inputvalue = inputvalue.replace("\r", "")
>     ^
> SyntaxError: invalid syntax" 

This looks like if this line were indented some (three ?) blanks from 
the left margin.

In Python blanks (or "white space" in general) has syntactic meaning.
Therefore in a simple script a simple statement like this assignment
MUST NOT be indented.

Remove the indentation and things will work.

HTH, Gregor

>
> A curious thing is that when i save it, not only i get the above 
> error, but also the lines begining with double cardinal (##) are gone!!!
>
> Also the text refers to "Note: you might need to edit the line calling 
> munge in wysiwyg_support to reflect the name of your folder where all 
> the Editize stuff is stored."
>
> Where is this is done ?
>
> Thank you in advance for your time and patience.
>
> Warm Regards,
> Mário Gamito
>
>
>
>
> munge.py
> -----------------------------------------------------
> ## Script (Python) "munge"
>    ##bind container=container
>    ##bind context=context
>    ##bind namespace=
>    ##bind script=script
>    ##bind subpath=traverse_subpath
>    ##parameters=inputvalue
>    ##title=
>
>    # to guard against files that might contain only
>    # returns or linefeeds, we will delete each separately
>    # rather than trying: replace("\r\n", "")
>    inputvalue = inputvalue.replace("\r", "")
>    inputvalue = inputvalue.replace("\n", "")
>    inputvalue = inputvalue.replace("'", "'")
>
>    return inputvalue
> ------------------------------------------------------------
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>









More information about the Python-list mailing list