question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New installation on Cray: Traceback from backoff import BackoffLatinLemmatizer LatinLanguageVars _re_non_word_chars = PunktLanguageVars._re_non_word_chars.replace("'", "") AttributeError: 'property' object has no attribute 'replace'

See original GitHub issue

Our team has been using CLTK on administered CRAY academic computers since last July to lemmatize a digital edition of the medieval philosopher Richard Rufus of Cornwall, all Latin.

The team member who led our adoption of CLTK has found a new position, and in anticipation of training a replacement, three days ago, I installed CLTK according to current installation instructions for developers on an account where we had not installed it before.

We have a python script with the informative name lemmas.py but whose opening lines call backoff.py:

import os
import re

# LEMMATIZATION
backoff = open("backoff.py", "r")
from backoff import BackoffLatinLemmatizer
lemmatizer = BackoffLatinLemmatizer()

My colleague has added the Thomist lemmas, morelemmas, and ourlemmas (additions) following the paradigm in backoff, and that program has been working well for months.

Under the new installation, I see the following:

(venv) whooper@elogin1:/N/slate/whooper/rufus/demo> python3 lemmas.py
Traceback (most recent call last):
  File "lemmas.py", line 9, in <module>
    from backoff import BackoffLatinLemmatizer
  File "/N/.../demo/backoff.py", line 18, in <module>
    from cltk.lemmatize.backoff import DefaultLemmatizer, IdentityLemmatizer, DictLemmatizer, RegexpLemmatizer, UnigramLemmatizer
  File "/...(my user).../venv/lib/python3.8/site-packages/cltk/__init__.py", line 5, in <module>
    from .nlp import NLP
  File "/...(my user).../venv/lib/python3.8/site-packages/cltk/nlp.py", line 9, in <module>
    from cltk.languages.pipelines import (
  File "/...(my user).../venv/lib/python3.8/site-packages/cltk/languages/pipelines.py", line 48, in <module>
    from cltk.tokenizers.processes import (
  File "/...(my user).../venv/lib/python3.8/site-packages/cltk/tokenizers/__init__.py", line 3, in <module>
    from .processes import *
  File "/...(my user).../venv/lib/python3.8/site-packages/cltk/tokenizers/processes.py", line 18, in <module>
    from cltk.tokenizers.lat.lat import LatinWordTokenizer
  File "/...(my user).../venv/lib/python3.8/site-packages/cltk/tokenizers/lat/lat.py", line 14, in <module>
    from cltk.sentence.lat import LatinPunktSentenceTokenizer
  File "/...(my user)...venv/lib/python3.8/site-packages/cltk/sentence/lat.py", line 25, in <module>
    class LatinLanguageVars(PunktLanguageVars):
  File "/...(my user).../venv/lib/python3.8/site-packages/cltk/sentence/lat.py", line 26, in LatinLanguageVars
    _re_non_word_chars = PunktLanguageVars._re_non_word_chars.replace("'", "")
AttributeError: 'property' object has no attribute 'replace'

I tried to trace the opening steps in our lemmas.py program, but the debugging caret dives into cltk libraries immediately after trying to execute our copy of backoff.py, as you can see from the Traceout.

Does this error look familiar? Is this installation instance missing a file? I think all the named files are there but I haven’t paid close attention before. Can you advise? It is an administered environment but we are free to use venv and the previous installation of CLTK worked very smoothly.

By the way, we all think CLTK is great, well done.

Thanks, Wally Hooper Chymistry of Isaac Newton Project/Richard Rufus Project Indiana University, Bloomington

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alexeyevcommented, Nov 9, 2022

I strongly recommend using the latest version

Yes, I think I’m going to rewrite everything using the latest CLTK stable version API to be able to support our own codebase later. Thank you!

1reaction
kylepjohnsoncommented, Nov 9, 2022

@alexeyev We do not support the 0.x versions anymore, but we’re glad to hear they still work!

To upgrade to the latest 1.x, you would do pip install -U cltk but I have to warn you that almost everything in it is different. You can read more here: https://docs.cltk.org/en/latest/quickstart.html

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to solve "AttributeError: 'property' object has no attribute ...
I am importing matplotlib.pyplot as plt. '''import matplotlib.pyplot as plt'''. enter image description here.
Read more >
AttributeError: 'property' object has no attribute 'replace' : PY ...
Hello I'm trying to debug one example which I got from nordic semi (they are major BLuetooth chip developers). You can get library...
Read more >
backoff - PyPI
This module provides function decorators which can be used to wrap a function such that it will be retried until some condition is...
Read more >
Solved: AttributeError: 'property' object has no attribute 'add'
I am interested in my event to be triggered when any command is triggered, and I don't want to create a new command....
Read more >
Getting Started — Backoff-Utils 1.0.1 documentation
Once installed, to import Backoff-Utils into your project you can use: ... which is a drop-in replacement for Python 2.7's (buggy) standard re...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found