Re: [Zope] external method with import tarfile
Hi there! I managed to find the problem and the solution. First, I've forgot to mention that in my script, oname is an uploaded file. I just inserted a f.close() and voilá! def upload_external(self,file,REQUEST): import os,tarfile ... f=open(oname,wb) f.write(file.read()) f.close() ... tar = tarfile.open(oname,r:gz) for itar in tar: tar.extract(itar.name,jobdir) return Done Cheers, Alan On 18/07/06, Alan [EMAIL PROTECTED] wrote: Thanks for your reply. Yes, my script works and my file are not broken. I am using mac osx tiger 10.4.7, zope 2.9.3 and python 2.4.2. Cheers, Alan On 18/07/06, Andreas Jung [EMAIL PROTECTED] wrote: --On 18. Juli 2006 16:12:18 +0100 Alan [EMAIL PROTECTED] wrote: Error Type: IOError Error Value: CRC check failed This is unlikely a Zope issue. Either your tar file is broken or the tarfile module is broken. Check if your code runs without Zope as a simple PythonScript..there is nothing about Zope involved in your issue. -aj -- Alan Wilter S. da Silva, D.Sc. - Research Associate Department of Biochemistry, University of Cambridge. 80 Tennis Court Road, Cambridge CB2 1GA, UK. http://www.bio.cam.ac.uk/~awd28 -- Alan Wilter S. da Silva, D.Sc. - Research Associate Department of Biochemistry, University of Cambridge. 80 Tennis Court Road, Cambridge CB2 1GA, UK. http://www.bio.cam.ac.uk/~awd28 ___ 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 )
Re: [Zope] external method with import tarfile
Alan wrote: Hi there! I managed to find the problem and the solution. First, I've forgot to mention that in my script, oname is an uploaded file. I just inserted a f.close() and voilá! def upload_external(self,file,REQUEST): import os,tarfile ... f=open(oname,wb) f.write(file.read()) f.close() ... tar = tarfile.open(oname,r:gz) for itar in tar: tar.extract(itar.name,jobdir) return Done Err. why not tar=tarfile.open(fileobj=file) ? Why bother with potentially name clashing files in filesystem? Regards Tino ___ 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 )
[Zope] external method with import tarfile
Hi! I am trying to run a external python script. Now I am facing a problem that occurs only when I run the script via Zope. ... import os,tarfile ... tar = tarfile.open(oname,r:gz) for itar in tar: tar.extract(itar.name,jobdir) gives me: Site Error An error was encountered while publishing this resource. Error Type: IOError Error Value: CRC check failed If I comment the for loop my scripts finish well, but then it does not uncompress the file. Please, any help would very appreciated. Many thanks in advance, Cheers, Alan -- Alan Wilter S. da Silva, D.Sc. - Research Associate Department of Biochemistry, University of Cambridge. 80 Tennis Court Road, Cambridge CB2 1GA, UK. http://www.bio.cam.ac.uk/~awd28 ___ 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 )
Re: [Zope] external method with import tarfile
--On 18. Juli 2006 16:12:18 +0100 Alan [EMAIL PROTECTED] wrote: Error Type: IOError Error Value: CRC check failed This is unlikely a Zope issue. Either your tar file is broken or the tarfile module is broken. Check if your code runs without Zope as a simple PythonScript..there is nothing about Zope involved in your issue. -aj pgp0ncqn4RhT4.pgp Description: PGP signature ___ 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 )