Home > Net >  C # call python failure error
C # call python failure error

Time:09-26

Wrote a c # call python demo, but an error when loading py files

Failed to load language 'IronPython 2.7.7' : Failed to load file or assembly "Microsoft. Dynamic, Version=1.1.2.22, Culture=neutral, PublicKeyToken=7 f709c5b713576e1" or one of its dependencies, the system cannot find the specified file,

Check references are in place to run directory also has a dynamic library and py files
Where an error in the dynamic p y=pyRuntime. UseFile (" wkLogin. Py ");


The following attached code
 
ScriptRuntime pyRuntime=Python. CreateRuntime ();
Dynamic p y=pyRuntime. UseFile (" wkLogin. Py ");
If (string. IsNullOrEmpty (txtUserName. Text. The Trim ()))
{
MessageBox. Show (" please enter the user name!" , "warning", MessageBoxButtons. OK);
return;
}
If (string. IsNullOrEmpty (txtPassWord. Text. The Trim ()))
{
MessageBox. Show (" please input password!" , "warning", MessageBoxButtons. OK);
return;
}
String loginJson=py. Login (txtUserName. Text. The Trim (), txtPassWord. Text. The Trim ());

CodePudding user response:

Microsoft. Dynamic is not right, is you IronPython via NuGet install? Not to NuGet install, you IronPython version looks old,
  •  Tags:  
  • C#
  • Related