axiak / pyre2

Python wrapper for RE2
BSD 3-Clause "New" or "Revised" License
295 stars 39 forks source link

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

Open wbolster opened 8 years ago

wbolster commented 8 years ago

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
NomAnor commented 8 years ago

Same problem here with Linux Mint 17 and Python 3.4.3

yabaoya commented 8 years ago

@wbolster how can you solve this problem ?

wbolster commented 8 years ago

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

andreasvc commented 8 years ago

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

VitoVan commented 8 years ago

@andreasvc Thanks, you have done a great job!

leewz commented 6 years ago

Quick and very dirty fix:

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