1

I am currently trying to embed this project xna console in my game but I am having problems with the IronPython Interpreter.

The problem am having is with the following code

this.PythonOutput = new MemoryStream();
ScriptingEngine.pyEngine.SetStandardOutput(PythonOutput); // this line is giving me an error 'Microsoft.Scripting.Hosting.ScriptEngine' does not contain a definition for 'SetStandardOutput' and no extension method 'SetStandardOutput' accepting a first argument of type 'Microsoft.Scripting.Hosting.ScriptEngine' could be found
this.ASCIIEncoder = new ASCIIEncoding();

and the second problem am having is with this code

ClrModule clr = ScriptingEngine.pyEngine.Import("clr") as ClrModule;
clr.AddReference("Microsoft.Xna.Framework");
clr.AddReference("Microsoft.Xna.Framework.Game");

Am getting issues with the ClrModule cannot declare a variable of static type 'IronPython.Runtime.ClrModule also the Import is giving me errors Microsoft.Scripting.Hosting.ScriptEngine does not contain a definition for 'Import'

Am using IronPython version 2.7.1 and .net4

1 Answer 1

1

SetStandardOutput has moved onto the IO property on ScriptRuntime I believe instead of ScriptEngine.

ClrModule is a static class, so if you need to call AddReference on it you can call it using ClrModule.AddReference(codeContext, ...). You can search for how to get a code context, but a better way might be:

dynamic clr = pyEngine.Import("clr"); clr.AddReference(...);

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.