NameError: global name 'FileNotFoundError' is not defined
See original GitHub issue- Pip version: Current master, dd3defe509d6103605d8da8270a4787f0e8ec616
- Python version: 2.7
Description:
Some pip installs on 2.7 are failing with NameError: global name 'FileNotFoundError' is not defined
. The full stack trace is
Traceback (most recent call last):
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/commands/install.py", line 332, in run
wb.build(autobuilding=True)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/wheel.py", line 716, in build
self.requirement_set.prepare_files(self.finder)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/req/req_set.py", line 381, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/req/req_set.py", line 488, in _prepare_file
req_to_install, finder)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/req/req_set.py", line 429, in _check_skip_installed
req_to_install, upgrade_allowed)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 488, in get
return self.request('GET', url, **kwargs)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 596, in send
r = adapter.send(request, **kwargs)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 37, in send
cached_response = self.controller.cached_request(request)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py", line 202, in cached_request
self.cache.delete(cache_url)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/download.py", line 302, in delete
return super(SafeFileCache, self).delete(*args, **kwargs)
File "/opt/virtualenvs/proj/lib/python2.7/site-packages/pip/_vendor/cachecontrol/caches/file_cache.py", line 117, in delete
except FileNotFoundError:
NameError: global name 'FileNotFoundError' is not defined
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Exception NameError: "global name 'FileNotFoundError' is not ...
To overcome this error of FileNotFoundError I have downgraded Pytorch from 0.4.0 version to 0.3.0. Use Pytorch 0.3.0 with Python 2, it will...
Read more >Python global name 'FileNotFoundError' is not defined
This is due to the fact FileNotFoundError exception does not occur in python2 and getmtime was called to a non-existing file (where python...
Read more >NameError: name 'FileNotFoundError' is not defined - Reddit
I run the script, and I get "NameError: name 'FileNotFoundError' is not defined".. Any ideas? I tried it and it works: I am...
Read more >How do I import FileNotFoundError from Python 3?
FileNotFoundError inherits from OSError , which means that FileNotFoundError can be caught with EnvironmentError , and it shares the same ...
Read more >where is FileNotFoundError at? - Python Forum
... File "setup_usr_local_bin.py", line 21, in exists except FileNotFoundError: NameError: global name 'FileNotFoundError' is not defined
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@xavfernandez this just landed in cachecontrol master. Is there anything I can do here to help vendor the bugfix?
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.