[ZPT] External Method IOError problem ... is this wrong to do?

waltonl waltonl@franklin.edu
Wed, 08 Aug 2001 22:08:45 -0400


I have an external method that get's called in my main zpt in which I
use a  multiline string (enclosed in """'s) as a global variable and
then I parse it line by line using
StringIO - so the jist of the file contents and it's usage is something
like this:
---------------
global mainMenu = """
lot's of lines of content.in here........
that get parsed using StringIO
.........
etc
"""

def buildMainMenu()
    global mainMenu
    menuTree = build3LevelMenuTree(mainMenu)
    ...
    etc

def build3LevelMenuTree(menuStr):
    menuTree = []
    menufile = StringIO.StringIO(menuStr)
    for line in menufile.readlines():
          .... do some stuff in here that based on value of line appends
different things to menuTree list
   menufile.close()
    return menuTree
--------------------------------
This external method is called from a

Problem is that I'm experiencing an intermittent problem of getting Zope
has encountered an error while publishing this resource.
               Error Type: IOError
               Error Value: [Errno 5] I/O error

This is happening even when I'm the only one developing and testing so
it doesn't seem like it would be a multithreaded/synchronization
issue???

Have I done something wrong in coding it this way? Should I be able to
do something like this?

Thanks,
Lynn