Skip to content

ImportError: cannot import name viewkeys #336

Closed
@madelinezec

Description

@madelinezec

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions