jmcarp / robobrowser

BSD 3-Clause "New" or "Revised" License
3.7k stars 337 forks source link

Broken on Python 3.7 - access to re._pattern_type in Browser.get_link() #87

Open jbarlow83 opened 6 years ago

jbarlow83 commented 6 years ago

In robobrowser.RoboBrowser.get_link()

  File "/usr/local/lib/python3.7/site-packages/robobrowser/browser.py", line 269, in get_link
    self.parsed, _link_ptn, text=text, *args, **kwargs
  File "/usr/local/lib/python3.7/site-packages/robobrowser/helpers.py", line 51, in find
    soup, name, attrs or {}, recursive, text, 1, **kwargs
  File "/usr/local/lib/python3.7/site-packages/robobrowser/helpers.py", line 39, in find_all
    if match_text(text, tag):
  File "/usr/local/lib/python3.7/site-packages/robobrowser/helpers.py", line 16, in match_text
    if isinstance(text, re._pattern_type):
AttributeError: module 're' has no attribute '_pattern_type'

See also https://github.com/python/cpython/pull/1646

jbarlow83 commented 6 years ago

Users can work around the issue by setting import re; re._pattern_type = re.Pattern prior to making any calls to the robobrowser module.