|
8 | 8 | # Example: |
9 | 9 | # |
10 | 10 | # >>> from ftplib import FTP |
11 | | -# >>> ftp = FTP('ftp.cwi.nl') # connect to host, default port |
| 11 | +# >>> ftp = FTP('ftp.python.org') # connect to host, default port |
12 | 12 | # >>> ftp.login() # default, i.e.: user anonymous, passwd user@hostname |
13 | 13 | # >>> ftp.retrlines('LIST') # list directory contents |
14 | | -# total 43 |
15 | | -# d--x--x--x 2 root root 512 Jul 1 16:50 bin |
16 | | -# d--x--x--x 2 root root 512 Sep 16 1991 etc |
17 | | -# drwxr-xr-x 2 root ftp 10752 Sep 16 1991 lost+found |
18 | | -# drwxr-srwt 15 root ftp 10240 Nov 5 20:43 pub |
| 14 | +# total 9 |
| 15 | +# drwxr-xr-x 8 root wheel 1024 Jan 3 1994 . |
| 16 | +# drwxr-xr-x 8 root wheel 1024 Jan 3 1994 .. |
| 17 | +# drwxr-xr-x 2 root wheel 1024 Jan 3 1994 bin |
| 18 | +# drwxr-xr-x 2 root wheel 1024 Jan 3 1994 etc |
| 19 | +# d-wxrwxr-x 2 ftp wheel 1024 Sep 5 13:43 incoming |
| 20 | +# drwxr-xr-x 2 root wheel 1024 Nov 17 1993 lib |
| 21 | +# drwxr-xr-x 6 1094 wheel 1024 Sep 13 19:07 pub |
| 22 | +# drwxr-xr-x 3 root wheel 1024 Jan 3 1994 usr |
| 23 | +# -rw-r--r-- 1 root root 312 Aug 1 1994 welcome.msg |
19 | 24 | # >>> ftp.quit() |
| 25 | +# >>> |
20 | 26 | # |
21 | 27 | # To download a file, use ftp.retrlines('RETR ' + filename), |
22 | 28 | # or ftp.retrbinary() with slightly different arguments. |
23 | 29 | # To upload a file, use ftp.storlines() or ftp.storbinary(), which have |
24 | | -# an open file as argument. |
| 30 | +# an open file as argument (see their definitions below for details). |
25 | 31 | # The download/upload functions first issue appropriate TYPE and PORT |
26 | 32 | # commands. |
27 | 33 |
|
|
55 | 61 | # All exceptions (hopefully) that may be raised here and that aren't |
56 | 62 | # (always) programming errors on our side |
57 | 63 | all_errors = (error_reply, error_temp, error_perm, error_proto, \ |
58 | | - socket.error, IOError) |
| 64 | + socket.error, IOError, EOFError) |
59 | 65 |
|
60 | 66 |
|
61 | 67 | # Line terminators (we always output CRLF, but accept any of CRLF, CR, LF) |
@@ -285,6 +291,7 @@ def retrlines(self, cmd, callback = None): |
285 | 291 | fp = conn.makefile('r') |
286 | 292 | while 1: |
287 | 293 | line = fp.readline() |
| 294 | + if self.debugging > 2: print '*retr*', `line` |
288 | 295 | if not line: |
289 | 296 | break |
290 | 297 | if line[-2:] == CRLF: |
|
0 commit comments