summaryrefslogtreecommitdiffstats
path: root/Lib/ftplib.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-06-01 13:21:04 (GMT)
committerGuido van Rossum <guido@python.org>1993-06-01 13:21:04 (GMT)
commit17ed1ae163f1ca6138dead19eb327f468f9995a7 (patch)
treef138c1f243560869356c3bd763b9bd05d7137f23 /Lib/ftplib.py
parentf3f753132a863e4b6f39e749e7e5e7ab4cd6d7a1 (diff)
downloadcpython-17ed1ae163f1ca6138dead19eb327f468f9995a7.zip
cpython-17ed1ae163f1ca6138dead19eb327f468f9995a7.tar.gz
cpython-17ed1ae163f1ca6138dead19eb327f468f9995a7.tar.bz2
* toaiff.py: import whatsound instead of sndhdr
* sndhdr.py: renamed to whatsound.py; use new aifc module for AIFF/AIFC * ftplib.py: added close() (closes without sending QUIT command) * aifc.py: documented close()
Diffstat (limited to 'Lib/ftplib.py')
-rw-r--r--Lib/ftplib.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index cc96a34..c886f82 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -57,10 +57,6 @@ all_errors = (error_reply, error_temp, error_perm, error_proto, \
CRLF = '\r\n'
-# Telnet special characters
-DM = chr(242) # Data Mark
-IP = chr(244) # Interrupt Process
-
# Next port to be used by makeport(), with PORT_OFFSET added
# (This is now only used when the python interpreter doesn't support
# the getsockname() method yet)
@@ -327,6 +323,12 @@ class FTP:
def cwd(self, dirname):
self.voidcmd('CWD ' + dirname)
+ # Retrieve the size of a file
+ def size(self, filename):
+ resp = self.sendcmd('SIZE ' + filename)
+ if resp[:3] == '213':
+ return string.atoi(string.strip(resp[3:]))
+
# Make a directory, return its full pathname
def mkd(self, dirname):
resp = self.sendcmd('MKD ' + dirname)
@@ -340,6 +342,10 @@ class FTP:
# Quit, and close the connection
def quit(self):
self.voidcmd('QUIT')
+ self.close()
+
+ # Close the connection without assuming anything about it
+ def close(self):
self.file.close()
self.sock.close()
del self.file, self.sock