TypeError: аргумент ljust() 2 должен быть символом, а не Unicode

Я получаю следующую ошибку при использовании библиотеки s2sphere в python2.7 в этом месте.

ljust() argument 2 must be char, not unicode

Метод - ссылка на файл на GH:

    @classmethod
    def from_token(cls, token):
        """Creates a CellId from a hex encoded cell id string, called a token.
        :param str token:
            A hex representation of the cell id. If the input is shorter than
            16 characters, zeros are appended on the right.
        """
        return cls(int(token.ljust(16, '0'), 16))

Кажется, что файл имеет кодировку ASCII, поэтому я ломаю голову, почему я вижу это

1 ответ

Файл импортирует unicode_literals вверху:

from __future__ import print_function, unicode_literals, division

Следовательно, '0' - это строка Unicode, а параметр 'token' должен быть Unicode, чтобы соответствовать

Другие вопросы по тегам