#760 NPE on Python file save if interpreter is not configure

1.3.18
closed-fixed
Editor (491)
5
2008-07-28
2008-07-24
Radim Kubacki
No

PyDev 1.3.18 (and Eclipse 3.4 though it is not important here I think)

If I open python file without configuring Python intepreter I get an error dialog telling that I need to make this configuration. If I close it and try to edit such file it is not possible to save it because NPE is thrown.

This is because this error

Error received...
Interpreter is not properly configured!
Please go to window->preferences->PyDev->Python (or Jython) Interpreters and configure it.
Interpreter is not properly configured!
Please go to window->preferences->PyDev->Python (or Jython) Interpreters and configure it.
org.python.pydev.ui.NotConfiguredInterpreterException: Interpreter is not properly configured!
Please go to window->preferences->PyDev->Python (or Jython) Interpreters and configure it.
at org.python.pydev.editor.PyEdit.getPythonNature(PyEdit.java:1132)
at org.python.pydev.parser.PyParser.<init>(PyParser.java:186)
at org.python.pydev.parser.PyParserManager.attachParserTo(PyParserManager.java:160)
at org.python.pydev.editor.PyEdit.doSetInput(PyEdit.java:569)
at org.eclipse.ui.texteditor.AbstractTextEditor$19.run(AbstractTextEditor.java:3025)
...

cause PyParserManager.attachParserTo to skip call to #makeParserAssociation and later you get

java.lang.NullPointerException
at org.python.pydev.parser.PyParserManager.notifyEditorDisposed(PyParserManager.java:210)
at org.python.pydev.editor.PyEdit.dispose(PyEdit.java:731)
at org.eclipse.ui.internal.WorkbenchPartReference.doDisposePart(WorkbenchPartReference.java:730)
at org.eclipse.ui.internal.EditorReference.doDisposePart(EditorReference.java:302)
...

Note that after IDE restart this works (python nature is added).

To reproduce you can:
- start with new workspace
- create generic project
- copy some python source into project folder and do refresh
- open (close the error message)/ edit / save it

Discussion

  • Fabio Zadrozny
    Fabio Zadrozny
    2008-07-28

    • status: open --> closed-fixed
     
  • Fabio Zadrozny
    Fabio Zadrozny
    2008-07-28

    Logged In: YES
    user_id=617340
    Originator: NO

    Fixed. 2 things were done:
    - it'll try to create the nature
    - if the nature cannot be created (external file), it'll fallback to a default option of parsing with the latest grammar available.