Skip to content

NameError: global name 'FileNotFoundError' is not defined #4322

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

Closed
grokcode opened this issue Mar 7, 2017 · 9 comments · Fixed by #4353
Closed

NameError: global name 'FileNotFoundError' is not defined #4322

grokcode opened this issue Mar 7, 2017 · 9 comments · Fixed by #4353
Labels
auto-locked Outdated issues that have been locked by automation
Milestone

Comments

@grokcode
Copy link

grokcode commented Mar 7, 2017

  • Pip version:
    Current master, dd3defe
  • 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
@xavfernandez
Copy link
Member

Thanks for the report.
We'll vendor the bugfix once it has landed in cachecontrol :)

@xavfernandez xavfernandez added this to the 9.1 milestone Mar 8, 2017
@grokcode
Copy link
Author

@xavfernandez this just landed in cachecontrol master. Is there anything I can do here to help vendor the bugfix?

@dstufft
Copy link
Member

dstufft commented Mar 14, 2017

@grokcode Um, well once @ionrock cuts a new release of CacheControl we'll pull it in automatically on the next release of pip.

@grokcode
Copy link
Author

Thanks for the update @dstufft.

@ionrock
Copy link

ionrock commented Mar 14, 2017

I just released 0.12.1.

@xavfernandez
Copy link
Member

Closed by #4342. A change log is still missing though :)

dstufft added a commit to dstufft/pip that referenced this issue Mar 20, 2017
dstufft added a commit that referenced this issue Mar 20, 2017
@digitalstem
Copy link

NameError: global name 'get_page' is not defined

am getting the following error what to do.... please help itz urgent

@pradyunsg
Copy link
Member

@digitalstem I imagine you'd want to seek inputs from other channels such as python-list or python-tutor mailing lists, #python on Freenode (IRC) or StackOverflow -- they would be better channels to get support for the issue you're facing.

@lock
Copy link

lock bot commented Jun 2, 2019

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.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants