5

I'm using Python 3 for developing and CollabNet Subversion Edge as versioning software. Subversion Edge comes with a little program called ViewVC which is written in Python 2, which is also directly bundled with it. There is a system environment variable called PYTHONHOME.

  • If it is set to the Python 2 distribution from Subversion Edge, my Python 3 won't start (not even IDLE), instead giving a runtime error messagebox.
  • If it is set to Python 3, ViewVC doesn't work.

Is there a way to make both work at the same time?

Felix Dombek
  • 13,664
  • 17
  • 79
  • 131

3 Answers3

3

You shouldn't need to set PYTHONHOME at all. Python uses it (if set) to locate its installation. Typically, it should be able to locate it without this variable, as well: by looking at the path name of the python executable, and, failing that, by looking into the registry.

Martin v. Löwis
  • 124,830
  • 17
  • 198
  • 235
  • what do you mean with "path name of the python executable"? .. and indeed you're right, both work perfectly when I just rename the variable! Well then, what's it for... Thanks! – Felix Dombek Dec 20 '10 at 13:26
  • 2
    When Python is run, you typically invoke python.exe. This is located somewhere on disk (twice: once for 2.x, and once for 3.x). Depending on which one is launched, Python figures out where its installation is. – Martin v. Löwis Dec 20 '10 at 13:31
0

Write a .bat or cmd file that saves the value of the PYTHONHOME env var, invokes ViewVC and wait for it to finish, then restores PYTHONHOME to the saved value.

martineau
  • 119,623
  • 25
  • 170
  • 301
0

Have you considered changing the Subversion Edge services to run as a specific user account, and then move the PYTHONHOME environment variable to a user-level variable for that account only? As opposed to a system-wide variable? It seems like it should work.

BTW, the PYTHONHOME variable is added for mod_python to work properly (which is what serves ViewVC). If you can find another way to get mod_python to work, then you could try that.

Mark Phippard
  • 10,329
  • 2
  • 32
  • 42
  • hi, thanks for your additional comment. I've heard of this practice for services in general, but haven't considered it here. Might be worth a try. As for ViewVC, I have renamed the env variable to edit_PYTHONHOME_edit and now both things work. So you are probably wrong there (I have yet to try it after a reboot, though.) – Felix Dombek Dec 20 '10 at 17:12