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() {
            try
            {
                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)
            {
                MessageBox.Show(e.Message);
            }
        }
//

# Python script
# appends to PYTHONPATH  the location of the visa module
import sys
sys.path.append(r'C:\Python27\lib')
sys.path.append(r'C:\Python27\lib\site-packages')
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
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to