Re: urllib.urlretireve problem

2005-03-31 Thread Ritesh Raj Sarraf
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Diez B. Roggisch wrote: > You could for instance try and see what kind of result you got using the > unix file command - it will tell you that you received a html file, not a > deb. > > Or check the mimetype returned - its text/html in the error case

Re: urllib.urlretireve problem

2005-03-31 Thread Wade
Diez B. Roggisch wrote: > It makes no sense having urllib generating exceptions for such a case. From > its point of view, things work pefectly - it got a result. No network error > or whatsoever. > > Its your application that is not happy with the result - but it has to > figure that out by itsel

Re: urllib.urlretireve problem

2005-03-30 Thread gene . tani
.from urllib2 import urlopen . try: . urlopen(someURL) . except IOError, errobj: .if hasattr(errobj, 'reason'): print 'server doesnt exist, is down, DNS prob, or we don't have internet connect' .if hasattr(errobj, 'code'): print errobj.code -- http://mail.python.org/mailma

Re: urllib.urlretireve problem

2005-03-30 Thread Skip Montanaro
>> For example, for Temporary Name Resolution Failure, python raises an >> exception which I've handled well. The problem lies with obsolete >> urls where no exception is raised and I end up having a 404 error >> page as my data. Diez> It makes no sense having urllib generatin

Re: urllib.urlretireve problem

2005-03-30 Thread Diez B. Roggisch
> I'm coding a program for offline package management. > The link that I provided could be obsolete by newer packages. That is > where my problem is. I wanted to know how to raise an exception here so > that depending on the type of exception I could make my program function. > > For example, for

Re: urllib.urlretireve problem

2005-03-30 Thread Ritesh Raj Sarraf
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Larry Bates wrote: > I noticed you hadn't gotten a reply.  When I execute this it put's the > following in the retrieved file: > > > > 404 Not Found > > Not Found > The requested URL /pool/updates/main/p/perl/libparl5.6_5.6.1-8.9_i386.deb > was no

Re: urllib.urlretireve problem

2005-03-29 Thread gene . tani
Mertz' "Text Processing in Python" book had a good discussion about trapping 403 and 404's. http://gnosis.cx/TPiP/ Larry Bates wrote: > I noticed you hadn't gotten a reply. When I execute this it put's the following > in the retrieved file: > > > > 404 Not Found > > Not Found > The requested

Re: urllib.urlretireve problem

2005-03-29 Thread Larry Bates
I noticed you hadn't gotten a reply. When I execute this it put's the following in the retrieved file: 404 Not Found Not Found The requested URL /pool/updates/main/p/perl/libparl5.6_5.6.1-8.9_i386.deb was no t found on this server. You will probably need to use something else to first determ

urllib.urlretireve problem

2005-03-26 Thread Ritesh Raj Sarraf
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello Everybody, I've got a small problem with urlretrieve. Even passing a bad url to urlretrieve doesn't raise an exception. Or does it? If Yes, What exception is it ? And how do I use it in my program ? I've searched a lot but haven't found anythi