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