As a developer that has worked on more than one python project at once, I love the idea of Virtualenv. But, I'm currently trying to get Komodo IDE to play nice with VirtualEnv on a Windows box. I've downloaded virtualenvwrapper-win and got it working (btw, you are using Virtualenv on windows you should check it out):
http://pypi.python.org/pypi/virtualenvwrapper-win
however, I can't quite figure out what I need to do to get Komodo IDE to respect it all. I found the following for Mac users:
http://blog.haydon.id.au/2010/11/taming-komodo-dragon-for-virtualenv-and...
But, so far, no luck. I'm pretty sure that I need to set a postactivate script to set some environment variables for Komodo to pick up.
Has anyone gotten this working before?
I'm using:
Windows 7, Python 2.6, Komodo IDE 6.1.3
Thanks in advance!
Komodo (still) doesn't have builtin support for virtualenv (or similar
tools for other languages, like Ruby's RVM), but the following the
steps in the referenced article should work. Komodo 7 (now in beta)
supports project-specific interpreters, but you would still need to
manually manage the PATH and PYTHONHOME variables.
I would write a suite of macros to emulate [virtualenv]/bin/activate,
and set them accordingly.
var envCls = Components.classes["@activestate.com/koEnviron;1"].getService()
gives you access to Python's environment variables, and then you can use
var os = Components.classes["@activestate.com/koOs;1"].getService()
to parse envCls.get("PATH") using os.pathsep
I do something similar for Ruby, particularly because I found the
way RVM had redefined cd was breaking my workflow.
No doubt it's worth adding this functionality to Komodo, but it's not
a top priority right now.
- Eric