"Alvin A. Delagon" <[EMAIL PROTECTED]> writes:

> I'm writing a simple python code that will upload files onto a ftp 
> server. Everything's fine and working great except that the script I 
> wrote don't know is an upload is successful or not. Is there a way to 
> obtain the ftp status codes with this module? Thanks in advance!

forgot to mention that the urllib2 example I posted is for Python 2.4
-- won't work with 2.3.

For 2.3, 2.2, and 2.1, you have to do:

import urllib2

try:
    response = urllib2.urlopen("http://www.reportlab.com/blarney";)
except urllib2.HTTPError, e:
    print e.code
else:
    print 200


urllib2 in 2.0 is a bit broken, IIRC.


John

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to