I'm at the beginning stages of calling IronRuby from IronPython, but am having
difficulty creating the ruby engine.
This code works from C# in VS2008:
// with referenced assemblies IronRuby, IronRuby.Libraries,
IronRuby.Libraries.YAML, Microsoft.Scripting,
// Microsoft.Scripting.Core from the IronRuby bin\ directory
var engine = IronRuby.Ruby.CreateEngine();
String s = engine.ToString();
MessageBox.Show( s, "test");
// successfully returns
"Microsoft.Scripting.Hosting.ScriptEngine"
Trying to do the identical logic with this IronPython code:
import clr, sys
clr.AddReferenceToFileAndPath(
"C:/Apps/IronRuby/bin/IronRuby.dll" ) # after initially failed, tried adding
specific path to IronRuby DLLs ...
clr.AddReferenceToFileAndPath(
"C:/Apps/IronRuby/bin/IronRuby.Libraries.dll" )
clr.AddReferenceToFileAndPath(
"C:/Apps/IronRuby/bin/IronRuby.Libraries.YAML.dll" )
clr.AddReferenceToFileAndPath(
"C:/Apps/IronRuby/bin/Microsoft.Scripting.dll" )
clr.AddReferenceToFileAndPath(
"C:/Apps/IronRuby/bin/Microsoft.Scripting.Core.dll" )
import IronRuby
for r in clr.References: print "ref", r # to verify I have
the correct assemblies loaded
print ""
print "fence 0"
engine = IronRuby.Ruby.CreateEngine() # fails here
print "fence 1"
print engine
This gives this output:
ref mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
ref System, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089
ref IronRuby, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35
ref IronRuby.Libraries, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35
ref IronRuby.Libraries.Yaml, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35
ref Microsoft.Scripting, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35
ref Microsoft.Scripting.Core, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35
fence 0
Traceback (most recent call last):
StandardError: Failed to load language 'IronRuby': Could not
load type 'Microsoft.Scripting.Interpreter.ILightCallSiteBinder' from assembly
'Microsoft.Dynamic, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.
I also added a reference to IronRuby's version of the Microsoft.Dynamic.dll,
but it still failed similarly. The logic I'm trying to execute is brief enough
that there shouldn't be much that could go wrong, but ...
Thanks in advance for any insights!
--John
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com