un33k / python-slugify

Returns unicode slugs
MIT License
1.49k stars 109 forks source link

Unicode does not work #151

Closed pomponchik closed 1 month ago

pomponchik commented 7 months ago

Hello!

I try your library with this code:

>>> from slugify import slugify
>>> text = 'Это против природы, это неестественно'
>>> slugify(text)

When i running this code, i get an exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/path_to_the_project/venv/lib/python3.7/site-packages/slugify.py", line 24, in slugify
    unicode(
NameError: name 'unicode' is not defined

I use Python 3.7.7 on MacOS darwin.

pomponchik commented 7 months ago

And if i use the allow_unicode flag with this code:

>>> from slugify import slugify
>>> text = 'Это против природы, это неестественно'
>>> slugify(text, allow_unicode=True)

... I get an another exception:

>>> slugify(text, allow_unicode=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: slugify() got an unexpected keyword argument 'allow_unicode'
un33k commented 7 months ago

All Python versions have passed their tests, including 3.7, as per: https://github.com/un33k/python-slugify/actions/runs/8115538091.

It is possible that you are running another package called slugify.

Please do the following:

$ pip freeze | grep slugify
$ pip uninstall slugify
$ pip uninstall python-slugify
$ pip install python-slugify

And try again.

$ python --version Python 3.11.4

from slugify import slugify text = 'Это против природы, это неестественно' slugify(text, allow_unicode=True) 'это-против-природы-это-неестественно' slugify(text, allow_unicode=False) 'eto-protiv-prirody-eto-neestestvenno'

un33k commented 1 month ago

This package at top level is called python-slugify and once installed, it is used as slugify.

from slugify import slugify

A top level slugify package is not maintained here.