[Zope] Problem with external methods in ZOPE

Miguel Garcia miguelgar at yahoo.com
Tue Sep 9 09:40:11 EDT 2003


Hi, I'm New with Zope, and I need to make a external method to open a file, search some things and return those values, I have the script already make in Python. When I run in Python it runs fine, but when I put it on the extension folder of Zope and added the external method in the Zope folder where I need to start the search, this returrn an error that say " Zope Error
Zope has encountered an error while publishing this resource.

Error Type: IOError
Error Value: [Errno 2] No such file or directory: 'chr1/CDS.htm'"

The external method is in a folder called database, inside that folder are 14 folders called chr1, chr2, chr3 etc..., and inside any folder is a DTML document called CDS.htm. Please help me with this because I don't know what's the problem.

Here is the code of the script make in Python


# -*- coding: cp1252 -*-
""" Script realizado por Miguel Angel García Belandria """
"""Debe ser guardado en el directorio /home/Zope/Extensions para posteriormente
   ser llamado como método externo de Zope"""
import sys,re
files=['chr1/CDS.htm','chr2/CDS.htm','chr3/CDS.htm']
def rifin():
        gi=giclean=""
        rifin=h=0
        for h in files:
                i=j=0
                file=open(h,"ra")
                print "Searching in file %s ..." % h
                texto=file.read()
                file.close
                """Buscar RIFIN"""
                while i < len(texto):
                    if texto[i]=="R" or texto[i]=="r":
                        if texto[i+1]=="I" or texto[i+1]=="i":
                            if texto[i+2]=="F" or texto[i+2]=="f":
                                if texto[i+3]=="I" or texto[i+3]=="i":
                                    if texto[i+4]=="N" or texto[i+4]=="n":
                                                rifin=rifin+1
                                                j=i-1
                                                while not(texto[j])==";":
                                                        gi=texto[j]+gi
                                                        j=j-1

 

 

 

 

                    i=i+1


        """Buscar los GI solamente"""
        cont=i=0
        while i < len(gi):
                if gi[i]=="g":
                        if gi[i+1]=="i":
                                j=i
                                if cont==0:
                                        giclean=giclean

                                elif cont<3:
                                        giclean=giclean+" - "
                                else:
                                        giclean=giclean+"\n"
                                        cont=0

                                cont=cont+1
                                while j <i+12:
                                        giclean=giclean+gi[j]
                                        j=j+1

 

                i=i+1
                    
        print "Se encontraron %d resultados compatibles con RIFIN" % rifin
        print giclean
        for h in files:
                print "|File: %s|" % h,
        
          





---------------------------------
Do You Yahoo!?
Todo lo que quieres saber de Estados Unidos, América Latina y el resto del Mundo.
Visíta Yahoo! Noticias.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.zope.org/pipermail/zope/attachments/20030909/a7382172/attachment.htm


More information about the Zope mailing list