publicfile's ftpd and urllib2

mw at mw at
Tue Mar 16 22:09:37 CET 2004


I get an error when trying to use urllib2 with the ftp daemon of

$ python
Python 2.2.3 (#1, Oct 15 2003, 23:33:35) 
[GCC 3.3.1 20030930 (Red Hat Linux 3.3.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ftplib
>>> ftplib.FTP.debugging = 1
>>> import urllib2
>>> urllib2.urlopen("")
*resp* '220 Features: a p .'
*cmd* 'USER anonymous'
*resp* "230 Hi. No need to log in; I'm an anonymous ftp server."
*cmd* 'CWD pub'
*resp* '250 "/pub" '
*cmd* 'CWD fedora'
*resp* '250 "/pub/fedora" '
*cmd* 'CWD linux'
*resp* '250 "/pub/fedora/linux" '
*cmd* 'CWD core'
*resp* '250 "/pub/fedora/linux/core" '
*cmd* 'CWD 1'
*resp* '250 "/pub/fedora/linux/core/1" '
*cmd* 'CWD i386'
*resp* '250 "/pub/fedora/linux/core/1/i386" '
*cmd* 'CWD os'
*resp* '250 "/pub/fedora/linux/core/1/i386/os" '
*cmd* 'CWD headers'
*resp* '250 "/pub/fedora/linux/core/1/i386/os/headers" '
*cmd* 'TYPE I'
*resp* '200 Okay, using binary.'
*cmd* 'TYPE A'
*resp* '200 Why are you using ASCII?'
*cmd* 'PASV'
*resp* '227 =141,225,11,87,234,114'
*cmd* 'NLST'
*resp* '150 Waiting for transfer connection...'
*resp* '426 Transmission failure: not a directory'
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.2/", line 138, in urlopen
    return, data)
  File "/usr/lib/python2.2/", line 328, in open
    '_open', req)
  File "/usr/lib/python2.2/", line 307, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.2/", line 971, in ftp_open
    fp, retrlen = fw.retrfile(file, type)
  File "/usr/lib/python2.2/", line 734, in retrfile
  File "/usr/lib/python2.2/", line 449, in nlst
    self.retrlines(cmd, files.append)
  File "/usr/lib/python2.2/", line 411, in retrlines
    return self.voidresp()
  File "/usr/lib/python2.2/", line 222, in voidresp
    resp = self.getresp()
  File "/usr/lib/python2.2/", line 213, in getresp
    raise error_temp, resp
IOError: [Errno ftp error] 426 Transmission failure: not a directory

Thx for any info,

Mate Wierdl | Dept. of Math. Sciences | University of Memphis  
Please avoid sending me Word or PowerPoint attachments.

More information about the Python-list mailing list