dedupe icon indicating copy to clipboard operation
dedupe copied to clipboard

AttributeError: 'NoneType' object has no attribute '_doc_to_id'

Open Sushant20 opened this issue 7 years ago • 8 comments

Team, We are facing this error while using markPairs method File "C:\Users\Python3\lib\site-packages\dedupe\predicates.py", line 147, in call doc_id = self.index._doc_to_id[doc] AttributeError: 'NoneType' object has no attribute '_doc_to_id'

Also, I couldn't find any code piece in which self.index is initialized to some other value other than None in predicates.py

Please guide me, if I am missing anything

@fgregg

Sushant20 avatar Jun 12 '19 11:06 Sushant20

Hi I had the same issue. I met it when I readTraining file. And it only happens recently. I believe previously I successfully readTraining without getting this error. Did you make any changes in the source code?

monicatao avatar Jun 16 '19 22:06 monicatao

@Sushant20 Yes, from what I see from the code, this regression was introduced when merging the #720 pull request into master. In the meantime, I guess our only solution is to revert to using version 1.9.6. Regarding the point where the 'index' attribute of a Predicate instance is set to something else than 'None', it is in the 'blocking.py' module (and can also be set to an 'initialized index' somewhere in the 'api.py' module).

FrancoisNoyez avatar Jun 27 '19 09:06 FrancoisNoyez

Hi! I had the same issue too. And solved it by revert to using version 1.9.6.

gccj avatar Jul 11 '19 09:07 gccj

Could someone please post code that would allow me to reproduce this error.

fgregg avatar Jul 21 '19 19:07 fgregg

and a full traceback

fgregg avatar Jul 21 '19 19:07 fgregg

You can reproduce the error by taking your csv_example and simply changing line 110 of csv_example.py from: deduper.sample(data_d, 15000) to: deduper.sample(data_d, 300) Then, run it twice, deleting the csv_example_learned_settings file between the two runs. On the second run, you'll receive an error. Attached is the traceback I got from doing this. traceback.txt

I used release 1.9.7.

EfremBraun avatar Jul 22 '19 13:07 EfremBraun

started on a fix in #761, if you'd like to check that out.

fgregg avatar Jul 22 '19 15:07 fgregg

fixed by #761. new version of dedupe on pypi.

fgregg avatar Aug 09 '19 15:08 fgregg