Problem with dynamic __import__ of gpb modules
Hi I'm building a generic editor for creating loading and saving gpb objects and am running into problems with dynamic __import__ statements. I've nailed it down to a very simple testcase. This is all with python 2.5.2 and protobuf 2.0.3 on Linux. test.proto: message test {optional int32 x=1; } C.py: class K: def __init__(self): print new K import test_pb2, C a=getattr(test_pb2,test) a class 'test_pb2.test' b=getattr(C,K) b class C.K at 0xb64ceddc Why is one of the classnames in quotes, and the other not? When I try a dynamic import I've narrowed my problem down to : #!/usr/bin/python def test(): for module,klass in [('test_pb2','test'), ('C', 'K')]: m=__import__(module) k=getattr(m, klass) print *, m, k, type(k) print k() test() Which when run gives me the following * module 'test_pb2' from 'gpbedit/test_pb2.pyc' class 'test_pb2.test' class 'google.protobuf.reflection.GeneratedProtocolMessageType' new k= * module 'C' from '...gpbedit/C.pyc' C.K type 'classobj' new k= new K C.K instance at 0xb7d2764c When I try to create a protocol object of the 'test' type, my python script returns None. So where does this go wrong? Bart P.S. the editor is at http://github.com/bvdeenen/gpbedit/tree/master. It's still alpha quality, but it is capable of editing proto objects and generating a gui from proto files --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Re: Java socket based rpc implementation
protobuf-c now has an rpc implementation, check it out: http://code.google.com/p/protobuf-c/wiki/RPC_System On Feb 10, 10:19 am, sagar.i...@gmail.com wrote: any plans on extending this to C? looking for a simple cross-language client-server library. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Re: Java socket based rpc implementation
I guess i should mention a few design features of the protobuf-c api: - completely introspectable - able to wrap into another application's main-loop I think those features should make it easy to write a language binding to it. I am considering someday improving it to be able to create a ProtobufC_*Descriptor without running the compiler, by re-implmenting the .proto parsing code. On Feb 18, 9:22 pm, lahike...@gmail.com wrote: protobuf-c now has an rpc implementation, check it out: http://code.google.com/p/protobuf-c/wiki/RPC_System On Feb 10, 10:19 am, sagar.i...@gmail.com wrote: any plans on extending this to C? looking for a simple cross-language client-server library. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---