Python3 — objectpath …broken?












0















After hours of unsuccessfully trying to use objectpath in a Python3-script, I made the following simple experiment:



>>> from objectpath import *
>>> tree=Tree({"a":1})
>>> tree.execute("$.a")


Expected output: 1



Success with python (2)



~$ python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from objectpath import *
>>> tree=Tree({"a":1})
>>> tree.execute("$.a")
1
>>>


Error with python3:



Is there something wrong with my installation of Python3 ?
objectpath in P3 neither works in scripts nor on console



$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from objectpath import *
>>> tree=Tree({"a":1})
>>> tree.execute("$.a")
Traceback (most recent call last):
File "/home/lisa/.local/lib/python3.6/site-
packages/objectpath/core/parser.py", line 398, in tokenize_python
yield type_map[t[0]], t[1]
KeyError: 4

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lisa/.local/lib/python3.6/site-
packages/objectpath/core/interpreter.py", line 605, in execute
tree=self.compile(expr)
File "/home/lisa/.local/lib/python3.6/site-
packages/objectpath/core/interpreter.py", line 38, in compile
ret=EXPR_CACHE[expr]=parse(expr,self.D)
File "/home/lisa/.local/lib/python3.6/site-
packages/objectpath/core/parser.py", line 464, in parse
r=expression().getTree()
File "/home/lisa/.local/lib/python3.6/site-
packages/objectpath/core/parser.py", line 449, in expression
left=t.led(left)
File "/home/lisa/.local/lib/python3.6/site-
packages/objectpath/core/parser.py", line 264, in led
advance()
File "/home/lisa/.local/lib/python3.6/site-
packages/objectpath/core/parser.py", line 161, in advance
token=nextToken()
File "/home/lisa/.local/lib/python3.6/site-
packages/objectpath/core/parser.py", line 413, in tokenize
for ID, value in source:
File "/home/lisa/.local/lib/python3.6/site-
packages/objectpath/core/parser.py", line 405, in tokenize_python
raise SyntaxError("Syntax error")









share|improve this question





























    0















    After hours of unsuccessfully trying to use objectpath in a Python3-script, I made the following simple experiment:



    >>> from objectpath import *
    >>> tree=Tree({"a":1})
    >>> tree.execute("$.a")


    Expected output: 1



    Success with python (2)



    ~$ python
    Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
    [GCC 7.3.0] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from objectpath import *
    >>> tree=Tree({"a":1})
    >>> tree.execute("$.a")
    1
    >>>


    Error with python3:



    Is there something wrong with my installation of Python3 ?
    objectpath in P3 neither works in scripts nor on console



    $ python3
    Python 3.6.7 (default, Oct 22 2018, 11:32:17)
    [GCC 8.2.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from objectpath import *
    >>> tree=Tree({"a":1})
    >>> tree.execute("$.a")
    Traceback (most recent call last):
    File "/home/lisa/.local/lib/python3.6/site-
    packages/objectpath/core/parser.py", line 398, in tokenize_python
    yield type_map[t[0]], t[1]
    KeyError: 4

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/lisa/.local/lib/python3.6/site-
    packages/objectpath/core/interpreter.py", line 605, in execute
    tree=self.compile(expr)
    File "/home/lisa/.local/lib/python3.6/site-
    packages/objectpath/core/interpreter.py", line 38, in compile
    ret=EXPR_CACHE[expr]=parse(expr,self.D)
    File "/home/lisa/.local/lib/python3.6/site-
    packages/objectpath/core/parser.py", line 464, in parse
    r=expression().getTree()
    File "/home/lisa/.local/lib/python3.6/site-
    packages/objectpath/core/parser.py", line 449, in expression
    left=t.led(left)
    File "/home/lisa/.local/lib/python3.6/site-
    packages/objectpath/core/parser.py", line 264, in led
    advance()
    File "/home/lisa/.local/lib/python3.6/site-
    packages/objectpath/core/parser.py", line 161, in advance
    token=nextToken()
    File "/home/lisa/.local/lib/python3.6/site-
    packages/objectpath/core/parser.py", line 413, in tokenize
    for ID, value in source:
    File "/home/lisa/.local/lib/python3.6/site-
    packages/objectpath/core/parser.py", line 405, in tokenize_python
    raise SyntaxError("Syntax error")









    share|improve this question



























      0












      0








      0








      After hours of unsuccessfully trying to use objectpath in a Python3-script, I made the following simple experiment:



      >>> from objectpath import *
      >>> tree=Tree({"a":1})
      >>> tree.execute("$.a")


      Expected output: 1



      Success with python (2)



      ~$ python
      Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
      [GCC 7.3.0] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> from objectpath import *
      >>> tree=Tree({"a":1})
      >>> tree.execute("$.a")
      1
      >>>


      Error with python3:



      Is there something wrong with my installation of Python3 ?
      objectpath in P3 neither works in scripts nor on console



      $ python3
      Python 3.6.7 (default, Oct 22 2018, 11:32:17)
      [GCC 8.2.0] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> from objectpath import *
      >>> tree=Tree({"a":1})
      >>> tree.execute("$.a")
      Traceback (most recent call last):
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/parser.py", line 398, in tokenize_python
      yield type_map[t[0]], t[1]
      KeyError: 4

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/interpreter.py", line 605, in execute
      tree=self.compile(expr)
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/interpreter.py", line 38, in compile
      ret=EXPR_CACHE[expr]=parse(expr,self.D)
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/parser.py", line 464, in parse
      r=expression().getTree()
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/parser.py", line 449, in expression
      left=t.led(left)
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/parser.py", line 264, in led
      advance()
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/parser.py", line 161, in advance
      token=nextToken()
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/parser.py", line 413, in tokenize
      for ID, value in source:
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/parser.py", line 405, in tokenize_python
      raise SyntaxError("Syntax error")









      share|improve this question
















      After hours of unsuccessfully trying to use objectpath in a Python3-script, I made the following simple experiment:



      >>> from objectpath import *
      >>> tree=Tree({"a":1})
      >>> tree.execute("$.a")


      Expected output: 1



      Success with python (2)



      ~$ python
      Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
      [GCC 7.3.0] on linux2
      Type "help", "copyright", "credits" or "license" for more information.
      >>> from objectpath import *
      >>> tree=Tree({"a":1})
      >>> tree.execute("$.a")
      1
      >>>


      Error with python3:



      Is there something wrong with my installation of Python3 ?
      objectpath in P3 neither works in scripts nor on console



      $ python3
      Python 3.6.7 (default, Oct 22 2018, 11:32:17)
      [GCC 8.2.0] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> from objectpath import *
      >>> tree=Tree({"a":1})
      >>> tree.execute("$.a")
      Traceback (most recent call last):
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/parser.py", line 398, in tokenize_python
      yield type_map[t[0]], t[1]
      KeyError: 4

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/interpreter.py", line 605, in execute
      tree=self.compile(expr)
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/interpreter.py", line 38, in compile
      ret=EXPR_CACHE[expr]=parse(expr,self.D)
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/parser.py", line 464, in parse
      r=expression().getTree()
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/parser.py", line 449, in expression
      left=t.led(left)
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/parser.py", line 264, in led
      advance()
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/parser.py", line 161, in advance
      token=nextToken()
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/parser.py", line 413, in tokenize
      for ID, value in source:
      File "/home/lisa/.local/lib/python3.6/site-
      packages/objectpath/core/parser.py", line 405, in tokenize_python
      raise SyntaxError("Syntax error")






      python python-3.x objectpath






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 21 '18 at 22:01









      Harry Cutts

      1,017821




      1,017821










      asked Nov 21 '18 at 21:33









      reinhardSreinhardS

      32




      32
























          1 Answer
          1






          active

          oldest

          votes


















          1














          To run this in Python 3.x you should pip3 install objectpath otherwise it won't work.



          See below how I ran your code:



          dell@dell-XPS-15-9572:~/Desktop$ pip3 install objectpath
          Collecting objectpath
          Downloading https://files.pythonhosted.org/packages/21/6a/ed435be72edd1d60b7363cbb38c34aff3004fee02d1c7f9f01435c318cdb/objectpath-0.5-py2.py3-none-any.whl
          Installing collected packages: objectpath
          Successfully installed objectpath-0.5
          dell@dell-XPS-15-9572:~/Desktop$ python3
          Python 3.6.5 (default, Apr 1 2018, 05:46:30)
          [GCC 7.3.0] on linux
          Type "help", "copyright", "credits" or "license" for more
          information.
          >>> from objectpath import *
          >>> tree=Tree({"a":1})
          >>> tree.execute("$.a")
          1
          >>>





          share|improve this answer
























          • Thats what I have done already

            – reinhardS
            Nov 21 '18 at 23:05











          • But mine says : Collecting objectpath Using cached - HOW could I enforce pip3 to download the correct - seems it uses the P2-version from cache

            – reinhardS
            Nov 21 '18 at 23:23











          • Try pip uninstall objectpath to uninstall the package.

            – Ai Da
            Nov 22 '18 at 14:06











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420757%2fpython3-objectpath-broken%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          To run this in Python 3.x you should pip3 install objectpath otherwise it won't work.



          See below how I ran your code:



          dell@dell-XPS-15-9572:~/Desktop$ pip3 install objectpath
          Collecting objectpath
          Downloading https://files.pythonhosted.org/packages/21/6a/ed435be72edd1d60b7363cbb38c34aff3004fee02d1c7f9f01435c318cdb/objectpath-0.5-py2.py3-none-any.whl
          Installing collected packages: objectpath
          Successfully installed objectpath-0.5
          dell@dell-XPS-15-9572:~/Desktop$ python3
          Python 3.6.5 (default, Apr 1 2018, 05:46:30)
          [GCC 7.3.0] on linux
          Type "help", "copyright", "credits" or "license" for more
          information.
          >>> from objectpath import *
          >>> tree=Tree({"a":1})
          >>> tree.execute("$.a")
          1
          >>>





          share|improve this answer
























          • Thats what I have done already

            – reinhardS
            Nov 21 '18 at 23:05











          • But mine says : Collecting objectpath Using cached - HOW could I enforce pip3 to download the correct - seems it uses the P2-version from cache

            – reinhardS
            Nov 21 '18 at 23:23











          • Try pip uninstall objectpath to uninstall the package.

            – Ai Da
            Nov 22 '18 at 14:06
















          1














          To run this in Python 3.x you should pip3 install objectpath otherwise it won't work.



          See below how I ran your code:



          dell@dell-XPS-15-9572:~/Desktop$ pip3 install objectpath
          Collecting objectpath
          Downloading https://files.pythonhosted.org/packages/21/6a/ed435be72edd1d60b7363cbb38c34aff3004fee02d1c7f9f01435c318cdb/objectpath-0.5-py2.py3-none-any.whl
          Installing collected packages: objectpath
          Successfully installed objectpath-0.5
          dell@dell-XPS-15-9572:~/Desktop$ python3
          Python 3.6.5 (default, Apr 1 2018, 05:46:30)
          [GCC 7.3.0] on linux
          Type "help", "copyright", "credits" or "license" for more
          information.
          >>> from objectpath import *
          >>> tree=Tree({"a":1})
          >>> tree.execute("$.a")
          1
          >>>





          share|improve this answer
























          • Thats what I have done already

            – reinhardS
            Nov 21 '18 at 23:05











          • But mine says : Collecting objectpath Using cached - HOW could I enforce pip3 to download the correct - seems it uses the P2-version from cache

            – reinhardS
            Nov 21 '18 at 23:23











          • Try pip uninstall objectpath to uninstall the package.

            – Ai Da
            Nov 22 '18 at 14:06














          1












          1








          1







          To run this in Python 3.x you should pip3 install objectpath otherwise it won't work.



          See below how I ran your code:



          dell@dell-XPS-15-9572:~/Desktop$ pip3 install objectpath
          Collecting objectpath
          Downloading https://files.pythonhosted.org/packages/21/6a/ed435be72edd1d60b7363cbb38c34aff3004fee02d1c7f9f01435c318cdb/objectpath-0.5-py2.py3-none-any.whl
          Installing collected packages: objectpath
          Successfully installed objectpath-0.5
          dell@dell-XPS-15-9572:~/Desktop$ python3
          Python 3.6.5 (default, Apr 1 2018, 05:46:30)
          [GCC 7.3.0] on linux
          Type "help", "copyright", "credits" or "license" for more
          information.
          >>> from objectpath import *
          >>> tree=Tree({"a":1})
          >>> tree.execute("$.a")
          1
          >>>





          share|improve this answer













          To run this in Python 3.x you should pip3 install objectpath otherwise it won't work.



          See below how I ran your code:



          dell@dell-XPS-15-9572:~/Desktop$ pip3 install objectpath
          Collecting objectpath
          Downloading https://files.pythonhosted.org/packages/21/6a/ed435be72edd1d60b7363cbb38c34aff3004fee02d1c7f9f01435c318cdb/objectpath-0.5-py2.py3-none-any.whl
          Installing collected packages: objectpath
          Successfully installed objectpath-0.5
          dell@dell-XPS-15-9572:~/Desktop$ python3
          Python 3.6.5 (default, Apr 1 2018, 05:46:30)
          [GCC 7.3.0] on linux
          Type "help", "copyright", "credits" or "license" for more
          information.
          >>> from objectpath import *
          >>> tree=Tree({"a":1})
          >>> tree.execute("$.a")
          1
          >>>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 '18 at 21:57









          Ai DaAi Da

          313114




          313114













          • Thats what I have done already

            – reinhardS
            Nov 21 '18 at 23:05











          • But mine says : Collecting objectpath Using cached - HOW could I enforce pip3 to download the correct - seems it uses the P2-version from cache

            – reinhardS
            Nov 21 '18 at 23:23











          • Try pip uninstall objectpath to uninstall the package.

            – Ai Da
            Nov 22 '18 at 14:06



















          • Thats what I have done already

            – reinhardS
            Nov 21 '18 at 23:05











          • But mine says : Collecting objectpath Using cached - HOW could I enforce pip3 to download the correct - seems it uses the P2-version from cache

            – reinhardS
            Nov 21 '18 at 23:23











          • Try pip uninstall objectpath to uninstall the package.

            – Ai Da
            Nov 22 '18 at 14:06

















          Thats what I have done already

          – reinhardS
          Nov 21 '18 at 23:05





          Thats what I have done already

          – reinhardS
          Nov 21 '18 at 23:05













          But mine says : Collecting objectpath Using cached - HOW could I enforce pip3 to download the correct - seems it uses the P2-version from cache

          – reinhardS
          Nov 21 '18 at 23:23





          But mine says : Collecting objectpath Using cached - HOW could I enforce pip3 to download the correct - seems it uses the P2-version from cache

          – reinhardS
          Nov 21 '18 at 23:23













          Try pip uninstall objectpath to uninstall the package.

          – Ai Da
          Nov 22 '18 at 14:06





          Try pip uninstall objectpath to uninstall the package.

          – Ai Da
          Nov 22 '18 at 14:06


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420757%2fpython3-objectpath-broken%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Tonle Sap (See)

          I get strange results when I access the Sqlitedatabase with Unity C# via XAMPP

          Guatemaltekische Davis-Cup-Mannschaft