Re: [IronPython] Using ruby module from python.

2009-12-08 Thread Suhotyuk Pavel
I write some helpers for python-ruby interop. It's allowed to use ruby 
soap-library.

It's very simple helpers. It have problem with convert python types to ruby.
This helpers place at 
http://files.roinet.net/blog/2009-12-07/PythonRubyInterop.7z

And I write some note about this problem in russian language.
http://roinet.net/2009/12/08/python-ruby-interop/
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Using ruby module from python.

2009-12-08 Thread Tomas Matousek
I have filed a bug to track these issues:

http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=3279

Tomas

-Original Message-
From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Pavel Suhotyuk
Sent: Tuesday, December 01, 2009 5:27 AM
To: Discussion of IronPython
Subject: Re: [IronPython] Using ruby module from python.

I try your example. It's really work, but have some problem with ruby
objects:
1) Can't call RubyObject methods.
  import clr
  wsdl = clr.Use('wsdl.rb', 'rb')
  factory = wsdl.get_factory()
  client =
factory('http://localhost/PaymentsBroker/Manager/ProviderService.asmx?WSDL').create_rpc_drive()
Traceback (most recent call last):
   File string, line 1, in module
AttributeError: 'RubyObject' object has no attribute 'create_rpc_drive'
  client =
getattr(factory('http://localhost/PaymentsBroker/Manager/ProviderService.asmx?WSDL'),
'create_rpc_driver')()
 

2) Calling methods without parameters possible.
  client.GetProviders(None)
IronRuby.Builtins.RubyObject object at 0x002F 
[#SOAP::Mapping::Object:0x0006dd2]

But I don't understand how call methods with parameters. In ruby I can call 
like this:
  print client.GetBalance(:providerId = 3).getBalanceResult().balance 
  60663.89= nil In python it's not work:
  client.GetBalance(3)
Traceback (most recent call last):
   File string, line 1, in module
SystemError: SOAP::Mapping::MappingError   client.GetBalance(provider=3) 
Traceback (most recent call last):
   File string, line 1, in module
TypeError: RubyMethod is not callable
  getattr(client, 'GetBalance')(3)
Traceback (most recent call last):
   File string, line 1, in module
SystemError: SOAP::Mapping::MappingError   getattr(client, 
'GetBalance')(provider=3) Traceback (most recent call last):
   File string, line 1, in module
TypeError: RubyMethod is not callable
  getattr(client, 'GetBalance')({'providerId':3}) Traceback (most recent 
  call last):
   File string, line 1, in module
SystemError: SOAP::Mapping::MappingError   getattr(client, 
'GetBalance')({'providerId':3}) Traceback (most recent call last):
   File string, line 1, in module
SystemError: SOAP::Mapping::MappingError   getattr(client, 
'GetBalance')({':providerId':3}) Traceback (most recent call last):
   File string, line 1, in module
SystemError: SOAP::Mapping::MappingError

Tomas Matousek wrote:
 Our Python-Ruby interop is not quite done yet so you need to use some 
 workarounds.
 
 The easiest way how to get WSDL factory instance would be to write a simple 
 Ruby script that loads it:
 
 == wsdl.rb ==
 
 require 'soap/wsdlDriver'
 
 def get_factory
   SOAP::WSDLDriverFactory
 end
 
 ===
 
 And then you can do:
 import clr
 wsdl = clr.Use('wsdl.rb', 'rb')
 factory = wsdl.get_factory()
 print factory(x.wsdl)
 Traceback (most recent call last):
   File stdin, line 1, in module
 SystemError: Cannot connect to x.wsdl (Not HTTP.)
 
 
 get_factory method is exposed on the wsdl module so that Python can call 
 it. IronRuby doesn't yet implement dynamic protocols for constant access so 
 you need the get_factory helper for accessing Ruby constants.
 Also we have some work to do to make clr.Use work better with libraries of 
 other DLR languages.
 Let us know if you hit some other issues.
 
 Tomas
 
 
 -Original Message-
 From: users-boun...@lists.ironpython.com 
 [mailto:users-boun...@lists.ironpython.com] On Behalf Of Pavel 
 Suhotyuk
 Sent: Monday, November 30, 2009 2:38 AM
 To: Discussion of IronPython
 Subject: [IronPython] Using ruby module from python.
 
 Hello.
 
 I want try to use ruby library (soap) in python code.
 I found method Use(str) in clr module for load the specified module searching 
 all languages in the loaded ScriptRuntime, but don't understand how to used 
 it.
 
 I try to call this method in any variants, but nothing happends.
 
   import clr
   clr.Use('soap/wsdlDriver')
 Traceback (most recent call last):
File string, line 1, in module
 ValueError: couldn't find module soap/wsdlDriver to use   
 clr.Use('soap.wsdlDriver') Traceback (most recent call last):
File string, line 1, in module
 ValueError: couldn't find module soap.wsdlDriver to use   
 clr.Use('soap/wsdlDriver.rb') Traceback (most recent call last):
File string, line 1, in module
 ValueError: couldn't find module soap/wsdlDriver.rb to use   
 clr.Use(r'''C:\usr\env\IronRuby\lib\ruby\1.8\soap\wsdlDriver.rb''',
 'rb')
 module '?' (built-in)
   m =
 clr.Use(r'''C:\usr\env\IronRuby\lib\ruby\1.8\soap\wsdlDriver.rb''', 
 'rb')   m module '?' (built-in)   dir(m) ['__builtins__']
 
 
 Thanks.
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 
 ___
 Users mailing list
 Users@lists.ironpython.com
 http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Re: [IronPython] Using ruby module from python.

2009-12-01 Thread Pavel Suhotyuk

Thank you for replay.

I will try to use this way.

Tomas Matousek wrote:

Our Python-Ruby interop is not quite done yet so you need to use some 
workarounds.

The easiest way how to get WSDL factory instance would be to write a simple 
Ruby script that loads it:

== wsdl.rb ==

require 'soap/wsdlDriver'

def get_factory
  SOAP::WSDLDriverFactory
end

===

And then you can do:

import clr
wsdl = clr.Use('wsdl.rb', 'rb')
factory = wsdl.get_factory()
print factory(x.wsdl)

Traceback (most recent call last):
  File stdin, line 1, in module
SystemError: Cannot connect to x.wsdl (Not HTTP.)


get_factory method is exposed on the wsdl module so that Python can call it. 
IronRuby doesn't yet implement dynamic protocols for constant access so you need the 
get_factory helper for accessing Ruby constants.
Also we have some work to do to make clr.Use work better with libraries of 
other DLR languages.
Let us know if you hit some other issues.

Tomas


-Original Message-
From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Pavel Suhotyuk
Sent: Monday, November 30, 2009 2:38 AM
To: Discussion of IronPython
Subject: [IronPython] Using ruby module from python.

Hello.

I want try to use ruby library (soap) in python code.
I found method Use(str) in clr module for load the specified module searching 
all languages in the loaded ScriptRuntime, but don't understand how to used it.

I try to call this method in any variants, but nothing happends.

  import clr
  clr.Use('soap/wsdlDriver')
Traceback (most recent call last):
   File string, line 1, in module
ValueError: couldn't find module soap/wsdlDriver to use   
clr.Use('soap.wsdlDriver') Traceback (most recent call last):
   File string, line 1, in module
ValueError: couldn't find module soap.wsdlDriver to use   
clr.Use('soap/wsdlDriver.rb') Traceback (most recent call last):
   File string, line 1, in module
ValueError: couldn't find module soap/wsdlDriver.rb to use   
clr.Use(r'''C:\usr\env\IronRuby\lib\ruby\1.8\soap\wsdlDriver.rb''',
'rb')
module '?' (built-in)
  m =
clr.Use(r'''C:\usr\env\IronRuby\lib\ruby\1.8\soap\wsdlDriver.rb''', 'rb')   m module 
'?' (built-in)   dir(m) ['__builtins__']


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

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


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


[IronPython] Using ruby module from python.

2009-11-30 Thread Pavel Suhotyuk

Hello.

I want try to use ruby library (soap) in python code.
I found method Use(str) in clr module for load the specified module 
searching all languages in the loaded ScriptRuntime, but don't 
understand how to used it.


I try to call this method in any variants, but nothing happends.

 import clr
 clr.Use('soap/wsdlDriver')
Traceback (most recent call last):
  File string, line 1, in module
ValueError: couldn't find module soap/wsdlDriver to use
 clr.Use('soap.wsdlDriver')
Traceback (most recent call last):
  File string, line 1, in module
ValueError: couldn't find module soap.wsdlDriver to use
 clr.Use('soap/wsdlDriver.rb')
Traceback (most recent call last):
  File string, line 1, in module
ValueError: couldn't find module soap/wsdlDriver.rb to use
 clr.Use(r'''C:\usr\env\IronRuby\lib\ruby\1.8\soap\wsdlDriver.rb''', 
'rb')

module '?' (built-in)
 m = 
clr.Use(r'''C:\usr\env\IronRuby\lib\ruby\1.8\soap\wsdlDriver.rb''', 'rb')

 m
module '?' (built-in)
 dir(m)
['__builtins__']


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


Re: [IronPython] Using ruby module from python.

2009-11-30 Thread Tomas Matousek
Our Python-Ruby interop is not quite done yet so you need to use some 
workarounds.

The easiest way how to get WSDL factory instance would be to write a simple 
Ruby script that loads it:

== wsdl.rb ==

require 'soap/wsdlDriver'

def get_factory
  SOAP::WSDLDriverFactory
end

===

And then you can do:
 import clr
 wsdl = clr.Use('wsdl.rb', 'rb')
 factory = wsdl.get_factory()
 print factory(x.wsdl)
Traceback (most recent call last):
  File stdin, line 1, in module
SystemError: Cannot connect to x.wsdl (Not HTTP.)


get_factory method is exposed on the wsdl module so that Python can call it. 
IronRuby doesn't yet implement dynamic protocols for constant access so you 
need the get_factory helper for accessing Ruby constants.
Also we have some work to do to make clr.Use work better with libraries of 
other DLR languages.
Let us know if you hit some other issues.

Tomas


-Original Message-
From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Pavel Suhotyuk
Sent: Monday, November 30, 2009 2:38 AM
To: Discussion of IronPython
Subject: [IronPython] Using ruby module from python.

Hello.

I want try to use ruby library (soap) in python code.
I found method Use(str) in clr module for load the specified module searching 
all languages in the loaded ScriptRuntime, but don't understand how to used it.

I try to call this method in any variants, but nothing happends.

  import clr
  clr.Use('soap/wsdlDriver')
Traceback (most recent call last):
   File string, line 1, in module
ValueError: couldn't find module soap/wsdlDriver to use   
clr.Use('soap.wsdlDriver') Traceback (most recent call last):
   File string, line 1, in module
ValueError: couldn't find module soap.wsdlDriver to use   
clr.Use('soap/wsdlDriver.rb') Traceback (most recent call last):
   File string, line 1, in module
ValueError: couldn't find module soap/wsdlDriver.rb to use   
clr.Use(r'''C:\usr\env\IronRuby\lib\ruby\1.8\soap\wsdlDriver.rb''',
'rb')
module '?' (built-in)
  m =
clr.Use(r'''C:\usr\env\IronRuby\lib\ruby\1.8\soap\wsdlDriver.rb''', 'rb')   
m module '?' (built-in)   dir(m) ['__builtins__']


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

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