TyVik / YaDiskClient

Client for cloud Yandex.Disk
MIT License
61 stars 14 forks source link

UnicodeEncodeError when working with heroku #13

Closed kuznetsov-m closed 2 years ago

kuznetsov-m commented 4 years ago

I had a very strange error.

My sketch:

login = os.environ.get('YANDEX_LOGIN', None)
password = os.environ.get('YANDEX_PASSWORD', None)
disk = YaDiskSmart(login, password)
df = disk.df()

I am using login: pro100login@yandex.ru

When calling a method from the local pc: disk.df() The method successfully returns information about ya.disk space.

But after deploying the code to heroku, calling the method raises an exception:

UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-1: ordinal not in range(256)

The sketch works successfully if I change the login, for example, to: mySecondTestEmail@yandex.ru

TyVik commented 2 years ago

I suppose you have an unicode name in the top of directory for login pro100login@yandex.ru.

Moreover, exception UnicodeEncodeError make sense only for python2 but I'll going to drop python2 support.