diff options
author | willmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f> | 2010-02-18 17:10:04 +0000 |
---|---|---|
committer | willmcgugan <willmcgugan@67cdc799-7952-0410-af00-57a81ceafa0f> | 2010-02-18 17:10:04 +0000 |
commit | 0a8a21cf1c2b617f5c3ae402b1c416de388db49e (patch) | |
tree | 68799a3bd4a43165b2fda198e36fc4cff41dee64 /fs/ftpfs.py | |
parent | a534d7d3b2f8b378fb13eaf8f92f77ce5a7fc3ef (diff) | |
download | pyfilesystem-git-0a8a21cf1c2b617f5c3ae402b1c416de388db49e.tar.gz |
Some fixes for Python2.5 compatibility
Diffstat (limited to 'fs/ftpfs.py')
-rw-r--r-- | fs/ftpfs.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/ftpfs.py b/fs/ftpfs.py index 1092e95..f4cd957 100644 --- a/fs/ftpfs.py +++ b/fs/ftpfs.py @@ -12,7 +12,15 @@ import fs from fs.base import * from fs.path import pathsplit -from ftplib import FTP, _GLOBAL_DEFAULT_TIMEOUT, error_perm, error_temp, error_proto, error_reply +from ftplib import FTP, error_perm, error_temp, error_proto, error_reply + +try: + from ftplib import _GLOBAL_DEFAULT_TIMEOUT + _FTPLIB_TIMEOUT = True +except ImportError: + _GLOBAL_DEFAULT_TIMEOUT = None + _FTPLIB_TIMEOUT = False + import threading from time import sleep import datetime @@ -882,7 +890,10 @@ class FTPFS(FS): def _open_ftp(self): try: ftp = FTP() - ftp.connect(self.host, self.port, self.timeout) + if _FTPLIB_TIMEOUT: + ftp.connect(self.host, self.port, self.timeout) + else: + ftp.connect(self.host, self.port) ftp.login(self.user, self.passwd, self.acct) except socket_error, e: raise RemoteConnectionError(str(e), details=e) |