Sometimes PyDev does not recognize .py files as python source files

Sometimes, when I open a python file (.py extension) in PyDev Package Explorer, this file opens as a regular text file - without syntax highlighting, setting a breakpoint and all the other great PyDev functions. I do not see differences in other files in the same folder. When I create another .py file (this time PyDev understands that this is the original python file), add a statement import unrecognised_filewith a breakpoint, debug the file and select "Enter" in an unrecognized file, it suddenly wakes up and I can see the syntax highlighting and use breakpoints and that’s it.

After closing the unrecognized_file file and reopening it, it returns to silent text mode, and I cannot use PyDev functions.

Any clues about what's going wrong? What is the algorithm for determining if a file is a python file or a text file?

+5
source share
2 answers

If this happens (and the association for the files is “Python Editor” as the default in the settings), you can right-click the file and “open with> another” and select “Python Editor” from the list.

This parameter should be saved for this file later (what could happen is that you opened the file as text, and Eclipse is saved, therefore, opening it again using the PyDev editor, you need to establish a connection again).

ps: PyDev, , PyDev ( , ).

+7

File Associations.

Eclipse "" → "", "" → "" → "".

*. py Python Editor .

+3

All Articles