python - SpringPython error following the book: AttributeError: 'module' object has no attribute 'ObjBase' -


well, bought book spring python 1.1 , have been facing problems cannot solve. going write code of each file in order make sure clear. if of know problem, please let me know because desperate.

simple_service.py

class service(object): def happy_birthday(self, name):     results = []     in range(4):         if <= 2:             results.append("happy birthday dear %s!" % name)         else:             results.append("happy birthday you!")             return results 

simple_service_server_ctx.py

from springpython.config import * springpython.remoting.pyro import *  simple_service import *  class happybirthdaycontext(pythonconfig):     def __init__(self):         pythonconfig.__init__(self)      @object     def target_service(self):         return service()      @object     def service_exporter(self):         exporter = pyroserviceexporter()         exporter.service = self.target_service()         exporter.service_name = "service"         exporter.service_host = "127.0.0.1"         exporter.service_port = "7766"         exporter.after_properties_set()         return exporter 

simple_server.py

from springpython.context import * simple_service_server_ctx import *  if __name__ == "__main__":     ctx = applicationcontext(happybirthdaycontext())     ctx.get_object("service_exporter") 

i run on terminal: python simple_server , got following error:

(spring)kiko@kiko-laptop:~/examples/spring$ python simple_server.py  traceback (most recent call last):   file "simple_server.py", line 6, in <module>     ctx = applicationcontext(happybirthdaycontext())   file "/home/kiko/.virtualenvs/spring/lib/python2.6/site-packages/springpython/context/__init__.py", line 45, in __init__     self.get_object(object_def.id, ignore_abstract=true)   file "/home/kiko/.virtualenvs/spring/lib/python2.6/site-packages/springpython/container/__init__.py", line 80, in get_object     comp = self._create_object(object_def)   file "/home/kiko/.virtualenvs/spring/lib/python2.6/site-packages/springpython/container/__init__.py", line 129, in _create_object     self._get_constructors_kw(object_def.named_constr))   file "/home/kiko/.virtualenvs/spring/lib/python2.6/site-packages/springpython/factory/__init__.py", line 62, in create_object     return self.method()   file "<string>", line 2, in service_exporter   file "/home/kiko/.virtualenvs/spring/lib/python2.6/site-packages/springpython/config/__init__.py", line 1370, in object_wrapper     return _object_wrapper(f, thescope, parent, log_func_name, *args, **kwargs)   file "/home/kiko/.virtualenvs/spring/lib/python2.6/site-packages/springpython/config/__init__.py", line 1350, in _object_wrapper     return _deco(f, scope, parent, log_func_name, *args, **kwargs)   file "/home/kiko/.virtualenvs/spring/lib/python2.6/site-packages/springpython/config/__init__.py", line 1345, in _deco     results = f(*args, **kwargs)   file "/home/kiko/examples/spring/simple_service_server_ctx.py", line 22, in service_exporter     exporter.after_properties_set()   file "/home/kiko/.virtualenvs/spring/lib/python2.6/site-packages/springpython/remoting/pyro/__init__.py", line 58, in after_properties_set     pyro_obj = pyro.core.objbase() attributeerror: 'module' object has no attribute 'objbase' 

i have added on own line (file:simple_service_server_ctx.py):

exporter.after_properties_set() 

since read must declared (line 19, link source code).

thanks in advance.

i wonder pyro version is. here using pyro 3.9.1-1 ubuntu 10.04 have no problems running code. you're using pyro 4.x if recall correctly released after book had been published?


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -