tags:

views:

165

answers:

2

So, I'm slowly working in some Python 3.0, but I still have a lot of things that rely on 2.5.

But, in Eclipse, every time I change projects between a 3.0 and a 2.5, I need to go through

Project -> Properties -> project type.

Issue 1: if I just switch the interpreter in the drop down box, that doesn't seem to change anything. I need to click "click here to configure an interpreter not listed", and UP the interpreter I wish to use.

Issue 2: That would be fine if I was switching to 3.0 for every project for the rest of my life, but I still am doing a lot of switching between projects and I don't see that changing anytime soon. So, I'm just trying to save a few operations.

Is there a way to configure Eclipse so that it remembers which interpreter I want associated with which project?

What if I created an entirely new workspace? Is "interpreter" a property of a workspace?

Also, it doesn't seem to matter what I choose when I create a new project via File -> New -> Pydev Project. Whatever I last selected through "Properties" is what eclipse is using.

This is Eclipse 3.4.0, running in Windows XP.

+1  A: 

OK --

It definitely seems like "interpreter" is a property of your "workspace". I hadn't really considered that too much because I always thought of the workspace as "a folder in which I keep whatever" instead of a consistent unified environment for one kind of development.

Also, you can't switch between workspaces in one instance of Eclipse (it shuts down and restarts), but you can run two instances of Eclipse at once, one for each workspace.

Now, I guess I like the fact that Eclipse handles it that way. It has a more "modular" feel, and what originally bothered me I now think it sensible. I don't need to worry about having two interpreters to choose from, or choosing the default or moving one up. I just need to worry about which workspace I'm in.

Hope this helps someone. . .

EDIT: as noted by Kiv, "interpreter" is not a property of your "workspace" (as I stated above). Instead, for any project, there is a "run configuration" (incidentally, there is also a debug configuration). The run config allows the user to set the executable, and the path, and a number of other options.

*I'm sure these things are known to long-time users, but I never had to deal with this until I changed python versions.**

Baltimark
+1  A: 

You can set the interpreter version on a per-script basis through the Run Configurations menu.

To do this go to Run -> Run Configurations, and then make a new entry under Python Run. Fill in your project name and the main script, and then go to the Interpeter tab and you can pick which interpreter you want to use for that script.

I've used this to have Python 2.2, 2.5, and 3.0 projects in the same workspace.

Kiv
Very nice. I like what I pieced together, but this is a great option, too.
Baltimark
Glad you liked it. I didn't think of the multiple-workspace idea, so I learned something too.
Kiv