Hello all,

I've played a little bit with IronPython and IronRuby interop with the IronRuby 0.9 binaries.

A very basic example works as expected:

IronPython 2.6 Beta 2 (2.6.0.20) on .NET 2.0.50727.4927
Type "help", "copyright", "credits" or "license" for more information.
>>> import clr
>>> clr.AddReference('IronRuby')
>>> from IronRuby import Ruby
>>>
>>> engine = Ruby.CreateEngine()
>>> source = engine.CreateScriptSourceFromString("puts 'Hello from Ruby'")
>>> scope = engine.CreateScope()
>>>
>>> source.Execute(scope)
Hello from Ruby
>>>


However my attempts to use a Ruby library fails. The same code works when executed from ir.exe:

>>> import clr
>>> clr.AddReference('IronRuby')
>>> clr.AddReference('Microsoft.Scripting')
>>>
>>> from Microsoft.Scripting import SourceCodeKind
>>> from IronRuby import Ruby
>>> engine = Ruby.CreateEngine()
>>> source = engine.CreateScriptSourceFromString("require 'date'", SourceCodeKin
d.Statements)
>>> scope = engine.CreateScope()
>>> source.Execute(scope)
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
Exception: no such file to load -- date
>>>

I tried adding a reference to IronRuby.Libraries to the runtime associated with the Ruby engine (using runtime.LoadAssembly) but this didn't help.

Requiring Ruby modules I've written myself doesn't blow-up but doesn't populate the scriptscope they are executed in with anything. Likewise calling engine.ExecuteFile('foo.rb') returns an empty ScriptScope.

Any ideas?

All the best,

Michael Foord

--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog


_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to