1
votes

I trying to use IronPython in Visual Studio Code. How do I point Visual Studio Code to my IronPython (C:\Program Files (x86)\IronPython 2.7\ipy.exe). I've searched the forums and was unsuccessful. I've tried changing visual studio code settings to point to the ipy.exe to no avail

"python.pythonPath": "C:\Program Files (x86)\IronPython 2.7\ipy.exe"

When I type the code below I get an error stating: Unable to import 'clr'

import clr
clr.AddReference('Microsoft.Office.Interop.Excel')
2

2 Answers

0
votes

I am able to duplicate this problem when the VS Code Workspace settings are configured differently from the User settings. The Workspace settings will take precedence.

It is not clear from your post if the settings you've changed refers to Workspace or User settings. Make sure settings.json in the workspace points to the right ipy.exe.

User Python Path Set To ipy.exe

Workspace Python Path Set To Other python.exe

Problem Solved

0
votes

As of the Python extension version 2020.5.0, this fix

allows the user to manually enter the path to a Python Interpreter, and i was able to successfully use IronPython as an interpreter in VS Code (to run files)