Hi all,<br><br>I've got a problem with a python reserved word in an idl file with omnyORBpy 2.6.1.<br>This is the idl file:<br><div style="margin-left: 40px;">interface Printer<br>{<br> void print (in string message);
<br>};<br></div>I generate stub and skeleton by:<br><div style="margin-left: 40px;">omniidl -bpython Printer.idl<br></div><br>And I make the Server like this:<br><div style="margin-left: 40px;">#!/usr/bin/env python<br><br>
import CORBA, PortableServer, CosNaming<br>import _GlobalIDL__POA<br>import sys<br><br>class Printer_impl (_GlobalIDL__POA.Printer):<br> def __init__ (self, name=None):<br> self.printerName = name or 'DefaultName'
<br> print "++ printer %s is created" % self.printerName<br><br> def _print (self, msg):<br> print "** printer %s prints [%s]" % (self.printerName, msg)<br><br>def main (argv):<br> printerName = argv[1]
<br> orb = CORBA.ORB_init (argv)<br> poa = orb.resolve_initial_references ("RootPOA")<br> printer = Printer_impl (printerName)<br> oprinter = printer._this ()<br> nc = orb.resolve_initial_references
("NameService")._narrow (CosNaming.NamingContextExt)<br> name = nc.to_name (printerName)<br> nc.bind (name, oprinter)<br> poa._get_the_POAManager ().activate ()<br> orb.run ()<br><br>if __name__ == '__main__':
<br> import sys<br> main (sys.argv)<br></div><br>And the Client like this:<br><div style="margin-left: 40px;">import CORBA<br>import sys<br><br>import CosNaming<br>import _GlobalIDL<br><br>class Client:<br> # Les decorateur de methodes sont inexistant en python
2.3<br> # omniORB n'est pas installe pour python 2.4<br> #@staticmethod<br> def main (argv):<br> orb = CORBA.ORB_init(argv)<br><br> nc = orb.resolve_initial_references("NameService")._narrow(
CosNaming.NamingContextExt)<br><br> for i in range(1,int(argv[2])):<br> printer = nc.resolve_str (argv[1])._narrow(_GlobalIDL.Printer)<br> printer._print ("this is a message from python")
<br> main=staticmethod(main)<br><br>if __name__ == "__main__":<br> Client.main (sys.argv)<br></div><br>And I have an error when I start the client and call the method (after the naming service) :<br><div style="margin-left: 40px;">
Traceback (most recent call last):<br> File "Client.py", line 24, in ?<br> Client.main (sys.argv)<br> File "Client.py", line 20, in main<br> printer._print ("this is a message from python")
<br> File "/home/deveil/tmp/tst/CORBA/Printer_idl.py", line 46, in _print<br> return _omnipy.invoke(self, "print", _0__GlobalIDL.Printer._d__print, args)<br>omniORB.CORBA.BAD_OPERATION: Minor: BAD_OPERATION_UnRecognisedOperationName, COMPLETED_NO.
<br></div><br>After a quick search, I found that the real method call on server side is not _print but print...<br>And if I change the definition on the server to print, I have a python syntax error:<br><div style="margin-left: 40px;">
File "Server.py", line 12<br> def print (self, msg):<br> ^<br>SyntaxError: invalid syntax<br></div><br>Is this a bug ? (the print call in place of _print)<br><br>Thx for all,<br>_______________________
<br> Jimmy<br>