<DIV>
<DIV>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 "
<H2>Zope Error</H2>
<P>Zope has encountered an error while publishing this resource.</P>
<P><STRONG>Error Type: IOError</STRONG><BR><STRONG>Error Value: [Errno 2] No such file or directory: 'chr1/CDS.htm'</STRONG>"</P>
<P>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.</P>
<P>Here is the code of the script make in Python</P>
<P><BR># -*- coding: cp1252 -*-<BR>""" Script realizado por Miguel Angel García Belandria """<BR>"""Debe ser guardado en el directorio /home/Zope/Extensions para 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</P>
<P> </P>
<P> </P>
<P> </P>
<P> </P>
<P> i=i+1</P>
<P><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</P>
<P> elif cont<3:<BR> giclean=giclean+" - "<BR> else:<BR>
giclean=giclean+"\n"<BR> cont=0</P>
<P> cont=cont+1<BR> while j <i+12:<BR> giclean=giclean+gi[j]<BR> j=j+1</P>
<P> </P>
<P> 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> </P></DIV></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>