Skip to content

Commit

Permalink
fix ftp
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Nov 22, 2016
1 parent f68aa26 commit d4ebc7d
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions fs/ftpfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,12 @@ def __init__(self, ftpfs, path, mode):
self._socket = None
self.closed = False


if 'a' in mode:
self.pos = self.fs.getsize(self.path)
try:
self.pos = self.fs.getsize(self.path)
except errors.ResourceNotFound:
self.pos = 0

def __repr__(self):
_repr = "FTPFile({!r}, {!r}, {!r})"
Expand Down Expand Up @@ -642,25 +646,6 @@ def close(self):
super(FTPFS, self).close()


# if __name__ == "__main__": # pragma: no cover
# ftp_fs = FTPFS('127.0.0.1', port=2121)
# print(ftp_fs.features)
# ftp_fs.openbin('new.txt', 'w').write(b'test')
# #print(list(ftp_fs.scandir('foobar')))
# ftp_fs.makedirs('/foo/baz', recreate=True)
# print(ftp_fs.isfile('test.txt'))
# print(ftp_fs.isdir('test.txt'))
# print(ftp_fs.isdir('foo'))
# print(ftp_fs.isfile('foo'))
# print(ftp_fs.isdir('nope'))
# print(ftp_fs.isfile('nope'))
# print(ftp_fs.getinfo('test.txt').raw)
# print(ftp_fs.getinfo('foo').raw)

# print(list(ftp_fs.scandir('/foo')))
# print(ftp_fs.listdir('/foo'))


if __name__ == "__main__":
fs = FTPFS('ftp.mirror.nl', 'anonymous', 'willmcgugan@gmail.com')
print(list(fs.scandir('/')))

0 comments on commit d4ebc7d

Please sign in to comment.