Niall OConnor | 1 May 18:48
Picon

FTPOSError

I get this error with ftputil.  I thought it was because the version ( ftp2.6) was too great for python 2.5.2 so I installed ftp2.5 .  I still had no luck.  Can you tell me waht might be wrong here?

Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ftputil
>>> pem_user = {'PEM_password': xxx', 'PEM_account_id': u'xx', 'domain_name': xxx, 'FTP_login': xxx', 'FTP_password': xxx', 'FTP_host_name': xxx, 'PEM_password_confirm': xxx', 'PEM_subscription_id': xxx', 'PEM_login_id': xxx', 'domain_id': 1}
>>> host = ftputil.FTPHost(pem_user['FTP_host_name'], pem_user['FTP_login'], pem_user['FTP_password'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-i686/egg/ftputil/ftputil.py", line 104, in __init__
  File "build/bdist.linux-i686/egg/ftputil/ftputil.py", line 158, in _make_session
  File "build/bdist.linux-i686/egg/ftputil/ftp_error.py", line 149, in _try_with_oserror
ftputil.ftp_error.FTPOSError: -2
Debugging info: ftputil 2.6, Python 2.5.2 (linux2)
>>> 
KeyboardInterrupt
>>> 
vivien:/home/www/sitebuilder.blacknight.ie/web# pip uninstall ftputil
Uninstalling ftputil:
  /usr/lib/python2.5/site-packages/ftputil-2.6-py2.5.egg
Proceed (y/n)? y
  Successfully uninstalled ftputil
vivien:/home/www/sitebuilder.blacknight.ie/web# python
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ftputil
>>> pem_user = {'PEM_password': xxx', 'PEM_account_id': u'xx', 'domain_name': xxx, 'FTP_login': xxx', 'FTP_password': xxx', 'FTP_host_name': xxx, 'PEM_password_confirm': xxx', 'PEM_subscription_id': xxx', 'PEM_login_id': xxx', 'domain_id': 1}
>>> host = ftputil.FTPHost(pem_user['FTP_host_name'], pem_user['FTP_login'], pem_user['FTP_password'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.5/site-packages/ftputil/ftputil.py", line 103, in __init__
    self._session = self._make_session()
  File "/usr/lib/python2.5/site-packages/ftputil/ftputil.py", line 157, in _make_session
    return ftp_error._try_with_oserror(factory, *args, **kwargs)
  File "/usr/lib/python2.5/site-packages/ftputil/ftp_error.py", line 149, in _try_with_oserror
    raise FTPOSError(*exc.args)
ftputil.ftp_error.FTPOSError: -2
Debugging info: ftputil 2.5, Python 2.5.2 (linux2)
>>> 

_______________________________________________
ftputil mailing list
ftputil@...
http://codespeak.net/mailman/listinfo/ftputil
Stefan Schwarzer | 1 May 20:34

Re: FTPOSError

Hi Niall,

On 2011-05-01 18:48, Niall OConnor wrote:
> I get this error with ftputil.  I thought it was because the version (
> ftp2.6) was too great for python 2.5.2 so I installed ftp2.5 .

ftputil 2.6 is supposed to work with Python 2.4 to 2.7, so
downgrading shouldn't be necessary.

> I still had
> no luck.  Can you tell me waht might be wrong here?
>
> Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
> [GCC 4.3.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import ftputil
>>>> pem_user = {'PEM_password': xxx', 'PEM_account_id': u'xx',
> 'domain_name': xxx, 'FTP_login': xxx', 'FTP_password': xxx',
> 'FTP_host_name': xxx, 'PEM_password_confirm': xxx', 'PEM_subscription_id':
> xxx', 'PEM_login_id': xxx', 'domain_id': 1}
>>>> host = ftputil.FTPHost(pem_user['FTP_host_name'], pem_user['FTP_login'],
> pem_user['FTP_password'])
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "build/bdist.linux-i686/egg/ftputil/ftputil.py", line 104, in
> __init__
>   File "build/bdist.linux-i686/egg/ftputil/ftputil.py", line 158, in
> _make_session
>   File "build/bdist.linux-i686/egg/ftputil/ftp_error.py", line 149, in
> _try_with_oserror
> ftputil.ftp_error.FTPOSError: -2
> Debugging info: ftputil 2.6, Python 2.5.2 (linux2)

I can't exactly tell you what's wrong, but at least the
traceback shows that an error occurs when instantiating the
session instance (in this case an instance of ftplib.FTP)
and that the exception raised by ftplib.FTP is neither an
ftplib.error_temp nor an ftplib.error_perm. (These
exceptions are described at
http://docs.python.org/library/ftplib.html#ftplib.error_reply ).

The exception handling in ftp_error in line 147 catches
ftplib.all_errors which, according to the ftplib
documentation, consists of error_reply, error_temp,
error_perm, error_proto, socket.error and IOError.
error_temp and error_perm are handled in lines 139-146 of
ftp_error.py, so the actual exception raised by ftplib.FTP
is one of error_reply, error_proto, socket.error and
IOError.

Could you please do the following:

- Use the ftputil.FTPHost constructor as above but with the
  literal values instead of getting the values from the
  dictionary with pem_user['FTP_host_name'] etc. Do you get
  the same traceback?

- If yes, try to instantiate an ftplib.FTP object with the
  same data you use for logging in with ftputil.FTPHost
  (also with the literal values). If you get an exception,
  please post the traceback you get.

Stefan

Gmane