[IronPython] How to get ToString() working, and questions about GetSysModule() and GetClrModule()

Thomas Gagne tggagne at gmail.com
Mon Sep 21 11:59:53 PDT 2009


We've hosted Python inside our C# application and all seems to work 
well.  Recently, one of our programmers has asked to use ToString inside 
a python expression.  I read online we need to import the "clr" to make 
that happen.

The code for kicking it off looks like:

_engine = Python.CreateEngine();
_scope = _engine.CreateScope();

I'm curious, if I want the Clr already-imported to a program can ask for 
a fixed-point's ToString("C"), am I supposed to be able to use the 
GetClrModule()?

Since both it and CreateScope() return scopes I thought I'd try using 
the scope returned by GetClrModule() to evaluate an expression.  
Suddenly, "True" no longer evaluated.  It had no binding.

Signed confused.


More information about the Users mailing list