Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse: connect to custom python interpreter with PyDev

I love Eclipse and PyDev because it always has the features I need. This time I'd like to connect PyDev to my interpreter that is already running. My interpreter is embedded in my game application, that's why. If it would make it easier, I can also start the game application from Eclipse.

However, I've tried to add my game .exe in the interpreter configuration in PyDev but it cannot be started because the .exe need some .cfg files that are located in the .exe's folder. Ecplise seems to not execute the .exe file in its environment. How could I do it?

The main reason for all this is that I want to be able have code completion for python objects that are created inside my application and let Eclipse know about them. Similar to remote variable debugging.

like image 976
mrmclovin Avatar asked Jul 20 '26 03:07

mrmclovin


2 Answers

I'm not 100% sure if I understand your core question but this should answer what I think you want to know:

You would not add your compiled game executable as an interpreter as it wouldn't be a python interpreter. Eclipse asks for a python interpreter.

If you want to run your code in a custom environment/PYTHONPATH with a (custom) installation of python, go to Window -> Preferences -> PyDev -> Interpreter - Python. That's where you can add your custom installation of Python as a preset and select its environment paths that are to be included in the PYTHONPATH for that interpreter preset (make sure you don't include the project's source paths themselves, Eclipse will add them when you run the project).

Once done, go to your project preferences and select the newly created interpreter preset from the list (PyDev - Interpreter/Grammar).

You will get code-completion as long as you use the PyDev editor(s) and have your PYTHONPATH environment correctly set-up.

Hope that helps.

like image 148
bossi Avatar answered Jul 22 '26 07:07

bossi


You can debug an external python process by using the PyDev Remote debugging functionality and calling some pydev debugger code from your python program. This is documented on the PyDev website: http://pydev.org/manual_adv_remote_debugger.html#remote-debugger

like image 22
James Blackburn Avatar answered Jul 22 '26 05:07

James Blackburn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!