I have problem with Iron-Python Console Application in Visual Studio 2017 Community. When I tired debug/run the program by clicking F5 or execute in Python Interactive, visual Studio calls an exist message:
Traceback (most recent call last): File "d:\userdata\myAccount\my documents\visual studio 2017\Projects\IronPythonApplication3\IronPythonApplication3\ IronPythonApplication3.py", line 6, in import clr ImportError: No module named clr
Here is the code I'm running:
import sys;
print("testMsg");
print("anotherMsg");
import clr;
clr.AddReference('System.Threading')
from System.Threading import Thread
world = "world"
print('Hello ' + world)
Thread.CurrentThread.Sleep(5000)
The first two print functions call correctly.
Intelisense also casts a popup that may be missing for this module.
I saw other topics on stack-overflow, and I tired to refresh the database and remove python environments but yet to get it working.
Someone could help me find solution for this problem?
Follow these steps:
and install these file.
After this add
C:\Program Files (x86)\IronPython 2.7
into system environment PATH variables, and restart visual studio.
In Solution -> IronPythonProject -> Python Environments -> add/remove python environments i marked IronPython 2.7 (64-bit) Finally program running Thanks a lot Simon Opelt
Change interpreter in: Solution ->IronPythonProject-> Properties -> Interpreter and set to IronPython 2.7(64-bit)
Refresh intelliSense database: Solution -> IronPythonProject -> PythonEnvironments -> view all python environments -> IntelliSense and click Refresh DB
Basic installation of IronPython in Visual Studio 2017 (and IronPython application templates) seems to be incorrect, because we need to install modules from external sources. Visual studio installation is not sufficient.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With