Menu ▾ ▴

Pydev 1.4.1: was expecting <NAME>

2009-01-05
2013-03-15
  • Marcel Nepveu

    Marcel Nepveu - 2009-01-05

    Hi,

    the line:
    exc = java.lang.Runtime.getRuntime().exec

    gives the following error in Pydev 1.4.1 (Eclipse 3.4.1)
    Encountered "exec" at line 1729, column 54. Was expecting:     <NAME>  ...

    It was not tagged as an error in previous (1.3.x) versions.

    Thanks

    Marcel

     
    • Fabio Zadrozny

      Fabio Zadrozny - 2009-01-14

      With which version is your project configured?

      Cheers,

      Fabio

       
    • Marcel Nepveu

      Marcel Nepveu - 2009-01-15

      Hi Fabio,

      project type: jython
      grammar version: 2.2
      interpreter: default

      eclipse 3.4.1
      jython 2.2.1
      pydev and pydev extensions: 1.4.2
      java 1.5.0_16
      Mac OS X 10.4.11

      Same error seen with pydev 1.4.2. Both
      exc = java.lang.Runtime.getRuntime().exec
      and
      java.lang.Runtime.getRuntime().exec(acrobat + " " + fic.getPath())
      will tag the line with the same error:
      Encountered "exec" at line 376, column 44. Was expecting:     <NAME>  ...

      Could it be that the word "exec" has a special meaning for the parser and is not recognized as a method in this context?

      Marcel

       
      • Fabio Zadrozny

        Fabio Zadrozny - 2009-01-15

        Actually, exec does have a special meaning, and it's not valid in the grammar for python... so, it seems that the Jython grammar has a 'bug' that allows you to do that... Pydev implemented the grammar specification directly without special treatment for Jython/Python... I'm not sure if there should be special treatment for the Jython grammar not conforming to Python.

        If you need to access it and want to remain compatible with the python grammar, you should do: exc = getattr(java.lang.Runtime.getRuntime(), 'exec')

        Cheers,

        Fabio