<DIV>Hi when I run in Python a script it runs fine, but when I put it on the<BR>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 "<BR>Zope Error<BR>Zope has encountered an error while publishing this resource.<BR>Error Type: IOError<BR>Error Value: [Errno 2] No such file or directory: 'chr1/CDS.htm'"<BR>The external method is in a folder called database, inside that folder are<BR>14 folders called chr1, chr2, chr3 etc..., and inside any folder is a DTML<BR>document called CDS.htm. I already know the proble is something with the absolute path, but I don't know how I can pass this value to the external method, I really need to use those files from the ZODB because they are used to show it if somebody request it from a search in the Zcatalog.</DIV>
<DIV> Thanks to all.<BR>Here is the code of the script make in Python<BR><BR># -*- coding: cp1252 -*-<BR>""" Script realizado por Miguel Angel García Belandria """<BR>"""Debe ser guardado en el directorio /home/Zope/Extensions para<BR>posteriormente<BR> ser llamado como método externo de Zope"""<BR>import sys,re<BR>files=['chr1/CDS.htm','chr2/CDS.htm','chr3/CDS.htm']<BR>def rifin():<BR> gi=giclean=""<BR> rifin=h=0<BR> for h in files:<BR> i=j=0<BR> file=open(h,"ra")<BR> print "Searching in file %s ..." %
h<BR> texto=file.read()<BR> file.close<BR> """Buscar RIFIN"""<BR> while i < len(texto):<BR> if texto[i]=="R" or texto[i]=="r":<BR> if texto[i+1]=="I" or texto[i+1]=="i":<BR> if texto[i+2]=="F" or
texto[i+2]=="f":<BR> if texto[i+3]=="I" or texto[i+3]=="i":<BR> if texto[i+4]=="N" or texto[i+4]=="n":<BR>
rifin=rifin+1<BR> j=i-1<BR> while not(texto[j])==";":<BR>
gi=texto[j]+gi<BR> j=j-1<BR><BR><BR><BR><BR> i=i+1<BR><BR> """Buscar los GI solamente"""<BR> cont=i=0<BR> while i < len(gi):<BR> if gi[i]=="g":<BR> if
gi[i+1]=="i":<BR> j=i<BR> if cont==0:<BR> giclean=giclean<BR> elif
cont<3:<BR> giclean=giclean+" - "<BR> else:<BR> giclean=giclean+"\n"<BR>
cont=0<BR> cont=cont+1<BR> while j <i+12:<BR> giclean=giclean+gi[j]<BR>
j=j+1<BR><BR> i=i+1<BR><BR> print "Se encontraron %d resultados compatibles con RIFIN" % rifin<BR> print giclean<BR> for h in files:<BR> print "|File: %s|" % h,<BR><BR></DIV><p><br><hr size=1 noshade><b>Do You Yahoo!?</b><br>
<a href=http://espanol.yahoo.com/mail_tagline/*http://espanol.news.yahoo.com><img src="http://us.i1.yimg.com/us.yimg.com/i/not/dailynews.gif" width=30 height=26 border=0 align=left></a>
Todo lo que quieres saber de Estados Unidos, América Latina y el resto del Mundo.<br>
Visíta <a href=http://espanol.yahoo.com/mail_tagline/*http://espanol.news.yahoo.com>Yahoo! Noticias</a>.<br>