Skip to content

ImportError: cannot import name viewkeys #336

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
madelinezec opened this issue Apr 27, 2017 · 7 comments
Closed

ImportError: cannot import name viewkeys #336

madelinezec opened this issue Apr 27, 2017 · 7 comments
Milestone

Comments

@madelinezec
Copy link

madelinezec commented Apr 27, 2017

I have python code that uses mechanize to login to a website. With six==1.4.1 and six==1.10.0, I get this error:

Traceback (most recent call last):
  File "scrapeRecipe.py", line 31, in <module>
    br.select_form(name="aspnetForm")
  File "/Library/Python/2.7/site-packages/mechanize/_mechanize.py", line 619, in select_form
    global_form = self._factory.global_form
  File "/Library/Python/2.7/site-packages/mechanize/_html.py", line 260, in global_form
    self.forms()
  File "/Library/Python/2.7/site-packages/mechanize/_html.py", line 267, in forms
    self._current_forms, self._current_global_form = self._get_forms()
  File "/Library/Python/2.7/site-packages/mechanize/_html.py", line 282, in _get_forms
    if self.root is None:
  File "/Library/Python/2.7/site-packages/mechanize/_html.py", line 247, in root
    response, verify=False))
  File "/Library/Python/2.7/site-packages/mechanize/_html.py", line 145, in content_parser
    from html5lib import parse
  File "/Library/Python/2.7/site-packages/html5lib/__init__.py", line 16, in <module>
    from .html5parser import HTMLParser, parse, parseFragment
  File "/Library/Python/2.7/site-packages/html5lib/html5parser.py", line 2, in <module>
    from six import with_metaclass, viewkeys, PY3
ImportError: cannot import name viewkeys

This appears to similar to this post, except changing the version of six package didn't fix anything.

@jakearchibald
Copy link

I'm also getting this error when trying to run Bikeshed

@jakearchibald
Copy link

I "fixed" it by doing

sudo pip install --ignore-installed six

@yell0wd0g
Copy link

I got the same problem and the same solution, thanks @jakearchibald ! (+@tabatkins FYI)

@Martin-Pitt
Copy link

Thanks @jakearchibald. I had the same problem but when installing Bikeshed for the first time on OSX. Seems to be working now with your solution.

@tabatkins
Copy link

And I've updated the Bikeshed docs accordingly. Thanks!

@willkg willkg added this to the 1.0 milestone Oct 3, 2017
@Chronial
Copy link

This should already be fixed and is basically a duplicate of #301.

@willkg
Copy link
Contributor

willkg commented Nov 10, 2017

@Chronial Awesome--thanks!

@willkg willkg closed this as completed Nov 10, 2017
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

7 participants