The following method works perfectly on my local environment, but doesn't work on PA.
import unidecode
import unicodedata as ud
from unidecode import unidecode
def createSlug(name):
slug = unidecode(name.strip()).replace(" ", "-").replace('"', '').replace("(", "").replace(")", "")
unsafe = ["&","$","+",",","/","'",";","@","#","%","<",">",":","-amp-","!","|","*", "?",".","^","[","]"]
for x in unsafe:
slug = slug.replace(x,'')
if "---" in slug:
slug = slug.replace("---", "-")
if "--" in slug:
slug = slug.replace("--", "-")
return slug.lower()
print (createSlug('á á á ééé'))
When I call it here I am getting the following error:
slug = unidecode(name.strip()).replace(" ", "-").replace('"', '').replace("(", "").replace(")", "")
TypeError: 'module' object is not callable
I have already pip installed unidecode (and upgraded it too), and I am almost sure that I have used this code at PA without any problems earlier so I can't figure out the reason why it doesn't work. I would really appreciate if somebody could give me an idea about how should I fix it.