stravalib icon indicating copy to clipboard operation
stravalib copied to clipboard

Hit "NameError: name 'unicode' is not defined" for python 3

Open yvetterowe opened this issue 3 years ago • 2 comments

Hit the following error after bumping to 0.10.3

File "/opt/hostedtoolcache/Python/3.6.14/x64/lib/python3.6/site-packages/stravalib/client.py", line 1658, in __next__
    return self.next()
  File "/opt/hostedtoolcache/Python/3.6.14/x64/lib/python3.6/site-packages/stravalib/client.py", line 1664, in next
    self._fill_buffer()
  File "/opt/hostedtoolcache/Python/3.6.14/x64/lib/python3.6/site-packages/stravalib/client.py", line 1639, in _fill_buffer
    entities.append(self.entity.deserialize(raw, bind_client=self.bind_client))
  File "/opt/hostedtoolcache/Python/3.6.14/x64/lib/python3.6/site-packages/stravalib/model.py", line 135, in deserialize
    o.from_dict(v)
  File "/opt/hostedtoolcache/Python/3.6.14/x64/lib/python3.6/site-packages/stravalib/model.py", line 68, in from_dict
    setattr(self, k, v)
  File "/opt/hostedtoolcache/Python/3.6.14/x64/lib/python3.6/site-packages/stravalib/attributes.py", line 57, in __set__
    self.data[obj] = self.unmarshal(val)
  File "/opt/hostedtoolcache/Python/3.6.14/x64/lib/python3.6/site-packages/stravalib/attributes.py", line 237, in unmarshal
    if isinstance(v, str) or isinstance(v, unicode):
NameError: name 'unicode' is not defined

Is the ideal fix here to replace unicode by str? Will that break the support for Python 2.7? Happy to open a PR if it makes sense.

yvetterowe avatar Aug 18 '21 00:08 yvetterowe

https://github.com/yvetterowe/running_page/actions/runs/1141306749 Got a green run now with https://github.com/hozn/stravalib/pull/218!

yvetterowe avatar Aug 18 '21 00:08 yvetterowe

Thanks so much! I need to fix my local test env. I'll get this fixed. Must have accepted an MR that didn't use six.text_type.

On Tue, Aug 17, 2021, 20:35 Hao Luo @.***> wrote:

https://github.com/yvetterowe/running_page/actions/runs/1141306749 Got a green run now with #218 https://github.com/hozn/stravalib/pull/218!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hozn/stravalib/issues/217#issuecomment-900723926, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC7WA64DBBXZDZY2BP5W53T5L55VANCNFSM5CK4X7JQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

hozn avatar Aug 18 '21 00:08 hozn

Closing, as this seems to be resolved

jsamoocha avatar Mar 06 '23 12:03 jsamoocha