{"action":"created","issue":{"url":"https://api.github.com/repos/Lekensteyn/lglaf/issues/6","repository_url":"https://api.github.com/repos/Lekensteyn/lglaf","labels_url":"https://api.github.com/repos/Lekensteyn/lglaf/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/Lekensteyn/lglaf/issues/6/comments","events_url":"https://api.github.com/repos/Lekensteyn/lglaf/issues/6/events","html_url":"https://github.com/Lekensteyn/lglaf/issues/6","id":147521675,"number":6,"title":"Windows 10 file read failed","user":{"login":"IndustrialMuffin","id":6829019,"avatar_url":"https://avatars.githubusercontent.com/u/6829019?v=3","gravatar_id":"","url":"https://api.github.com/users/IndustrialMuffin","html_url":"https://github.com/IndustrialMuffin","followers_url":"https://api.github.com/users/IndustrialMuffin/followers","following_url":"https://api.github.com/users/IndustrialMuffin/following{/other_user}","gists_url":"https://api.github.com/users/IndustrialMuffin/gists{/gist_id}","starred_url":"https://api.github.com/users/IndustrialMuffin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IndustrialMuffin/subscriptions","organizations_url":"https://api.github.com/users/IndustrialMuffin/orgs","repos_url":"https://api.github.com/users/IndustrialMuffin/repos","events_url":"https://api.github.com/users/IndustrialMuffin/events{/privacy}","received_events_url":"https://api.github.com/users/IndustrialMuffin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-11T19:01:54Z","updated_at":"2016-04-15T16:16:13Z","closed_at":null,"body":"Running on Windows 10, I had trouble with file operations.  Made a few changes and it worked:\r\n```\r\nimport os\r\nclass FileCommunication(Communication):\r\n    def __init__(self, file_path):\r\n        super(FileCommunication, self).__init__()\r\n        if sys.version_info[0] >= 3:\r\n            self.f = os.open(file_path, os.O_RDWR | os.O_BINARY)\r\n        else:\r\n            self.f = os.open(file_path, os.O_RDWR | os.O_BINARY)\r\n    def _read(self, n, timeout=None):\r\n        try:\r\n            return os.read(self.f,n)\r\n        except IOError as e:\r\n            _logger.warning(\"failed to read\")\r\n            raise e\r\n    def write(self, data):\r\n        os.write(self.f,data)\r\n    def close(self):\r\n        os.close(self.f)\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Lekensteyn/lglaf/issues/comments/210526422","html_url":"https://github.com/Lekensteyn/lglaf/issues/6#issuecomment-210526422","issue_url":"https://api.github.com/repos/Lekensteyn/lglaf/issues/6","id":210526422,"user":{"login":"IndustrialMuffin","id":6829019,"avatar_url":"https://avatars.githubusercontent.com/u/6829019?v=3","gravatar_id":"","url":"https://api.github.com/users/IndustrialMuffin","html_url":"https://github.com/IndustrialMuffin","followers_url":"https://api.github.com/users/IndustrialMuffin/followers","following_url":"https://api.github.com/users/IndustrialMuffin/following{/other_user}","gists_url":"https://api.github.com/users/IndustrialMuffin/gists{/gist_id}","starred_url":"https://api.github.com/users/IndustrialMuffin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IndustrialMuffin/subscriptions","organizations_url":"https://api.github.com/users/IndustrialMuffin/orgs","repos_url":"https://api.github.com/users/IndustrialMuffin/repos","events_url":"https://api.github.com/users/IndustrialMuffin/events{/privacy}","received_events_url":"https://api.github.com/users/IndustrialMuffin/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T16:16:13Z","updated_at":"2016-04-15T16:16:13Z","body":"I guess there was no good reason for trapping IOError for _read.\r\n\r\nI thought about folding Python 2 vs 3 case, but thought I'd leave the cases split up like they were before, just in case they'd need to be handled differently since  I only tried it on Python 2.\r\n\r\nThe errors I got were:\r\n\r\n`Traceback (most recent call last):\r\n  File \"lglaf.py\", line 404, in <module>\r\n    main()\r\n  File \"lglaf.py\", line 386, in main\r\n    try_hello(comm)\r\n  File \"lglaf.py\", line 290, in try_hello\r\n    data = comm.read(0x20, timeout=HELLO_READ_TIMEOUT)\r\n  File \"lglaf.py\", line 148, in read\r\n    buff = self._read(need, timeout=timeout)\r\n  File \"lglaf.py\", line 189, in _read\r\n    return self.f.read(n)\r\nIOError: [Errno 0] Error`\r\n"}}