Pierre, The file "marco" is, presumably, a Zope ZOOB file. Your variable data is a string containing that files content. You can split it into lines using lines = data.split('\n') and then iterate through the lines. On Sun, 30 Nov 2003, Fernando Martins wrote:
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
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )