[IronPython] set more search paths

igorfier at hotmail.com igorfier at hotmail.com
Sat Aug 21 13:33:08 CEST 2010

Hello all,

I have been working around to find a way to add more search paths to the IronPython compiler, as I work with a module which only installs inside Python’s directories.
After following some examples around the web, I came into the following snippet to call a script in a C# host app:

// C# code to call the script
private ScriptEngine m_engine = Python.CreateEngine();

private void CallPythonScript() {
                var scope = m_engine.Runtime.CreateScope();
                ScriptSource src = m_engine.CreateScriptSourceFromFile("C:\\TestIronPython.py");
                string res = src.Execute<string>();
                textBox1.Text = res.ToString();
            catch(Exception e)

# Python script
# appends to PYTHONPATH  the location of the visa module
import sys
import visa

a = visa.get_instruments_list(False)

Although it looks quite simple, VS2010 this throws an exception:
“URI formats are not supported”

Does anyone know how to overcome this situation?

Thank you for any help provided!

Igor Fier
Dept. of Physics, Condensed Matter
UNESP Rio Claro – Rio Claro-SP, Brazil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100821/db725e5f/attachment.html>

More information about the Ironpython-users mailing list