State of IPython under PTVS

Aug 6 at 10:25 AM
Hello PTVS team,

I've been poking around a bit, but couldn't find anything other than copy/paste (albeit using Control-E-E when from clipboard to ipython) for sharing code between ipython and the VS editor tabs. Am I missing something perhaps? For example, is IPython's %edit feature somehow able to open code inside a Visual Studio editor tab? (It's not working for me, but I'm using python 2.6 and a correspondingly old ipython version too but will look at 2.7 and latest ipython soon - if it's working for anyone that'd be great to know).

If there's currently no specific support for %edit, might it be easiest to invoke devenv.exe with arguments that load a file - something like explorer - or would you recommend I try coding something within the ipython repl script? - any hints/thoughts welcome.

Thanks and regards,
Tony
Coordinator
Aug 18 at 4:17 PM
Apologies for the slow reply, we've been heads-down getting the release ready.

We don't make any changes to IPython itself, which is what would be required to handle the %edit command. However, you can edit your ipython_config.py file (should be in C:\Users\<username>\.ipython\profile_default) and either set it to devenv.exe or create a script (Python+pywin32) that can use DDE to open the file.

If you look in the registry at HKEY_CLASSES_ROOT\VisualStudio.py.##.0\shell\Open\ddeexec you'll see the application (service), topic and command you need for the PyDDEConv object (from pywin32). I haven't actually tried this myself, so I'll be interested if you have success. I'd try launching devenv directly first - it's possible that it will automatically handle opening in the active window by itself.

Hope that helps. We'll be looking into how we can provide tighter integration with IPython for our next release, so I'll copy this into our issue tracker as a suggestion.
Coordinator
Aug 18 at 4:17 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.