[IronPython] IronPython code to call IronRuby fails; equivalent? C# code works
john.cawley at rkeng.com
john.cawley at rkeng.com
Fri Apr 16 23:19:51 CEST 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100416/5803c091/attachment.html>
More information about the Ironpython-users
mailing list