Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Not python3 compliant #80

Closed
ashneo76 opened this issue Feb 25, 2015 · 11 comments
Closed

Not python3 compliant #80

ashneo76 opened this issue Feb 25, 2015 · 11 comments

Comments

@ashneo76
Copy link

I get the following error:

File "/usr/lib/python3.4/site-packages/fuzzywuzzy/fuzz.py", line 49, in ratio
    s1, s2 = utils.make_type_consistent(s1, s2)
  File "/usr/lib/python3.4/site-packages/fuzzywuzzy/utils.py", line 43, in make_type_consistent
    elif isinstance(s1, unicode) and isinstance(s2, unicode):
NameError: name 'unicode' is not defined
@josegonzalez
Copy link
Contributor

@ashneo76 Our tests seem to run just fine on Python 3.x in travis. Mind writing a testcase for me tthat showcases this issue?

@ashneo76
Copy link
Author

In [1]: from fuzzywuzzy import fuzz

In [2]: fuzz.ratio('24','3434')
Out[2]: 33

In [3]: fuzz.ratio(24,'3434')
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-3-7195477da1e5> in <module>()
----> 1 fuzz.ratio(24,'3434')

/usr/lib/python3.4/site-packages/fuzzywuzzy/fuzz.py in ratio(s1, s2)
     47     if s2 is None:
     48         raise TypeError("s2 is None")
---> 49     s1, s2 = utils.make_type_consistent(s1, s2)
     50
     51     if len(s1) == 0 or len(s2) == 0:

/usr/lib/python3.4/site-packages/fuzzywuzzy/utils.py in make_type_consistent(s1, s2)
     41         return s1, s2
     42
---> 43     elif isinstance(s1, unicode) and isinstance(s2, unicode):
     44         return s1, s2
     45

NameError: name 'unicode' is not defined

I guess I should convert my 'int's to strings before passing them in.

@acslater00
Copy link
Contributor

@josegonzalez yeah that's a derp. I bet we don't have a test case that hits that path.

@josegonzalez
Copy link
Contributor

@acslater00 Whats the fix in this case? I'm guessing we should have a specific test for make_type_consistent, right?

@acslater00
Copy link
Contributor

Not really, i'd have to think about it. The method doesn't really make
sense in python3

On Wed, Feb 25, 2015 at 12:37 PM, Jose Diaz-Gonzalez <
[email protected]> wrote:

@acslater00 https://github.com/acslater00 Whats the fix in this case?
I'm guessing we should have a specific test for make_type_consistent,
right?


Reply to this email directly or view it on GitHub
#80 (comment).

@cjangrist
Copy link
Contributor

Patched by defining unicode variable as a string object. Hackish but is working for me.

Full python 3 compatibility should be something to have these days though.

@NabeelahB
Copy link

I'm getting the same error. even though i have the latest version of the package installed. Any help?

@josegonzalez
Copy link
Contributor

I haven't had time to make a release yet, but I'll be working on that this weekend. Will update this issue when its up. Apologies.

@cjangrist
Copy link
Contributor

@NabeelahB did you try uninstalling and then installing using pip directly from the github repo?

>> pip uninstall fuzzywuzzy
>> pip install git+https://github.com/seatgeek/fuzzywuzzy

@NabeelahB
Copy link

This worked!
Thanks :)
On Fri, Jul 3, 2015 at 5:20 AM, Carlos Garay [email protected]
wrote:

@NabeelahB https://github.com/NabeelahB did you try uninstalling and
then installing using pip directly from the github repo?

pip uninstall fuzzywuzzy>> pip install git+https://github.com/seatgeek/fuzzywuzzy


Reply to this email directly or view it on GitHub
#80 (comment).

@gjcarneiro
Copy link

I notice there was a release recently. I guess this issue can be closed?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants