How to configure the import path in Visual Studio IronPython projects

I have built the IronPythonIntegration solution that comes with the Visual Studio 2005 SDK (as explained at http://www.izume.com/2007/10/13/integrating-ironpython-with-visual-studio-2005), and I can now use IronPython projects inside Visual Studio 2005. However, to let a Python file import from the standard library I need to include these two lines first:

import sys
sys.path.append('c:\Python24\lib') 

and similarly for any other folders I want to be able to import from.

Does anyone know a way to set up import paths so that all IronPython projects automatically pick them up?


Asked by: John878 | Posted: 01-10-2021






Answer 1

Set the environment variable IRONPYTHONPATH in your operating system to 'c:\Python24\lib'. (Or anywhere else you need).

Answered by: Blake839 | Posted: 02-11-2021



Similar questions

python - Is it possible to use wxPython inside IronPython?

When my IronPython program gets to the line import wx I get this message: A first chance exception of type 'IronPython.Runtime.Exceptions.PythonImportErrorException' occurred in IronPython.dll Additional information: No module named _core_ although I do have the file wx\_core_.pyd. Also, before attempting the import, I have the lines: ...


python - Pros and cons of IronPython and IronPython Studio

We are ready in our company to move everything to Python instead of C#, we are a consulting company and we usually write small projects in C# we don't do huge projects and our work is more based on complex mathematical models not complex software structures. So we believe IronPython is a good platform for us because it provides standard GUI functionality on windows and access to all of .Net libraries. I know Ironp...


python - Has anyone used SciPy with IronPython?

I've been able to use the standard Python modules from IronPython, but I haven't gotten SciPy to work yet. Has anyone been able to use SciPy from IronPython? What did you have to do to make it work? Update: See Numerical computing in IronPython with Ironclad Update: Microsoft is


python - IronPython on ASP.NET MVC

Has anyone tried ASP.NET MVC using IronPython? Having done a lot of Python development recently, it would be nice to continue with the language as I go into a potential ASP.NET MVC project. I'm especially interested in exploiting the dynamic aspects of Python with .NET features such as LINQ and want to know if this will be possible. The other route that may be viable for certain dynamic programming would be C# 4....


python - BOO Vs IronPython

What is the difference between IronPython and BOO? Is there a need for 2 Python-like languages?


ironpython - Python 2.5.2 continued

This is a continuation of my question Python2.5.2 The code i developed is working fine with clr.Addreference(). Now thee problem is I have to load ny script which uses dll developed in .NET to another application.They had used QT for its implementation.There is a Script console in that application.When ii entered 'import clr' ,it was saying 'No module named clr' or 'Cannot import clr'.What shall i do?


.net - IronPython - Convert int to byte array

What is the correct way to get the length of a string in Python, and then convert that int to a byte array? What is the right way to print that to the console for testing?


python - How should I setup the Wing IDE for use with IronPython

Here is a screen where I should point the Wing IDE to my python files. I am using IronPython. Am I assuming correctly that textbox one gets filled with ipy.exe ? (proper path provided) What should be in the rest of the boxes ?


c# - Packaging script source files in IronPython and IronRuby

Does anyone know how to add python and ruby libs as a resource in a dll for deployment? I want to host a script engine in my app, but dont want to have to deploy the entire standard libraries of the respective languages in source files. Is there a simple way to do this so that a require or import statement will find the embedded resources?


python - CPython or IronPython?

Closed. This question is opinion-based. It is not c...






Still can't find your answer? Check out these communities...



PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python



top