{"action":"created","issue":{"url":"https://api.github.com/repos/FreeOpcUa/python-opcua/issues/211","repository_url":"https://api.github.com/repos/FreeOpcUa/python-opcua","labels_url":"https://api.github.com/repos/FreeOpcUa/python-opcua/issues/211/labels{/name}","comments_url":"https://api.github.com/repos/FreeOpcUa/python-opcua/issues/211/comments","events_url":"https://api.github.com/repos/FreeOpcUa/python-opcua/issues/211/events","html_url":"https://github.com/FreeOpcUa/python-opcua/issues/211","id":160441454,"number":211,"title":"etoken does not support python2","user":{"login":"hunterjackson","id":6844618,"avatar_url":"https://avatars.githubusercontent.com/u/6844618?v=3","gravatar_id":"","url":"https://api.github.com/users/hunterjackson","html_url":"https://github.com/hunterjackson","followers_url":"https://api.github.com/users/hunterjackson/followers","following_url":"https://api.github.com/users/hunterjackson/following{/other_user}","gists_url":"https://api.github.com/users/hunterjackson/gists{/gist_id}","starred_url":"https://api.github.com/users/hunterjackson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hunterjackson/subscriptions","organizations_url":"https://api.github.com/users/hunterjackson/orgs","repos_url":"https://api.github.com/users/hunterjackson/repos","events_url":"https://api.github.com/users/hunterjackson/events{/privacy}","received_events_url":"https://api.github.com/users/hunterjackson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-15T14:48:40Z","updated_at":"2016-06-15T15:18:30Z","closed_at":null,"body":"In file client.py, under the class `Client`, in the function `activate_session()`. When the etoken is generated it uses the `bytes` function in a way that is only compatible with python3. \r\n\r\nTo solve the problem I replaced this line  \r\n`etoken = ua.pack_bytes(bytes(password, \"utf8\") + self._server_nonce)`\r\n\r\nwith this  \r\n```python\r\ntry:  \r\n    etoken = ua.pack_bytes(bytes(password, \"utf8\") + self._server_nonce)  \r\nexcept TypeError:  \r\n    etoken = ua.pack_bytes(bytes(password) + self._server_nonce)\r\n```\r\n\r\nI'd submit a pull request but I'm not sure if this is an all inclusive fix, there maybe some stuff with unicode that will be needed to handle all situations"},"comment":{"url":"https://api.github.com/repos/FreeOpcUa/python-opcua/issues/comments/226220512","html_url":"https://github.com/FreeOpcUa/python-opcua/issues/211#issuecomment-226220512","issue_url":"https://api.github.com/repos/FreeOpcUa/python-opcua/issues/211","id":226220512,"user":{"login":"oroulet","id":2564046,"avatar_url":"https://avatars.githubusercontent.com/u/2564046?v=3","gravatar_id":"","url":"https://api.github.com/users/oroulet","html_url":"https://github.com/oroulet","followers_url":"https://api.github.com/users/oroulet/followers","following_url":"https://api.github.com/users/oroulet/following{/other_user}","gists_url":"https://api.github.com/users/oroulet/gists{/gist_id}","starred_url":"https://api.github.com/users/oroulet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oroulet/subscriptions","organizations_url":"https://api.github.com/users/oroulet/orgs","repos_url":"https://api.github.com/users/oroulet/repos","events_url":"https://api.github.com/users/oroulet/events{/privacy}","received_events_url":"https://api.github.com/users/oroulet/received_events","type":"User","site_admin":false},"created_at":"2016-06-15T15:18:30Z","updated_at":"2016-06-15T15:18:30Z","body":"Should be possible to find a syntax that works both for python 2 and 3...\npassword.encode('utf-8').. maybe?\n\nOn Wed, Jun 15, 2016, 16:48 Hunter Jackson <notifications@github.com> wrote:\n\n> In file client.py, under the class Client, in the function\n> activate_session(). When the etoken is generated it uses the bytes\n> function in a way that is only compatible with python3.\n>\n> To solve the problem I replaced this line\n>\n> etoken = ua.pack_bytes(bytes(password, \"utf8\") + self._server_nonce)\n>\n> with this\n>\n> try:\n>     etoken = ua.pack_bytes(bytes(password, \"utf8\") + self._server_nonce)  except TypeError:\n>     etoken = ua.pack_bytes(bytes(password) + self._server_nonce)\n>\n> I'd submit a pull request but I'm not sure if this is an all inclusive\n> fix, there maybe some stuff with unicode that will be needed to handle all\n> situations\n>\n> —\n> You are receiving this because you are subscribed to this thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/FreeOpcUa/python-opcua/issues/211>, or mute the thread\n> <https://github.com/notifications/unsubscribe/ACcfzhPY8meBF8Q8WJnfIpYP1ucL2lYCks5qMBDJgaJpZM4I2cGK>\n> .\n>\n"}}
{"actor":{"display_login":"oroulet"}}