{"action":"created","issue":{"url":"https://api.github.com/repos/SethMMorton/natsort/issues/22","labels_url":"https://api.github.com/repos/SethMMorton/natsort/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/SethMMorton/natsort/issues/22/comments","events_url":"https://api.github.com/repos/SethMMorton/natsort/issues/22/events","html_url":"https://github.com/SethMMorton/natsort/issues/22","id":65999847,"number":22,"title":"Python3 \"unorderable types\" error with TYPESAFE","user":{"login":"tallforasmurf","id":1137018,"avatar_url":"https://avatars.githubusercontent.com/u/1137018?v=3","gravatar_id":"","url":"https://api.github.com/users/tallforasmurf","html_url":"https://github.com/tallforasmurf","followers_url":"https://api.github.com/users/tallforasmurf/followers","following_url":"https://api.github.com/users/tallforasmurf/following{/other_user}","gists_url":"https://api.github.com/users/tallforasmurf/gists{/gist_id}","starred_url":"https://api.github.com/users/tallforasmurf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tallforasmurf/subscriptions","organizations_url":"https://api.github.com/users/tallforasmurf/orgs","repos_url":"https://api.github.com/users/tallforasmurf/repos","events_url":"https://api.github.com/users/tallforasmurf/events{/privacy}","received_events_url":"https://api.github.com/users/tallforasmurf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-02T19:57:19Z","updated_at":"2015-04-02T22:14:24Z","closed_at":null,"body":"The test case is quite simple,\r\n\r\n    kf = natsort.natsort_keygen( alg = (natsort.ns.LOCALE | natsort.ns.TYPESAFE ) )\r\n    ll = ['0','Á','2','Z']\r\n    sorted(ll,key=kf)\r\n    Traceback (most recent call last):\r\n        File \"<string>\", line 1, in <fragment>\r\n        builtins.TypeError: unorderable types: bytes() < str()\r\n\r\nThe issue seems to be that when the input key is numeric e.g. '2', the output of kf is ('',2), where the first element is the null string. When the input key is a letter, the output is e.g. ``(b'*\\x05 \\x01E\\x88\\x01\\x06\\x00',)`` where the first element is bytes.\r\n\r\nFrankly I don't understand how kf can return a tuple in any case, since docs for sorted() (and for SortedDict, which is where I actually hit this) seem to imply it should return a scalar item. But whatever -- if in the case of a number it returned ``b''`` instead of just ``''`` I think all would be well. I believe this would be line 135 of utils.py?"},"comment":{"url":"https://api.github.com/repos/SethMMorton/natsort/issues/comments/89060082","html_url":"https://github.com/SethMMorton/natsort/issues/22#issuecomment-89060082","issue_url":"https://api.github.com/repos/SethMMorton/natsort/issues/22","id":89060082,"user":{"login":"SethMMorton","id":1596189,"avatar_url":"https://avatars.githubusercontent.com/u/1596189?v=3","gravatar_id":"","url":"https://api.github.com/users/SethMMorton","html_url":"https://github.com/SethMMorton","followers_url":"https://api.github.com/users/SethMMorton/followers","following_url":"https://api.github.com/users/SethMMorton/following{/other_user}","gists_url":"https://api.github.com/users/SethMMorton/gists{/gist_id}","starred_url":"https://api.github.com/users/SethMMorton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SethMMorton/subscriptions","organizations_url":"https://api.github.com/users/SethMMorton/orgs","repos_url":"https://api.github.com/users/SethMMorton/repos","events_url":"https://api.github.com/users/SethMMorton/events{/privacy}","received_events_url":"https://api.github.com/users/SethMMorton/received_events","type":"User","site_admin":false},"created_at":"2015-04-02T22:14:24Z","updated_at":"2015-04-02T22:14:24Z","body":"I think I see the origin of the problem.  I'm at work on a linux machine without `PyICU`, and apparently the return value of `locale` and `PyICU` are not the same.  I will take a look at this when I get home tonight on my Mac.\r\n\r\nThis does need to be fixed.  Thanks for finding this bug.  "}}