Hello, You can add search paths to the PythonEngine by using the PythonEngine.SetSearchPaths(...) function. private List<string> m_searchPaths = new List<string>(); m_searchPaths.Add(AppDomain.CurrentDomain.BaseDirectory); m_searchPaths.Add(@"C:\Python27\lib"); ...
private ScriptEngine m_engine = Python.CreateEngine(); m_engine.SetSearchPaths(m_searchPaths); Hope this helps. Regards, Aravin On Sat, Aug 21, 2010 at 5:03 PM, <igorf...@hotmail.com> wrote: > 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 > >
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com