[ftputil] tell() method for FTPFile objects?

Justin Ezequiel justin.ezequiel at gmail.com
Sat Jan 29 10:41:57 MET 2005


Excellent module by the way.

I am trying to zip a few files from one FTP server to another and was
trying to do this using FTPFile objects and zipfile.ZipFile.
I was trying to get it done without having to download from the source
server to my local disk, then uploading to the target server.
However, I am getting the following error as the FTPFile object has no
tell() method.

Traceback (most recent call last):
  File "I:\Source\python\Springer\Heildelberg\IssueDelivery.py", line 199, in ?
    main(r'I:\Source\python\Springer\Heildelberg\files\381_21_2.txt', 0)
  File "I:\Source\python\Springer\Heildelberg\IssueDelivery.py", line 147, in ma
in
    targetbase, calculatepath(
  File "I:\Source\python\Springer\Heildelberg\IssueDelivery.py", line 186, in de
liverprint
    z.writestr(zinfo, source.read())
  File "E:\Python23\lib\zipfile.py", line 468, in writestr
    zinfo.header_offset = self.fp.tell()    # Start of header bytes
  File "E:\Python23\Lib\site-packages\ftputil\ftp_file.py", line 219, in __getat
tr__
    return getattr(self._fo, attr_name)
AttributeError: '_fileobject' object has no attribute 'tell'
Exception exceptions.AttributeError: "'_fileobject' object has no attribute 'tel
l'" in <bound method ZipFile.__del__ of <zipfile.ZipFile instance at 0x00944B98>
> ignored

Can this feature be added in the future or am do I just have a bug?

In the meantime, I'll be using a temporary local file.

Apologising if this is sent as HTML.
Cannot find option to explicitly send as Plain Text from walla.com.


More information about the ftputil mailing list