Re: URLError:

2022-02-12 Thread Gisle Vanem

Shaozhong SHI wrote:


The following is used in a loop to get response code for each url.

print (urllib.request.urlopen(url).getcode())

However, error message says: URLError: 

11001 == WSAHOST_NOT_FOUND.

Look in any 'winsock.h' header:
  #define WSAHOST_NOT_FOUND (WSABASEERR+1001)

--
--gv
--
https://mail.python.org/mailman/listinfo/python-list


Re: URLError:

2022-02-12 Thread Chris Angelico
On Sun, 13 Feb 2022 at 07:17, Shaozhong SHI  wrote:
>
> The following is used in a loop to get response code for each url.
>
> print (urllib.request.urlopen(url).getcode())
>
> However, error message says: URLError:  getaddrinfo failed>
>
> Python 3.6.5 is being used to test whether url is live or not.
>
> Can anyone shed light on this?
>

What that's saying is that it couldn't look up the domain name to get
the corresponding address. Most likely, that means you either don't
have DNS available, or the DNS server said that it couldn't find that
server. (Whether that's true or not. It's always possible for the DNS
server to be wrong.) So, if you can fairly safely assume that you have
a fully-functioning internet connection (for instance, if other URLs
can be fetched successfully), the most reasonable interpretation of
this is that the URL is, in some way, broken.

I suspect that errno 11001 is a Winsock error, in which case it would
mean "Host not found". On my Linux system, I get a chained exception
that says "Name or service not found". Most likely, you can find this
information further up in the traceback.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: URLError:

2022-02-12 Thread Peter J. Holzer
On 2022-02-12 20:15:43 +, Shaozhong SHI wrote:
> The following is used in a loop to get response code for each url.
> 
> print (urllib.request.urlopen(url).getcode())
> 
> However, error message says: URLError:  getaddrinfo failed>
> 
> Python 3.6.5 is being used to test whether url is live or not.
> 
> Can anyone shed light on this?

getaddrinfo is the function that resolves a domain name into an IP
address. If that fails, either the domain name doesn't exist or you have
a problem with your DNS setup.

Things to test:

* Can you resolve the domain name to an address (try «nslookup» or
  «host» or «dig» depending on your OS)?
* Can you access the whole URL with a different tool like «wget» or
  «curl»?

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


URLError:

2022-02-12 Thread Shaozhong SHI
The following is used in a loop to get response code for each url.

print (urllib.request.urlopen(url).getcode())

However, error message says: URLError: 

Python 3.6.5 is being used to test whether url is live or not.

Can anyone shed light on this?

Regards,

David
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue16247] Report failing url in URLError?

2021-12-12 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

It is going to take a few weeks for me to get to my alerts, I will address
this as soon as I get to it .

Thanks for the triage, Irit.

On Mon, Dec 13, 2021, 12:31 AM Irit Katriel  wrote:

>
> Change by Irit Katriel :
>
>
> --
> status: open -> pending
>
> ___
> Python tracker 
> 
> ___
>

--
status: pending -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16247] Report failing url in URLError?

2021-12-12 Thread Irit Katriel


Change by Irit Katriel :


--
status: open -> pending

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16247] Report failing url in URLError?

2021-12-05 Thread Irit Katriel


Irit Katriel  added the comment:

Senthil, can this issue be closed now or is there something left to do?

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36866] Certificate verification errors in urllib.request become URLError

2021-04-17 Thread Christian Heimes


Change by Christian Heimes :


--
assignee: christian.heimes -> 
components:  -SSL
nosy:  -christian.heimes
versions: +Python 3.10 -Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36866] Certificate verification errors in urllib.request become URLError

2019-05-11 Thread Christian Heimes


Christian Heimes  added the comment:

Update: 3.6 and earlier raised SSLError for untrusted or expired certs. Only 
hostname mismatch was not wrapped into URLError.

--

___
Python tracker 
<https://bugs.python.org/issue36866>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36866] Certificate verification errors in urllib.request become URLError

2019-05-11 Thread Christian Heimes


Christian Heimes  added the comment:

Starting with 3.7, all OpenSSL and certificate-related exceptions are derived 
from SSLError. SSLError is a subclass of OSError. For backwards compatibility, 
SSLCertVerificationError is both a subclass of SSLError and ValueError.

>>> ssl.CertificateError

>>> ssl.CertificateError.__mro__
(, , , , , , 
)

The new behavior is more consistent than the previous. Now all SSL handshake 
errors are wrapped in URLError. In 3.6 and earlier unsupported TLS version, 
cipher suite mismatch, and similar were wrapped in URLError. Certificate 
related issues like untrusted cert, expired cert, hostname verification failure 
was not wrapped in URLError. You had to check error.reason for SSL-related 
errors any way.

I like to argue that the ssl module in 3.7 handles exceptions more consistently 
and is an improvement. The URLError behavior change is an unfortunate but 
reasonable side effect.

Ned, what do you think?

--

___
Python tracker 
<https://bugs.python.org/issue36866>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36866] Certificate verification errors in urllib.request become URLError

2019-05-09 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36866] Certificate verification errors in urllib.request become URLError

2019-05-09 Thread Ned Deily


Change by Ned Deily :


--
nosy: +ned.deily

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue36866] Certificate verification errors in urllib.request become URLError

2019-05-09 Thread Matt Martz


New submission from Matt Martz :

The behavior of how SSL certificate validation is handled was changed in 
https://bugs.python.org/issue31399

This introduced a new exception, ssl.SSLCertVerificationError, which is raised 
for any certificate validation error, instead of the previous exception 
ssl.CertificateError.

The primary difference here comes into play in urllib.request:

https://github.com/python/cpython/blob/da0847048aa7f934573fa449cea8643def056aa5/Lib/urllib/request.py#L1314-L1318

Previously ssl.CertificateError was not derived from OSError, it instead was 
derived from ValueError.

As such, as of Python3.7, ssl.SSLCertVerificationError is caught by the 
exception handling referenced above, as it is derived from OSError, and raised 
as a URLError, causing exception handling issues.  You must now introspect 
e.reason to determine if the exception was caused due to certificate 
verification or any other URLError, instead of simply catching separate 
exception types.

--
assignee: christian.heimes
components: Library (Lib), SSL
messages: 341985
nosy: christian.heimes, sivel, vstinner
priority: normal
severity: normal
status: open
title: Certificate verification errors in urllib.request become URLError
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue36866>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32586] urllib2 HOWTO URLError example minor error

2018-01-18 Thread MarmiteFox

MarmiteFox  added the comment:

Thanks for the fix and the tip about cross-checking in Python 3 - will remember 
that for the future.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32586] urllib2 HOWTO URLError example minor error

2018-01-18 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:

Thanks!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32586] urllib2 HOWTO URLError example minor error

2018-01-18 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:


New changeset 8ca036d4716fc86ff42474ba35d3cd32f0188a15 by Mariatta (Pablo 
Galindo) in branch '2.7':
bpo-32586: Fix code example in urllib2's doc  (GH-5238)
https://github.com/python/cpython/commit/8ca036d4716fc86ff42474ba35d3cd32f0188a15


--
nosy: +Mariatta

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32586] urllib2 HOWTO URLError example minor error

2018-01-18 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Thanks for reporting this issue. Indeed, this is an error in the documentation. 
Notice that this is corrected in Python3 's version:

https://docs.python.org/3.6/howto/urllib2.html#handling-exceptions

I have prepared a Pull Request fixing this. Thanks!

--
nosy: +pablogsal
priority: normal -> low

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32586] urllib2 HOWTO URLError example minor error

2018-01-18 Thread Pablo Galindo Salgado

Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +5084
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32586] urllib2 HOWTO URLError example minor error

2018-01-17 Thread Tim Morris

New submission from Tim Morris <timo...@morrises.org.uk>:

In the HOWTO for urllib2 for Python 2, in the Handling Exceptions section, it 
discusses the URLError exception being raised by urlopen() 
(https://docs.python.org/2/howto/urllib2.html#urlerror). The code snippet 
example for this has (I think) a minor error:
the 3rd line reads:
"except URLError as e:"
which I think should be:
"except urllib2.URLError as e:"

The code as given only works if urllib2 had been imported via:
"from urllib2 import *"
The snippet doesn't list the import statements but all the other examples just 
use "import urllib2" (and obviously "from x import *" is bad practice anyway 
and wouldn't be encouraged or expected).

I am relatively new to Python, so it's possible it *is* correct and I just 
implemented it incorrectly. But if not, it would be helpful to correct it (even 
though it's a very minor error) so that other newbies like me don't come 
unstuck when using the tutorial.

--
assignee: docs@python
components: Documentation
messages: 310201
nosy: MarmiteFox, docs@python
priority: normal
severity: normal
status: open
title: urllib2 HOWTO URLError example minor error
versions: Python 2.7

___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32586>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19057] Sometimes urllib2 raises URLError when trying POST with httpS

2016-09-08 Thread Christian Heimes

Christian Heimes added the comment:

I'm closing this ticket. It's old and hasn't seen any activity in almost three 
years.

--
nosy: +christian.heimes
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22797] urllib.request.urlopen documentation falsely guarantees that a URLError will be raised on errors

2016-06-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2d69d0419879 by Martin Panter in branch 'default':
Issue #22797: Synchronize urlopen() doc string with RST documentation
https://hg.python.org/cpython/rev/2d69d0419879

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22797] urllib.request.urlopen documentation falsely guarantees that a URLError will be raised on errors

2016-06-03 Thread R. David Murray

R. David Murray added the comment:

Thanks, Alexander.

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
versions: +Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22797] urllib.request.urlopen documentation falsely guarantees that a URLError will be raised on errors

2016-06-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b4df20312b78 by R David Murray in branch 'default':
Clean up urlopen doc string.
https://hg.python.org/cpython/rev/b4df20312b78

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22797] urllib.request.urlopen documentation falsely guarantees that a URLError will be raised on errors

2016-06-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8b6b6add8e47 by R David Murray in branch 'default':
psuedo merge: #22797: clarify when URLErrors are raised by urlopen.
https://hg.python.org/cpython/rev/8b6b6add8e47

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22797] urllib.request.urlopen documentation falsely guarantees that a URLError will be raised on errors

2016-06-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset aed4b9981fca by R David Murray in branch '3.5':
#22797: clarify when URLErrors are raised by urlopen.
https://hg.python.org/cpython/rev/aed4b9981fca

New changeset d085b4f779af by R David Murray in branch '3.5':
Merge: #22797: clarify when URLErrors are raised by urlopen.
https://hg.python.org/cpython/rev/d085b4f779af

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22797] urllib.request.urlopen documentation falsely guarantees that a URLError will be raised on errors

2016-06-02 Thread Alexander Liu

Alexander Liu added the comment:

Fixed the docs to specifically note that only protocol related errors raise the 
UrlError exception.

--
nosy: +alex_thebear
versions: +Python 3.6 -Python 3.4
Added file: http://bugs.python.org/file43131/urlopen_doc.patch

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22797>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22797] urllib.request.urlopen documentation falsely guarantees that a URLError will be raised on errors

2014-11-04 Thread Joshua Chin

New submission from Joshua Chin:

The documentation for urlopen states that it Raises URLError on errors. 
However, urlopen can raise a ValueError. In fact, test_urllib. 
urlopen_FileTests.test_relativelocalfile  specifically checks if urlopen raises 
a ValueError. I suggest removing the guarantee from the documentation.

--
assignee: docs@python
components: Documentation
files: urlopen_doc.patch
keywords: patch
messages: 230640
nosy: Joshua.Chin, docs@python, orsenthil
priority: normal
severity: normal
status: open
title: urllib.request.urlopen documentation falsely guarantees that a URLError 
will be raised on errors
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file37129/urlopen_doc.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22797
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22797] urllib.request.urlopen documentation falsely guarantees that a URLError will be raised on errors

2014-11-04 Thread R. David Murray

R. David Murray added the comment:

This is a general principle in Python.  A module may raise specific errors, but 
there are always other errors that may be raised.  The wording could be 
clarified, but it should not be removed.

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22797
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22797] urllib.request.urlopen documentation falsely guarantees that a URLError will be raised on errors

2014-11-04 Thread Joshua Chin

Changes by Joshua Chin joshuarc...@gmail.com:


Added file: http://bugs.python.org/file37131/urlopen_doc.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22797
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22797] urllib.request.urlopen documentation falsely guarantees that a URLError will be raised on errors

2014-11-04 Thread R. David Murray

R. David Murray added the comment:

(Looking at your new patch...thanks for giving it a try even though I wasn't 
clear).

There are lots of other errors it can raise, too.  I was thinking more along 
the lines of raises URLError on http protocol errors.  The problem is that's 
not completely accurate, either, but I don't remember exactly when it is that 
HTTPError can leak through.

Just for reference, in my code that calls urlopen and needs to keep running it 
if can't access the URL no matter what the (network-derived) reason, I catch 
ConnectionError, HTTPError, URLError, and IncompleteRead.  

We do not document all possible exceptions.  We document those that are 
specific to the module in question (which is URLError in this case) or that are 
part of the documented API (such as mentioning TimeoutError as what happens if 
the timeout specified by a timeout keyword is exceeded).

ValueErrors are a general class of errors that, when encountered, usually mean 
you need to fix your code (or, in the case of the SSL one you mention, check 
for SSL support at startup, assuming I understood correctly), rather than 
something you would catch around the urlopen call in a typical program.  There 
are, of course, occasions when you *do* catch ValueErrors in specific bits of 
code, but there is no practical way we can document all of the reasons 
ValueError might get raised, so we don't try.

All of that said, it would be lovely to have a reference somewhere (maybe a 
tutorial?) that went over all the possible exceptions one might get while using 
various network libraries, and why they might arise.  It is an issue that comes 
from the fact that the libraries are built on top of each other and the general 
python technique is that lower level errors are allowed to bubble up.  It would 
be a beast to keep up to date, though, which is probably one reason we don't 
have one.  But even that kind of guide wouldn't include ValueErrors.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22797
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11220] Sometimes library raises URLError when trying POST with httpS

2013-09-20 Thread mrDoctorWho0 .

mrDoctorWho0 . added the comment:

Trying to use POST-request to https://vk.com and sometimes library raise an 
error.
  File library/vkApi.py, line 31, in post
response = self.Opener.open(request)
  File /usr/lib/python2.7/urllib2.py, line 404, in open
response = self._open(req, data)
  File /usr/lib/python2.7/urllib2.py, line 422, in _open
'_open', req)
  File /usr/lib/python2.7/urllib2.py, line 382, in _call_chain
result = func(*args)
  File /usr/lib/python2.7/urllib2.py, line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)
  File /usr/lib/python2.7/urllib2.py, line 1184, in do_open
raise URLError(err)
URLError: urlopen error _ssl.c:489: The handshake operation timed out

--
components: +Library (Lib) -None
nosy: +mrDoctorWho0..
title: https sslv3 error 14077417: illegal parameter - Sometimes library 
raises URLError when trying POST with httpS
versions: +Python 2.7 -Python 2.6, Python 3.1
Added file: http://bugs.python.org/file31824/code.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11220
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11220] Sometimes library raises URLError when trying POST with httpS

2013-09-20 Thread mrDoctorWho0 .

mrDoctorWho0 . added the comment:

oops! wrong place!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11220
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11220] Sometimes library raises URLError when trying POST with httpS

2013-09-20 Thread mrDoctorWho0 .

Changes by mrDoctorWho0 . mrdoctor...@gmail.com:


Removed file: http://bugs.python.org/file31824/code.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11220
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19057] Sometimes urllib2 raises URLError when trying POST with httpS

2013-09-20 Thread mrDoctorWho0 .

New submission from mrDoctorWho0 .:

Trying to use POST-request to https://vk.com and sometimes library raise an 
error.
  File library/vkApi.py, line 31, in post
response = self.Opener.open(request)
  File /usr/lib/python2.7/urllib2.py, line 404, in open
response = self._open(req, data)
  File /usr/lib/python2.7/urllib2.py, line 422, in _open
'_open', req)
  File /usr/lib/python2.7/urllib2.py, line 382, in _call_chain
result = func(*args)
  File /usr/lib/python2.7/urllib2.py, line 1222, in https_open
return self.do_open(httplib.HTTPSConnection, req)
  File /usr/lib/python2.7/urllib2.py, line 1184, in do_open
raise URLError(err)
URLError: urlopen error _ssl.c:489: The handshake operation timed out

This exception appears randomly, connection is ok 100%. I tried it on different 
machines with python 2.7.4 and 2.7.3.

--
components: Library (Lib)
files: code.py
messages: 198141
nosy: mrDoctorWho0..
priority: normal
severity: normal
status: open
title: Sometimes urllib2 raises URLError when trying POST with httpS
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file31825/code.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19057
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19057] Sometimes urllib2 raises URLError when trying POST with httpS

2013-09-20 Thread R. David Murray

R. David Murray added the comment:

I would guess that if you did a network trace you'd find out there really was a 
packet that did not arrive (a timeout).  Note that detecting this is 
complicated by the fact that ssl is involved.  (I don't know the details, but I 
remember someone saying that more than one packet may be involved in something 
that looks like a single event at the OpenSSL level.)

It is certainly *possible* that there is a bug at the OpenSSL or (less likely) 
the _ssl module level, but the first step in debugging it would be to get that 
network trace, I think...

As I said, though, I'm not an expert in this area, perhaps someone who is will 
have other suggestions.

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19057
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16250] URLError invoked with reason as filename

2012-10-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5e71f2712076 by Senthil Kumaran in branch '3.2':
Issue #16250: Fix URLError invocation with proper args.
http://hg.python.org/cpython/rev/5e71f2712076

New changeset 30547e2cd04d by Senthil Kumaran in branch '3.3':
Issue #16250: Fix URLError invocation with proper args
http://hg.python.org/cpython/rev/30547e2cd04d

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16250] URLError invoked with reason as filename

2012-10-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3fb84c1da8c5 by Senthil Kumaran in branch '2.7':
Add some tests in 2.7 for Issue #16250
http://hg.python.org/cpython/rev/3fb84c1da8c5

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16250] URLError invoked with reason as filename

2012-10-27 Thread Senthil Kumaran

Senthil Kumaran added the comment:

This is fixed in all versions now.

--
assignee:  - orsenthil
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16300] Windows raises ValueError for file:///file/not/exists instead of URLError

2012-10-27 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Buildbot issues are taken care. They are green for while. Tests have been 
backported 3.3 and 3.2 as well.

3.2 5e71f2712076
3.3 30547e2cd04d

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-27 Thread Senthil Kumaran

Senthil Kumaran added the comment:

This has been backported.

3.2 5e71f2712076
3.3 30547e2cd04d

--
assignee:  - orsenthil
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10836
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-23 Thread Juho Vuori

Juho Vuori added the comment:

Should the bug be closed as it seems to be fixed now?

--
nosy: +juho

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10836
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-23 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Nope,  I have backport it to other versions. I shall close it then.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10836
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16300] Windows raises ValueError for file:///file/not/exists instead of URLError

2012-10-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 00e5e963b7d8 by Senthil Kumaran in branch 'default':
Fix issue16300: addressing the buildbot failures on windows
http://hg.python.org/cpython/rev/00e5e963b7d8

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16300] Windows raises ValueError for file:///file/not/exists instead of URLError

2012-10-22 Thread Senthil Kumaran

New submission from Senthil Kumaran:

From the Buildbot failure - 
http://buildbot.python.org/all/builders/x86%20XP-4%203.x/builds/7573/steps/test/logs/stdio

I remember that we restricted the access for file:// scheme to localhost only 
for Windows/Cygwin. In terms of exception raised it could either be consistent 
with other platforms and raise URLError or it could be for good reasons, the 
tests may need to be tweaked for windows.

--
assignee: orsenthil
keywords: easy
messages: 173522
nosy: orsenthil
priority: normal
severity: normal
status: open
title: Windows raises ValueError for file:///file/not/exists instead of URLError
type: behavior
versions: Python 3.2, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16300] Windows raises ValueError for file:///file/not/exists instead of URLError

2012-10-22 Thread Senthil Kumaran

Senthil Kumaran added the comment:

The problem is here:

if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/':
raise ValueError(file:// scheme is supported only on localhost)

On Unix like systems url[2:3] == '/', that is path starts with '/' and this 
ValueError is escaped.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16300] Windows raises ValueError for file:///file/not/exists instead of URLError

2012-10-22 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 49de26395d1a by Senthil Kumaran in branch 'default':
Issue #16301: Fix the localhost verification in urllib/request.py for file://. 
Modify tests to use localhost for local temp files, which could make Windows 
Buildbot (#16300) happy
http://hg.python.org/cpython/rev/49de26395d1a

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16300
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16250] URLError invoked with reason as filename

2012-10-22 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This broke the Windows 7 buildbot:
http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/850

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16250] URLError invoked with reason as filename

2012-10-22 Thread Senthil Kumaran

Senthil Kumaran added the comment:

The change in 49de26395d1a addresses the buildbot failure. I have given a run 
again.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16250] URLError invoked with reason as filename

2012-10-22 Thread Senthil Kumaran

Senthil Kumaran added the comment:

The change I had made for fixing the windows buildbot had not fixed it. I  am 
skipped (1f92315d9568) the test on windows, investigating the reason for 
windows behavior and I shall remove the skiptest on windows after fix.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-21 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Here is the patch which captures both HTTPError and URLError at the open_file 
and thus preventing multiple exceptions to be raised ( URLError and next 
IOError). This can go in 3.4 and since this is bug, where correct exception is 
not being caught and wrong args are sent, I think the catching of correct 
exception can be backported to old versions

--
Added file: http://bugs.python.org/file27646/issue10836.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10836
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset daef5526d2ac by Senthil Kumaran in branch 'default':
Issue #10836: Fix exception raised when file not found in urlretrieve
http://hg.python.org/cpython/rev/daef5526d2ac

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10836
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-21 Thread Senthil Kumaran

Senthil Kumaran added the comment:

This one is fixed in 3.4. I can see the previous versions raised IOError 
exception and it is not a good idea to change by backporting. But the wrong 
arguments on URLError should be fixed tough.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10836
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16250] URLError invoked with reason as filename

2012-10-21 Thread Senthil Kumaran

Senthil Kumaran added the comment:

This patch fixed these URLError wrong invocation issue and adds some tests for 
testing those it. 

I noticed that some of these were in the dead-end of the code, like checking if 
url is not a str (it is always, unwrap makes it a str if otherwise). Those will 
have to be cleaned and I shall do it next.

--
keywords: +patch
Added file: http://bugs.python.org/file27657/issue16250.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16247] Report failing url in URLError?

2012-10-21 Thread Senthil Kumaran

Senthil Kumaran added the comment:

The URLError changes gone in as part of fix for issue10836 should give 
e.filename and e.reason.

--
nosy: +orsenthil

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16247
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16250] URLError invoked with reason as filename

2012-10-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8fb438e7f738 by Senthil Kumaran in branch 'default':
Issue #16250: Fix the invocations of URLError which had misplaced filename 
attribute for exception
http://hg.python.org/cpython/rev/8fb438e7f738

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16250] URLError invoked with reason as filename

2012-10-21 Thread Senthil Kumaran

Senthil Kumaran added the comment:

This is fixed in 3.4. I shall backport to other branches.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-17 Thread Senthil Kumaran

Senthil Kumaran added the comment:

@Ezio, regarding msg172988. That's embarrassing. It should be fixed soon.

Review on the patch, how about having the strerror and filename from the 
exception?

-raise URLError(e.errno, e.strerror, e.filename)
+raise URLError(e.strerror, e.filename)

I believe, that could have been the original intention which got overlooked.

And yes to fixing the other URLError msg related issues too, with just changing 
to single msg first, instead of wrongly sending the filename.

--
assignee: orsenthil - 

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10836
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16247] Report failing url in URLError?

2012-10-16 Thread Nick Coghlan

New submission from Nick Coghlan:

Trying to streamline the URL retrieval example in the concurrent.futures docs 
were severely hampered by the fact the URLError thrown by urlopen doesn't tell 
you *what URL* it was trying to retrieve when it failed.

This is OK in synchronous code (where you probably still have the URL around), 
but quite a pain in asynchronous code (such as that using concurrent.futures) 
where the original context may have been lost by the time the future is 
signalled.

--
messages: 173035
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Report failing url in URLError?

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16247
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16247] Report failing url in URLError?

2012-10-16 Thread Ezio Melotti

Ezio Melotti added the comment:

See also #10836 and msg172988.

--
components: +Library (Lib)
nosy: +ezio.melotti
stage:  - needs patch
type:  - behavior
versions: +Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16247
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-16 Thread Chris Jerdonek

Chris Jerdonek added the comment:

 This should be reported in another issue though.

Has this been done?

--
nosy: +chris.jerdonek

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10836
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-16 Thread Ezio Melotti

Ezio Melotti added the comment:

Nick reported #16247 today which is very similar.

--
nosy: +ncoghlan

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10836
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16250] URLError invoked with reason as filename

2012-10-16 Thread Chris Jerdonek

New submission from Chris Jerdonek:

This issue is to fix invocations of URLError so that reasons are not passed 
in for the filename argument of the URLError constructor.

Ezio found and described this issue when commenting on issue 10836:

  http://bugs.python.org/issue10836#msg172988

In more detail: URLError accepts reason and filename arguments:

http://hg.python.org/cpython/file/74b95194ba86/Lib/urllib/error.py#l23

However, in several places in Lib/urllib, URLError is invoked with a reason 
passed in for the filename.  For example:

raise URLError('local file error', 'not on local host')

This issue could be addressed for this example by changing the above to:

raise URLError('local file error: not on local host')

This dovetails with issue #16247, which is to start passing the actual filename 
in for some calls to URLError (and perhaps to adjust URLError's __str__, etc).

--
components: Library (Lib)
keywords: easy
messages: 173058
nosy: chris.jerdonek, ezio.melotti
priority: normal
severity: normal
status: open
title: URLError invoked with reason as filename
type: enhancement
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-16 Thread Chris Jerdonek

Chris Jerdonek added the comment:

For tracking purposes, I created issue 16250 for what you observed above, which 
as you said is related to but not the same as Nick's issue 16247.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10836
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16250] URLError invoked with reason as filename

2012-10-16 Thread Senthil Kumaran

Changes by Senthil Kumaran sent...@uthcode.com:


--
nosy: +orsenthil

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16250] URLError invoked with reason as filename

2012-10-16 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ncoghlan

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16250] URLError invoked with reason as filename

2012-10-16 Thread Chris Jerdonek

Chris Jerdonek added the comment:

 raise URLError('local file error: not on local host')

I should also point out that URLError invocations with formats like the above 
already do occur in Lib/urllib/request.py.  For example:

raise URLError('ftp error: no host given')
exc = URLError('ftp error: %s' % msg)
raise URLError(http protocol error: bad status line)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16250] URLError invoked with reason as filename

2012-10-16 Thread Chris Jerdonek

Chris Jerdonek added the comment:

For future reference, this affects 3.2 onwards.  It probably makes sense to 
address this in the same branches in which we plan to address issue 16247 
(currently set to 3.3 onwards).

--
stage:  - needs patch
versions: +Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16250
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-15 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The presence of During handling of the above exception, another exception 
occurred: is part of an intentional change between 2.x and 3.x. Exception 
handling has been tweaked a bit more in the past year. 3.2.3 only gives the 
second half of the traceback, which I suppose is worse.

In 3.3.0, the exception raising an exception behavior is fixed for this 
particular input on my Win 7 system.

 import urllib.request
 urllib.request.urlretrieve('missing')
Traceback (most recent call last):
  File pyshell#1, line 1, in module
urllib.request.urlretrieve('missing')
  File C:\Programs\Python33\lib\urllib\request.py, line 185, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
  File C:\Programs\Python33\lib\urllib\request.py, line 160, in urlopen
return opener.open(url, data, timeout)
  File C:\Programs\Python33\lib\urllib\request.py, line 458, in open
req = Request(fullurl, data)
  File C:\Programs\Python33\lib\urllib\request.py, line 279, in __init__
self._parse()
  File C:\Programs\Python33\lib\urllib\request.py, line 284, in _parse
raise ValueError(unknown url type: %s % self.full_url)
ValueError: unknown url type: missing

urlretrieve no longer assumes the file: scheme. (It was never documented to do 
so, and there is no good reason to do so.) If given explicitly with an invalid 
name, it gives the current equivalent of the 2.x error and message.

 urllib.request.urlretrieve('file:missing')
...
urllib.error.URLError: urlopen error [WinError 2] The system cannot find the 
file specified: 'missing'

Nonetheless, this 3 arg call should be fixed
1887 except OSError as e:
1888   raise URLError(e.errno, e.strerror, e.filename)

--
nosy: +terry.reedy
title: regression: TypeError during exception handling in 
urllib.request.urlretrieve - urllib.request.urlretrieve calls URLError with 3 
args

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10836
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-15 Thread Ezio Melotti

Ezio Melotti added the comment:

While fixing this issue is easy, there is a wider problem with the use of 
URLError.
The constructor accepts two args, reason and filename. About half of the errors 
in Lib/urllib/request.py use only one argument, and in the other half not a 
single one uses the second arg for the filename:

raise URLError('file error', 'proxy support for file protocol currently not 
implemented')
raise URLError('local file error', 'not on local host')
raise URLError('ftp error', 'proxy support for ftp protocol currently not 
implemented')
if not host: raise URLError('ftp error', 'no host given')
raise URLError('ftp error', msg).with_traceback(sys.exc_info()[2])
raise URLError('data error', 'proxy support for data protocol currently not 
implemented')
raise URLError('ftp error', reason).with_traceback(
raise URLError('ftp error', reason) from reason

Note that the only the first arg ends up in the error message.

This should be reported in another issue though.


In the attached patch I passed only the first argoment and did

-raise URLError(e.errno, e.strerror, e.filename)
+raise URLError('local file error')

The result is

Traceback (most recent call last):
  File /home/wolf/dev/py/3.2/Lib/urllib/request.py, line 1769, in 
open_local_file
stats = os.stat(localname)
OSError: [Errno 2] No such file or directory: 'foo'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/wolf/dev/py/3.2/Lib/urllib/request.py, line 1771, in 
open_local_file
raise URLError('local file error')
urllib.error.URLError: urlopen error local file error

If that's OK I'll add a couple of tests and commit.

--
keywords: +patch
Added file: http://bugs.python.org/file27583/issue10836.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10836
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-15 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
stage: needs patch - patch review
Added file: http://bugs.python.org/file27584/issue10836-2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10836
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8580] Problem urllib2.URLError

2010-04-30 Thread Jorge Bosch

New submission from Jorge Bosch jorgebosc...@gmail.com:

hello. Im new on this kind of programation. Well it could sound newbie...but I 
have this error and I dont know how to fix it.

Well its related with an AutoUpdater for a Online Game (GTLegends, Altbierbude 
software) but no one manage to solve it..

Here is the Log of the error:

Traceback (most recent call last):
  File C:\Download\AutoUpdate\altbierbude_en.pyw, line 134, in module
main()
  File C:\Download\AutoUpdate\altbierbude_en.pyw, line 93, in main
the_app.myconfig = GetAppConfig(source_url, config_filename)
  File C:\Download\AutoUpdate\altbierbude_en.pyw, line 52, in GetAppConfig
cfg_data = GetUrlData(url+filename)
  File C:\Download\AutoUpdate\altbierbude_en.pyw, line 31, in GetUrlData
url_handle = opener.open( url )
  File C:\Python26\lib\urllib2.py, line 389, in open
response = self._open(req, data)
  File C:\Python26\lib\urllib2.py, line 407, in _open
'_open', req)
  File C:\Python26\lib\urllib2.py, line 367, in _call_chain
result = func(*args)
  File C:\Python26\lib\urllib2.py, line 1146, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File C:\Python26\lib\urllib2.py, line 1121, in do_open
raise URLError(err)
urllib2.URLError: urlopen error [Errno 10061] No se puede establecer una 
conexión ya que el equipo de destino denegó expresamente dicha conexión

--
messages: 104661
nosy: m_enanos
priority: normal
severity: normal
status: open
title: Problem urllib2.URLError
versions: Python 2.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8580
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8580] Problem urllib2.URLError

2010-04-30 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

The bug tracker is for bugs in Python itself, and isn't a good place to look 
for help on getting an application program to work.  You should try the python 
email list/newsgroup.  (You can find links to the newsgroup and other resources 
under the 'help' link on the left hand side menu on the python home page).

--
nosy: +r.david.murray
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8580
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



URLError errno and strerror not set

2009-07-16 Thread 1x7y2z9

python 2.5.2

errno, strerror and message do not appear to be set in the following
two cases (at least).
Is this to be expected?  (as an aside, arg[0] is set)

# case 1
 print exception, exception.errno, exception.strerror, exception.message == ''
urlopen error (111, 'Connection refused') None None True

# case 2
 print exception, exception.errno, exception.strerror, exception.message == ''
urlopen error timed out None None True

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


Re: urllib2.URLError: urlopen error unknown url type: 'http error using twill with python

2009-06-29 Thread amadain
On Jun 8, 12:58 pm, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
 On Mon, 08 Jun 2009 12:14:18 +0100, Mark Devine wrote:
  Hi
  I wonder if someone could point me in the right direction. I used the
  following code to access gmail but I got a
           urllib2.URLError: urlopen error unknown url type: 'http
  error when I ran it. I have included the Traceback

  import twill, string, os
  b=twill.commands.get_browser()
  b.set_agent_string(Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;
  rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14) b.clear_cookies()
  b.go('http://www.gmail.com')
  f=b.get_form(1)
  b.showforms()
  f['Email']= email
  f['Passwd'] =password
  b.clicked(f, f)
  b.submit()

 My bet is that the above is not the actual code you have run. I bet that
 the offending line is actually something like the following:

 b.go('http://www.gmail.com;)

 Note that there is a single character difference.

 Consider the last two lines of the traceback:

      raise URLError('unknown url type: %s' % type)
  urllib2.URLError: urlopen error unknown url type: 'http

 It seems to be saying that the url type is 'http -- note the leading
 single quote.

 --
 Steven

Actually that is the exact code run from a python shell. Try it
yourself. I could not find anybody who successfully automated sending
a gmail through python with twill so if you know how I would greatly
appreciate any pointers.
-- 
http://mail.python.org/mailman/listinfo/python-list


urllib2.URLError: urlopen error unknown url type: 'http error using twill with python

2009-06-08 Thread Mark Devine
Hi
I wonder if someone could point me in the right direction. I used the
following code to access gmail but I got a
 urllib2.URLError: urlopen error unknown url type: 'http
error when I ran it. I have included the Traceback

import twill, string, os
b=twill.commands.get_browser()
b.set_agent_string(Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;
rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14)
b.clear_cookies()
b.go('http://www.gmail.com')
f=b.get_form(1)
b.showforms()
f['Email']= email
f['Passwd'] =password
b.clicked(f, f)
b.submit()

When I run the code I get:

Traceback (most recent call last):
  File stdin, line 1, in ?
  File /home/mdevine/qa/aqa/mfe/site-packages/twill/browser.py, line
115, in go
self._journey('open', u)
  File /home/mdevine/qa/aqa/mfe/site-packages/twill/browser.py, line
540, in _journey
r = func(*args, **kwargs)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py,
line 156, in open
return self._mech_open(url, data)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py,
line 182, in _mech_open
response = UserAgentBase.open(self, request, data)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_opener.py,
line 191, in open
response = meth(req, response)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_http.py,
line 573, in http_response
response = self.parent.error(
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_opener.py,
line 208, in error
result = apply(self._call_chain, args)
  File /opt/ams/mdevine/lib/python2.4/urllib2.py, line 337, in _call_chain
result = func(*args)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_http.py,
line 129, in http_error_302
return self.parent.open(new)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py,
line 156, in open
return self._mech_open(url, data)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py,
line 182, in _mech_open
response = UserAgentBase.open(self, request, data)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_opener.py,
line 191, in open
response = meth(req, response)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_http.py,
line 573, in http_response
response = self.parent.error(
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_opener.py,
line 208, in error
result = apply(self._call_chain, args)
  File /opt/ams/mdevine/lib/python2.4/urllib2.py, line 337, in _call_chain
result = func(*args)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_http.py,
line 129, in http_error_302
return self.parent.open(new)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py,
line 156, in open
return self._mech_open(url, data)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py,
line 182, in _mech_open
response = UserAgentBase.open(self, request, data)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_opener.py,
line 191, in open
response = meth(req, response)
  File /home/mdevine/qa/aqa/mfe/site-packages/twill/utils.py, line
455, in http_response
refresh, msg, hdrs)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_opener.py,
line 208, in error
result = apply(self._call_chain, args)
  File /opt/ams/mdevine/lib/python2.4/urllib2.py, line 337, in _call_chain
result = func(*args)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_http.py,
line 129, in http_error_302
return self.parent.open(new)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py,
line 156, in open
return self._mech_open(url, data)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_mechanize.py,
line 182, in _mech_open
response = UserAgentBase.open(self, request, data)
  File 
/home/mdevine/qa/aqa/mfe/site-packages/twill/other_packages/mechanize/_opener.py,
line 180, in open
response = urlopen(self, req, data)
  File /opt/ams/mdevine/lib/python2.4/urllib2.py, line 381, in _open
'unknown_open', req)
  File /opt/ams/mdevine/lib/python2.4/urllib2.py, line 337, in _call_chain
result = func(*args)
  File /opt/ams/mdevine/lib/python2.4/urllib2.py, line 1053, in unknown_open
raise URLError('unknown url type: %s' % type)
urllib2.URLError: urlopen error unknown url type: 'http


Thanks

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


Re: urllib2.URLError: urlopen error unknown url type: 'http error using twill with python

2009-06-08 Thread Steven D'Aprano
On Mon, 08 Jun 2009 12:14:18 +0100, Mark Devine wrote:

 Hi
 I wonder if someone could point me in the right direction. I used the
 following code to access gmail but I got a
  urllib2.URLError: urlopen error unknown url type: 'http
 error when I ran it. I have included the Traceback
 
 import twill, string, os
 b=twill.commands.get_browser()
 b.set_agent_string(Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB;
 rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14) b.clear_cookies()
 b.go('http://www.gmail.com')
 f=b.get_form(1)
 b.showforms()
 f['Email']= email
 f['Passwd'] =password
 b.clicked(f, f)
 b.submit()


My bet is that the above is not the actual code you have run. I bet that 
the offending line is actually something like the following:

b.go('http://www.gmail.com;)

Note that there is a single character difference.

Consider the last two lines of the traceback:

 raise URLError('unknown url type: %s' % type)
 urllib2.URLError: urlopen error unknown url type: 'http


It seems to be saying that the url type is 'http -- note the leading 
single quote.


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


Re: urllib2.URLError: urlopen error unknown url type: http

2009-03-13 Thread Coonay
i update via http proxy

cmdset HTTP_PROXY=http://cache.mycompany.com:3128
cmdpython appcfg.py update myapp


URLError: urlopen error [Errno 10061] No connection could be made
because the t
arget machine actively refused it
Traceback (most recent call last):
  File C:\Program Files\Google\google_appengine\appcfg.py, line 60,
in module

run_file(__file__, globals())
  File C:\Program Files\Google\google_appengine\appcfg.py, line 57,
in run_fil
e
execfile(script_path, globals_)
  File C:\Program Files\Google\google_appengine\google\appengine\tools
\appcfg.p
y, line 1976, in module
main(sys.argv)
  File C:\Program Files\Google\google_appengine\google\appengine\tools
\appcfg.p
y, line 1967, in main
result = AppCfgApp(argv).Run()
  File C:\Program Files\Google\google_appengine\google\appengine\tools
\appcfg.p
y, line 1418, in Run
self.action(self)
  File C:\Program Files\Google\google_appengine\google\appengine\tools
\appcfg.p
y, line 1879, in __call__
return method()
  File C:\Program Files\Google\google_appengine\google\appengine\tools
\appcfg.p
y, line 1669, in Update
lambda path: open(os.path.join(basepath, path), rb))
  File C:\Program Files\Google\google_appengine\google\appengine\tools
\appcfg.p
y, line 1213, in DoUpload
missing_files = self.Begin()
  File C:\Program Files\Google\google_appengine\google\appengine\tools
\appcfg.p
y, line 1009, in Begin
version=self.version, payload=self.config.ToYAML())
  File C:\Program Files\Google\google_appengine\google\appengine\tools
\appengin
e_rpc.py, line 312, in Send
self._Authenticate()
  File C:\Program Files\Google\google_appengine\google\appengine\tools
\appengin
e_rpc.py, line 344, in _Authenticate
super(HttpRpcServer, self)._Authenticate()
  File C:\Program Files\Google\google_appengine\google\appengine\tools
\appengin
e_rpc.py, line 233, in _Authenticate
auth_token = self._GetAuthToken(credentials[0], credentials[1])
  File C:\Program Files\Google\google_appengine\google\appengine\tools
\appengin
e_rpc.py, line 177, in _GetAuthToken
response = self.opener.open(req)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 383, in open
response = self._open(req, data)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 401, in _open
'_open', req)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 361, in _call_chain
result = func(*args)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 1138, in https_open
return self.do_open(httplib.HTTPSConnection, req)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 1105, in do_open
raise URLError(err)
urllib2.URLError: urlopen error [Errno 10061] No connection could be
made becau
se the target machine actively refused it

D:\workspace\python
















On Mar 11, 4:08 pm, Chris Rebert c...@rebertia.com wrote:
 On Tue, Mar 10, 2009 at 11:34 PM, Coonay fla...@gmail.com wrote:
  i use python2.6

  File C:\PROGRA~1\Python26\lib\urllib2.py, line 383, in open
     response = self._open(req, data)
   File C:\PROGRA~1\Python26\lib\urllib2.py, line 401, in _open
     '_open', req)
   File C:\PROGRA~1\Python26\lib\urllib2.py, line 361, in
  _call_chain
     result = func(*args)
   File C:\PROGRA~1\Python26\lib\urllib2.py, line 690, in lambda
     meth(r, proxy, type))
   File C:\PROGRA~1\Python26\lib\urllib2.py, line 713, in proxy_open
     return self.parent.open(req)
   File C:\PROGRA~1\Python26\lib\urllib2.py, line 383, in open
     response = self._open(req, data)
   File C:\PROGRA~1\Python26\lib\urllib2.py, line 406, in _open
     'unknown_open', req)
   File C:\PROGRA~1\Python26\lib\urllib2.py, line 361, in
  _call_chain
     result = func(*args)
   File C:\PROGRA~1\Python26\lib\urllib2.py, line 1163, in
  unknown_open
     raise URLError('unknown url type: %s' % type)
  urllib2.URLError: urlopen error unknown url type: http

 A. Please include the *entire* traceback, in the future
 B. Please include a snippet of the code you're using, in the future
 C. A bit less curt of a missive would also be appreciated

 That all said, judging by the error message, it appears that the URL
 you're trying to open has a double-quote () as its first character,
 which is obviously not permissible.
 I can't be completely sure however, since you neglected to include the
 entire traceback or any of your actual code.

 Cheers,
 Chris

 --
 I have a blog:http://blog.rebertia.com

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


urllib2.URLError: urlopen error unknown url type: http

2009-03-11 Thread Coonay
i use python2.6


File C:\PROGRA~1\Python26\lib\urllib2.py, line 383, in open
response = self._open(req, data)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 401, in _open
'_open', req)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 361, in
_call_chain
result = func(*args)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 690, in lambda
meth(r, proxy, type))
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 713, in proxy_open
return self.parent.open(req)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 383, in open
response = self._open(req, data)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 406, in _open
'unknown_open', req)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 361, in
_call_chain
result = func(*args)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 1163, in
unknown_open
raise URLError('unknown url type: %s' % type)
urllib2.URLError: urlopen error unknown url type: http
--
http://mail.python.org/mailman/listinfo/python-list


Re: urllib2.URLError: urlopen error unknown url type: http

2009-03-11 Thread Chris Rebert
On Tue, Mar 10, 2009 at 11:34 PM, Coonay fla...@gmail.com wrote:
 i use python2.6


 File C:\PROGRA~1\Python26\lib\urllib2.py, line 383, in open
    response = self._open(req, data)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 401, in _open
    '_open', req)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 361, in
 _call_chain
    result = func(*args)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 690, in lambda
    meth(r, proxy, type))
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 713, in proxy_open
    return self.parent.open(req)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 383, in open
    response = self._open(req, data)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 406, in _open
    'unknown_open', req)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 361, in
 _call_chain
    result = func(*args)
  File C:\PROGRA~1\Python26\lib\urllib2.py, line 1163, in
 unknown_open
    raise URLError('unknown url type: %s' % type)
 urllib2.URLError: urlopen error unknown url type: http

A. Please include the *entire* traceback, in the future
B. Please include a snippet of the code you're using, in the future
C. A bit less curt of a missive would also be appreciated

That all said, judging by the error message, it appears that the URL
you're trying to open has a double-quote () as its first character,
which is obviously not permissible.
I can't be completely sure however, since you neglected to include the
entire traceback or any of your actual code.

Cheers,
Chris

-- 
I have a blog:
http://blog.rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: URLError

2008-03-22 Thread Jim
On Mar 20, 7:03 pm, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
 On Thu, 20 Mar 2008 10:26:14 -0700, Jim wrote:
  The program is my first and I'm not a programmer so it will take me some
  time to get your recommendation to work. So far the program runs after I
  added code based on your example but the program still aborts and none
  of the code (Temporary failure, Skip/Halt/try Again? or Unknown
  response, boo hiss to you!) in your example is displayed.

 Try replacing the line:

 exceptURLError, e:

 with:

 except urllib2.URLError, e:

 and see if that helps.

 --
 Steven

Steven,

Got it to work with your example see code below. The process continued
bypassing the records when exceptions occurred.
My process displayed 'print here 1' then 'print here 4' and continued
process with next record without aborting. What
should be displayed, if anything, with the line response =
raw_input(Temporary failure,
Skip/Halt/try Again?) as I didn't see anything?

Thanks for your help
Jim

Code:
except urllib2.URLError, e:
   print here 1
   if e.errno == 10053:
  response = raw_input(Temporary failure, Skip/Halt/try
Again?)
  response = response.lower().strip()
   if response in ('h', 'halt'):
  print here 2
  break
   elif response in ('a', 'again', 't', 'try', 'try again'):
  print here 3
  continue
   elif response in ('', 's', 'skip'):
  print here 4
  lines -= 1
  continue
   else:
  print Unknown response, boo hiss to you!
  raise
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: URLError

2008-03-20 Thread Jim
On Mar 19, 6:50 pm, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
 On Wed, 19 Mar 2008 14:45:39 -0700, Jim wrote:
  Program randomly aborts when looking up url. The program loop thru
  4000+ records looking
  up ID via internet and returnshtmlcode which is used in subsequent
  processing. The code
  for looking-up record is below followed by abort details. Can anyone
  help with catching the
  abort before program aborts or provide code to automatically start
  program?

 Yes. Wrap the offending code with a try...except loop, something similar
 to this.

 try:
 contents = urllib2.urlopen(url).read()
 except URLError, e:
 if e.errno == 10053:
 # Software caused connection abort
 response = raw_input(
 Temporary failure, Skip/Halt/try Again?)
 response = response.lower().strip()
 if response in ('h', 'halt'):
 break
 elif response in ('a', 'again', 't', 'try', 'try again'):
 continue
 elif response in ('', 's', 'skip'):
 lines -= 1
 continue
 else:
 print Unknown response, boo hiss to you!
 raise

 --
 Steven

Thanks Steven for recommendation.

The program is my first and I'm not a programmer so it will take me
some time to get your recommendation to work. So far the program runs
after I added code based on your example but the program still aborts
and none of the code (Temporary failure, Skip/Halt/try Again? or
Unknown response, boo hiss to you!) in your example is displayed. It
appears to abort in the imported module urllib2 which is open
source. The code in urllib2 is way over my skill level.

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


Re: URLError

2008-03-20 Thread Steven D'Aprano
On Thu, 20 Mar 2008 10:26:14 -0700, Jim wrote:

 The program is my first and I'm not a programmer so it will take me some
 time to get your recommendation to work. So far the program runs after I
 added code based on your example but the program still aborts and none
 of the code (Temporary failure, Skip/Halt/try Again? or Unknown
 response, boo hiss to you!) in your example is displayed.


Try replacing the line:

except URLError, e:


with:

except urllib2.URLError, e:


and see if that helps.


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


URLError

2008-03-19 Thread Jim
Program randomly aborts when looking up url. The program loop thru
4000+ records looking
up ID via internet and returns html code which is used in subsequent
processing. The code
for looking-up record is below followed by abort details. Can anyone
help with catching the
abort before program aborts or provide code to automatically start
program? Currently, if
program is restarted the process starts after last good record but
must be restarted manually.

Thanks
Jim

code start here

#start lookups pass
while lines  5000:
lines += 1
d =
ifile.read(8)

print str(lines) + ' ' + d
z = ifile.read(1)
f2 = b + d
h4 = h1+f2+h3#file name for
saving HMTL file
html_file = open(h4, 'w')
url  = a + d + c + b #build url to
lookup record in database
contents = urllib2.urlopen(url).read()   #lookup account in
database
soup = BeautifulSoup(contents)
html_file.write(soup.prettify()) #write HTML file
targetPage = soup.prettify()
targetHTML = targetPage  #set-up
record for edit pass
html_file.close()#close HTML file


abort details
==
429 90078431(note:this record 429 is where abort happen-when program
restarted this record processed normally)

Traceback (most recent call last):
  File C:\Python25\Lib\site-packages\pythonwin\pywin\framework
\scriptutils.py, line 310, in RunScript
exec codeObject in __main__.__dict__
  File Lookup Records.py, line 77, in module
contents = urllib2.urlopen(url).read()
  File C:\Python25\lib\urllib2.py, line 121, in urlopen
return _opener.open(url, data)
  File C:\Python25\lib\urllib2.py, line 374, in open
response = self._open(req, data)
  File C:\Python25\lib\urllib2.py, line 392, in _open
'_open', req)
  File C:\Python25\lib\urllib2.py, line 353, in _call_chain
result = func(*args)
  File C:\Python25\lib\urllib2.py, line 1100, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File C:\Python25\lib\urllib2.py, line 1075, in do_open
raise URLError(err)
URLError: urlopen error (10053, 'Software caused connection abort')
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: URLError

2008-03-19 Thread Steven D'Aprano
On Wed, 19 Mar 2008 14:45:39 -0700, Jim wrote:

 Program randomly aborts when looking up url. The program loop thru 
 4000+ records looking
 up ID via internet and returns html code which is used in subsequent
 processing. The code
 for looking-up record is below followed by abort details. Can anyone
 help with catching the
 abort before program aborts or provide code to automatically start
 program? 


Yes. Wrap the offending code with a try...except loop, something similar 
to this.


try:
contents = urllib2.urlopen(url).read()
except URLError, e:
if e.errno == 10053:
# Software caused connection abort
response = raw_input(
Temporary failure, Skip/Halt/try Again?)
response = response.lower().strip()
if response in ('h', 'halt'):
break
elif response in ('a', 'again', 't', 'try', 'try again'):
continue
elif response in ('', 's', 'skip'):
lines -= 1
continue
else:
print Unknown response, boo hiss to you!
raise


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


Re: urlerror, urllib2: no address ... why or debug tips?

2006-03-10 Thread Rene Pijlman
[EMAIL PROTECTED]:
Help please with a URLError.

Post your code (a small self-contained example, preferrably) and the URL.

-- 
René Pijlman
-- 
http://mail.python.org/mailman/listinfo/python-list


urlerror, urllib2: no address ... why or debug tips?

2006-03-09 Thread joemynz
Help please with a URLError. Invoking a url that works in Firefox and
IE results in a urlerror 7, no address ... in python. I need to debug
why.

Traceback is below. There's a redirect when the url is invoked (it's
part of a chain) - you can see it using liveheaders in firefox. What is
the best way to debug this? I tried setting debug on HTTPConnection but
this doesn't work (from some web posts, setting debug is broken in
2.4). What's the best way to see what's happening, way to monitor the
call sequences etc?

Any help much appreciated. Thx.

handle = urllib2.urlopen(req)
  File
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py,
line 130, in urlopen
return _opener.open(url, data)
  File
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py,
line 364, in open
response = meth(req, response)
  File
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py,
line 471, in http_response
response = self.parent.error(
  File
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py,
line 396, in error
result = self._call_chain(*args)
  File
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py,
line 337, in _call_chain
result = func(*args)
  File
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py,
line 554, in http_error_302
return self.parent.open(new)
  File
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py,
line 358, in open
response = self._open(req, data)
  File
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py,
line 376, in _open
'_open', req)
  File
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py,
line 337, in _call_chain
result = func(*args)
  File
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py,
line 1021, in http_open
return self.do_open(httplib.HTTPConnection, req)
  File
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/urllib2.py,
line 996, in do_open
raise URLError(err)
URLError: urlopen error (7, 'No address associated with nodename')

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