pyre2 icon indicating copy to clipboard operation
pyre2 copied to clipboard

Cannot import module on Python 3 (but compiling works fine)

Open wbolster opened this issue 8 years ago • 6 comments

I can't get this to work on python 3.4 (osx):

Traceback (most recent call last):
  File "url.py", line 3, in <module>
    import re2 as re
  File "re2.pyx", line 1, in init re2 (src/re2.cpp:13681)
NameError: basestring

wbolster avatar Nov 09 '15 16:11 wbolster

Same problem here with Linux Mint 17 and Python 3.4.3

NomAnor avatar Dec 02 '15 15:12 NomAnor

@wbolster how can you solve this problem ?

yabaoya avatar Apr 17 '16 14:04 yabaoya

the module isn't ported to python 3 at all, so you cannot easily work around this.

wbolster avatar Apr 18 '16 09:04 wbolster

Have a look at my fork: https://github.com/andreasvc/pyre2 I made a lot of improvements, including Python 3 compatibility.

andreasvc avatar Apr 18 '16 11:04 andreasvc

@andreasvc Thanks, you have done a great job!

VitoVan avatar Jun 29 '16 06:06 VitoVan

Quick and very dirty fix:

>>> __builtins__.basestring = str
>>> import re2
>>>

leewz avatar Feb 04 '18 14:02 leewz