{"action":"created","issue":{"url":"https://api.github.com/repos/RichIsMyName/PicklingToolsRepo/issues/1","labels_url":"https://api.github.com/repos/RichIsMyName/PicklingToolsRepo/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/RichIsMyName/PicklingToolsRepo/issues/1/comments","events_url":"https://api.github.com/repos/RichIsMyName/PicklingToolsRepo/issues/1/events","html_url":"https://github.com/RichIsMyName/PicklingToolsRepo/issues/1","id":129905956,"number":1,"title":"xl.expectXML() gives error in Python 3.x","user":{"login":"geo1590","id":16965885,"avatar_url":"https://avatars.githubusercontent.com/u/16965885?v=3","gravatar_id":"","url":"https://api.github.com/users/geo1590","html_url":"https://github.com/geo1590","followers_url":"https://api.github.com/users/geo1590/followers","following_url":"https://api.github.com/users/geo1590/following{/other_user}","gists_url":"https://api.github.com/users/geo1590/gists{/gist_id}","starred_url":"https://api.github.com/users/geo1590/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geo1590/subscriptions","organizations_url":"https://api.github.com/users/geo1590/orgs","repos_url":"https://api.github.com/users/geo1590/repos","events_url":"https://api.github.com/users/geo1590/events{/privacy}","received_events_url":"https://api.github.com/users/geo1590/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-29T22:57:14Z","updated_at":"2016-02-01T15:07:08Z","closed_at":null,"body":"Is this the place to report bugs found?\r\n\r\nI found a bug in versions 1.6.0 and 1.6.1 using python 3.3.2. Here is how to fix the bug.\r\n\r\n\r\nI converted the Pickling Tools code from python 2.x to 3.x using this method:\r\n-------------------------------------------\r\n   % cd PicklingTools161Release\r\n   % 2to3 -w *\r\n        # This converts the python source code from python 2.x to python 3.x.\r\n\r\n   % sudo apt-get install python3-examples\r\n        # This is needed to use the reindent.py script used to make spacing and indentations \r\nconsistent.\r\n\r\n   % /usr/share/doc/python3.4/examples/scripts/reindent.py --recurse --verbose .\r\n\r\n\r\nWhen I run this code on Python 3.3.2:\r\n-------------------------------------------\r\nfrom xmlloader import *\r\nxml_text = '<tag>123 #12</tag>'\r\nxl = XMLLoader(xml_text, XML_LOAD_EVAL_CONTENT)\r\nxl.expectXML()\r\n\r\n\r\nI get this error message. It errors on ‘xl.expectXML()’:\r\n-------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/opt/python/all_versions/lib/PicklingTools160Release/Python/xmlloader.py\", line 186, in expectXML\r\n    self._handleXMLDeclaration()\r\n  File \"/opt/python/all_versions/lib/PicklingTools160Release/Python/xmlloader.py\", line 213, in _handleXMLDeclaration\r\n    cc = self._peekNWSChar()\r\n  File \"/opt/python/all_versions/lib/PicklingTools160Release/Python/xmlloader.py\", line 1225, in _peekNWSChar\r\n    def _peekNWSChar(self)   : return self.reader_._peekNWSChar()\r\n  File \"/opt/python/all_versions/lib/PicklingTools160Release/Python/parsereader.py\", line 194, in _peekNWSChar\r\n    index = self._indexOfNextNWSChar()\r\n  File \"/opt/python/all_versions/lib/PicklingTools160Release/Python/xmlloader.py\", line 1252, in _indexOfNextNWSChar\r\n    while (cur<len and self.buffer_[cur].isspace()) :\r\nTypeError: unorderable types: int() < builtin_function_or_method()\r\n\r\nHere is my quick fix:\r\n-------------------------------------------\r\n   % cd PicklingTools161Release\r\n   % sudo vi Python/xmlloader.py\r\n        # Search for 'def _indexOfNextNWSChar'\r\n\r\n        # The original code will be this:\r\n            def _indexOfNextNWSChar (self) :\r\n                length = len(self.buffer_)\r\n                cur = self.current_\r\n                if (cur==len) : return cur;\r\n                while (cur<len and self.buffer_[cur].isspace()) :\r\n                    cur +=1\r\n                return cur\r\n\r\n        # The fix is the following. Notice that the variable is 'length' and 'len' is the built-in function.\r\n            def _indexOfNextNWSChar (self) :\r\n                length = len(self.buffer_)\r\n                cur = self.current_\r\n                if (cur==length) : return cur;\r\n                while (cur<length and self.buffer_[cur].isspace()) :\r\n                    cur +=1\r\n                return cur\r\n\r\n\r\nUse the following code to test the fix in python 3.x:\r\n-------------------------------------------\r\nfrom xmlloader import *\r\nxml_text = '<tag>123 #12</tag>'\r\nxl = XMLLoader(xml_text, XML_LOAD_EVAL_CONTENT)\r\nxl.expectXML()\r\n\r\nThanks,\r\n"},"comment":{"url":"https://api.github.com/repos/RichIsMyName/PicklingToolsRepo/issues/comments/178007292","html_url":"https://github.com/RichIsMyName/PicklingToolsRepo/issues/1#issuecomment-178007292","issue_url":"https://api.github.com/repos/RichIsMyName/PicklingToolsRepo/issues/1","id":178007292,"user":{"login":"RichIsMyName","id":15126535,"avatar_url":"https://avatars.githubusercontent.com/u/15126535?v=3","gravatar_id":"","url":"https://api.github.com/users/RichIsMyName","html_url":"https://github.com/RichIsMyName","followers_url":"https://api.github.com/users/RichIsMyName/followers","following_url":"https://api.github.com/users/RichIsMyName/following{/other_user}","gists_url":"https://api.github.com/users/RichIsMyName/gists{/gist_id}","starred_url":"https://api.github.com/users/RichIsMyName/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RichIsMyName/subscriptions","organizations_url":"https://api.github.com/users/RichIsMyName/orgs","repos_url":"https://api.github.com/users/RichIsMyName/repos","events_url":"https://api.github.com/users/RichIsMyName/events{/privacy}","received_events_url":"https://api.github.com/users/RichIsMyName/received_events","type":"User","site_admin":false},"created_at":"2016-02-01T15:07:08Z","updated_at":"2016-02-01T15:07:08Z","body":"Hi,\nThanks for the code! I'll take a look at it and probably put it out in the next release.\nWe don't use Python 3 (yet), as we have so much infrastructure and C extension modulesfor 2X.  Someday we'll make that transition. ;)\n  Gooday,\n  Richie\n\n \n\n      From: geo1590 <notifications@github.com>\n To: RichIsMyName/PicklingToolsRepo <PicklingToolsRepo@noreply.github.com> \n Sent: Friday, January 29, 2016 3:57 PM\n Subject: [PicklingToolsRepo] xl.expectXML() gives error in Python 3.x (#1)\n   \nIs this the place to report bugs found?I found a bug in versions 160 and 161 using python 332 Here is how to fix the bug\nI converted the Pickling Tools code from python 2x to 3x using this method:\n% cd PicklingTools161Release\n % 2to3 -w *\n # This converts the python source code from python 2x to python 3x% sudo apt-get install python3-examples\n # This is needed to use the reindentpy script used to make spacing and indentations \nconsistent% /usr/share/doc/python34/examples/scripts/reindentpy --recurse --verbose \nWhen I run this code on Python 332:\nfrom xmlloader import *\nxml_text = '123 #12'\nxl = XMLLoader(xml_text, XML_LOAD_EVAL_CONTENT)\nxlexpectXML()\nI get this error message It errors on ‘xlexpectXML()’:\nTraceback (most recent call last):\n File \"\", line 1, in \n File \"/opt/python/all_versions/lib/PicklingTools160Release/Python/xmlloaderpy\", line 186, in expectXML\n self_handleXMLDeclaration()\n File \"/opt/python/all_versions/lib/PicklingTools160Release/Python/xmlloaderpy\", line 213, in handleXMLDeclaration\n cc = self_peekNWSChar()\n File \"/opt/python/all_versions/lib/PicklingTools160Release/Python/xmlloaderpy\", line 1225, in _peekNWSChar\n def _peekNWSChar(self) : return selfreader__peekNWSChar()\n File \"/opt/python/all_versions/lib/PicklingTools160Release/Python/parsereaderpy\", line 194, in _peekNWSChar\n index = self_indexOfNextNWSChar()\n File \"/opt/python/all_versions/lib/PicklingTools160Release/Python/xmlloaderpy\", line 1252, in _indexOfNextNWSChar\n while (cur<len and selfbuffer[cur]isspace()) :\nTypeError: unorderable types: int() < builtin_function_or_method()\nHere is my quick fix:\n% cd PicklingTools161Release\n % sudo vi Python/xmlloaderpy\n # Search for 'def _indexOfNextNWSChar'    # The original code will be this:\n        def _indexOfNextNWSChar (self) :\n            length = len(selfbuffer_)\n            cur = selfcurrent_\n            if (cur==len) : return cur;\n            while (cur<len and selfbuffer_[cur]isspace()) :\n                cur +=1\n            return cur\n\n    # The fix is the following Notice that the variable is 'length' and 'len' is the built-in function\n        def _indexOfNextNWSChar (self) :\n            length = len(selfbuffer_)\n            cur = selfcurrent_\n            if (cur==length) : return cur;\n            while (cur<length and selfbuffer_[cur]isspace()) :\n                cur +=1\n            return cur\n\nUse the following code to test the fix in python 3x:\nfrom xmlloader import *\nxml_text = '123 #12'\nxl = XMLLoader(xml_text, XML_LOAD_EVAL_CONTENT)\nxlexpectXML()Thanks,—\nReply to this email directly or view it on GitHub.  \n\n  "}}