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

http.client.InvalidURL: URL can't contain control characters. #3

Open
hassantarabai opened this issue Jan 25, 2024 · 0 comments
Open

Comments

@hassantarabai
Copy link

Hello,

While using this command : python3 download_ko.py --org test.org --out KEGG-KO --concurrent 10

am getting thr following error:
"Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "download_ko.py", line 37, in download
file = urllib.request.urlopen("http://www.kegg.jp/kegg-bin/download_htext?htext=%s&format=htext&filedir=" % id)
File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/usr/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib/python3.6/urllib/request.py", line 1353, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/lib/python3.6/urllib/request.py", line 1325, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/lib/python3.6/http/client.py", line 1285, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1296, in _send_request
self.putrequest(method, url, **skips)
File "/usr/lib/python3.6/http/client.py", line 1139, in putrequest
raise InvalidURL(f"URL can't contain control characters. {url!r} "
http.client.InvalidURL: URL can't contain control characters. '/kegg-bin/download_htext?htext=<a href='/kegg-bin/show_organism?org=aaa' id="aaa">aaa00001.keg&format=htext&filedir=' (found at least ' ')
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "download_ko.py", line 114, in
main()
File "download_ko.py", line 110, in main
download_ko([i[0] for i in orgs], args.out, args.concurrent)
File "download_ko.py", line 69, in download_ko
returns.append(result.get())
File "/usr/lib/python3.6/multiprocessing/pool.py", line 644, in get
raise self._value
http.client.InvalidURL: URL can't contain control characters. '/kegg-bin/download_htext?htext=<a href='/kegg-bin/show_organism?org=aaa' id="aaa">aaa00001.keg&format=htext&filedir=' (found at least ' ')"

Kindly, any idea how to resolve it?

Thank you

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

1 participant