.Net Application calling Python Script with IronPython

110 Views Asked by At

I´m working in a .NET project, this project need to call a python function with a trained network loaded by pybrain customxml.

In .Net i have this code

    Dim engine = Python.CreateEngine()
    Dim searchPaths As ICollection(Of String) = engine.GetSearchPaths()
    searchPaths.Add("C:\Users\Baa\Anaconda3\Lib")
    searchPaths.Add("C:\Users\Baa\Anaconda3\Lib\site-packages")

    engine.SetSearchPaths(searchPaths)
    Dim py = engine.ExecuteFile("E:\asdsa\asdasd\RunFromAway.py")

    Dim m = py.GetVariable("aaa")

    Dim n() As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}

    Dim r = m.ativar(n)

    Return r

In Python i have this function

from pybrain.tools.customxml import NetworkReader

    class aaa:

         @classmethod    
         def ativar(self,n):
             rede = NetworkReader.readFrom('filename.xml')                      
             temp=rede.activate(n)        
             return temp

But when i run this code IronPyhton i receive Invalid Syntax Error, for me the problem is the pybrain importing at python, how can i fixed it?

0

There are 0 best solutions below