I’m currently using IronPython to execute Python code in my .NET project. The issue, however, is that I am receiving an error:
Attempted "__set__" operation on ASN.1 schema object
This is the C# code:
ScriptEngine engine = Python.CreateEngine(); //var searchPaths = engine.GetSearchPaths(); ///searchPaths.Add(@"PATH_TO_FILE"); //searchPaths.Add(@"C:\Python27\Lib\site-packages"); ScriptSource source = engine.CreateScriptSourceFromFile("PATH_TO_FILE"); ScriptScope scope = engine.CreateScope(); scope.SetVariable("startAt", "2019-05-20"); source.Execute(scope);
I created a basic script and tested again. The script executes fine, so it seems the issue is with the Python code. I can’t link the rest here, however, since a lot of it is API based and requires a lot of setup to get working.
import sys def main(argv): print("Done") if __name__ == "__main__": main(sys.argv[1:])
I was hoping if someone has run into this issue before. I researched online and didn’t find many matches.