[Zope] Parsing a file through a Python script

Fernando Martins fernando at cmartins.demon.nl
Sun Nov 30 13:20:57 EST 2003


Pierre Godefroy wrote:
> I am trying to parse a file with a Python script (the file is stored in
> the same folder as the script) :
> "marco" is the id of the file :
>
> data=str(container.marco)
> i=0
> for line in data.readlines():
> .....
>
> I get a readlines : attribute error
>
> Could anyone help me?
>

Python scripts are very limited (by design) regarding available functions
and modules. Check the Zope book 2.6 (sorry don't remember which section).

The recomended solution is to use External methods (if you have access to
the zope instalation). Quite simple: create a .py file with your functions
in the folder External and the link to the function you want from the zope
ZMI. Then you can use this (external) function as any other zope available
function.

Regards,
Fernando




More information about the Zope mailing list