Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urllib2.URLError: <urlopen error no host given> #107

Open
shikanon opened this issue Apr 9, 2015 · 1 comment
Open

urllib2.URLError: <urlopen error no host given> #107

shikanon opened this issue Apr 9, 2015 · 1 comment

Comments

@shikanon
Copy link

shikanon commented Apr 9, 2015

When I use the function open, it will occur "urllib2.URLError: "
, and I run pypi.py which under the example file it alse will occur, I retry install but the problem can be solve, I try to run the test it backtack:

ERROR: test_retrieve_local_file (test.test_performance.PerformanceTests)

Traceback (most recent call last):
File "I:\Python27\upzip\mechanize-0.2.5\test\test_performance.py", line 53, in test_retrieve_local_file
time_retrieve_local_file(self, size, retrieve),
File "I:\Python27\upzip\mechanize-0.2.5\test\test_performance.py", line 38, in time_retrieve_local_file
return time_it(operation)
File "I:\Python27\upzip\mechanize-0.2.5\test\test_performance.py", line 18, in time_it
operation()
File "I:\Python27\upzip\mechanize-0.2.5\test\test_performance.py", line 37, in operation
os.path.join(temp_dir, "retrieved"))
File "I:\Python27\upzip\mechanize-0.2.5\test\test_performance.py", line 46, in retrieve
br.retrieve(url, filename)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_opener.py", line 250, in retrieve
fp = self.open(req)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_mechanize.py", line 203, in open
return self._mech_open(url, data, timeout=timeout)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_mechanize.py", line 230, in _mech_open
response = UserAgentBase.open(self, request, data)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_opener.py", line 193, in open
response = urlopen(self, req, data)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 349, in _open
'unknown_open', req)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 332, in _call_chain
result = func(*args)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 1201, in unknown_open
raise URLError('unknown url type: %s' % type)
URLError:

ERROR: test_file (test.test_urllib2.HandlerTests)

Traceback (most recent call last):
File "I:\Python27\upzip\mechanize-0.2.5\test\test_urllib2.py", line 803, in test_file
self.assertRaises(mechanize.URLError, h.file_open, Request(url))
File "I:\Python27\upzip\mechanize-0.2.5\test-tools\unittest\case.py", line 409, in assertRaises
with_(context, lambda: callableObj(args, *kwargs))
File "I:\Python27\upzip\mechanize-0.2.5\test-tools\unittest\case.py", line 20, in with

suite_func()
File "I:\Python27\upzip\mechanize-0.2.5\test-tools\unittest\case.py", line 409, in
with
(context, lambda: callableObj(_args, *_kwargs))
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 1264, in file_open
return self.open_local_file(req)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 1299, in open_local_file
(not port and socket.gethostbyname(host) in self.get_names()):
gaierror: [Errno 11001] getaddrinfo failed

ERROR: test_trivial (test.test_urllib2.TrivialTests)

Traceback (most recent call last):
File "I:\Python27\upzip\mechanize-0.2.5\test\test_urllib2.py", line 68, in test_trivial
f = mechanize.urlopen(file_url)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_opener.py", line 426, in urlopen
return _opener.open(url, data, timeout)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_opener.py", line 193, in open
response = urlopen(self, req, data)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 344, in _open
'_open', req)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 332, in _call_chain
result = func(*args)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 1264, in file_open
return self.open_local_file(req)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 1299, in open_local_file
(not port and socket.gethostbyname(host) in self.get_names()):
gaierror: [Errno 11001] getaddrinfo failed

ERROR: test_proxy_qop_auth_works (test.test_urllib2_localnet.ProxyAuthTests)

Traceback (most recent call last):
File "I:\Python27\upzip\mechanize-0.2.5\test\test_urllib2_localnet.py", line 290, in test_proxy_qop_auth_works
result = self.opener.open(self.URL)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_opener.py", line 193, in open
response = urlopen(self, req, data)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 344, in _open
'_open', req)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 332, in _call_chain
result = func(*args)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 1142, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 1118, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 10061] >

ERROR: test_proxy_with_bad_password_raises_httperror (test.test_urllib2_localnet.ProxyAuthTests)

Traceback (most recent call last):
File "I:\Python27\upzip\mechanize-0.2.5\test\test_urllib2_localnet.py", line 280, in test_proxy_with_bad_password_raises_httperror
self.URL)
File "I:\Python27\upzip\mechanize-0.2.5\test-tools\unittest\case.py", line 409, in assertRaises
with_(context, lambda: callableObj(args, *kwargs))
File "I:\Python27\upzip\mechanize-0.2.5\test-tools\unittest\case.py", line 20, in with

suite_func()
File "I:\Python27\upzip\mechanize-0.2.5\test-tools\unittest\case.py", line 409, in
with
(context, lambda: callableObj(_args, *_kwargs))
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_opener.py", line 193, in open
response = urlopen(self, req, data)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 344, in _open
'_open', req)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 332, in _call_chain
result = func(*args)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 1142, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 1118, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 10061] >

ERROR: test_proxy_with_no_password_raises_httperror (test.test_urllib2_localnet.ProxyAuthTests)

Traceback (most recent call last):
File "I:\Python27\upzip\mechanize-0.2.5\test\test_urllib2_localnet.py", line 285, in test_proxy_with_no_password_raises_httperror
self.URL)
File "I:\Python27\upzip\mechanize-0.2.5\test-tools\unittest\case.py", line 409, in assertRaises
with_(context, lambda: callableObj(args, *kwargs))
File "I:\Python27\upzip\mechanize-0.2.5\test-tools\unittest\case.py", line 20, in with

suite_func()
File "I:\Python27\upzip\mechanize-0.2.5\test-tools\unittest\case.py", line 409, in
with
(context, lambda: callableObj(_args, *_kwargs))
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_opener.py", line 193, in open
response = urlopen(self, req, data)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 344, in _open
'_open', req)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 332, in _call_chain
result = func(*args)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 1142, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "I:\Python27\upzip\mechanize-0.2.5\mechanize_urllib2_fork.py", line 1118, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 10061] >

FAIL: test_get_token (test.test_pullparser.PullParserTests)

Traceback (most recent call last):
File "I:\Python27\upzip\mechanize-0.2.5\test\test_pullparser.py", line 78, in test_get_token
self._test_get_token(pc, tolerant)
File "I:\Python27\upzip\mechanize-0.2.5\test\test_pullparser.py", line 117, in _test_get_token
self.assertEqual(p.get_token(), ("decl", "rheum", None))
AssertionError: Token('comment', 'rheum', None) != ('decl', 'rheum', None)

FAIL: test_tokens (test.test_pullparser.PullParserTests)

Traceback (most recent call last):
File "I:\Python27\upzip\mechanize-0.2.5\test\test_pullparser.py", line 274, in test_tokens
self._test_tokens(pc, tolerant)
File "I:\Python27\upzip\mechanize-0.2.5\test\test_pullparser.py", line 290, in _test_tokens
self.assertEquals(token.type, expected_token_types[i])
AssertionError: 'comment' != 'decl'


Ran 540 tests in 90.757s

FAILED (failures=2, errors=6, skipped=37)

How to solve this problem?Thank you.

@alok87
Copy link

alok87 commented May 25, 2016

Issue with url no host is not an issue but form action having spaces
`form action=" /new_user_signup"``

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants