Flame and "datetime.datetime" module
Closed this issue · 0 comments
alexsilva commented
The current implementation of Flame failure when the package has more than one level.
For example: 'datetime.datetime'
The error prevents the use of the function 'now'
class Flame(object):
...
def module(self, name):
"""import a module on the server given by the module name and returns a proxy to it"""
if importlib:
importlib.import_module(name)
else:
__import__(name)
return FlameModule(self, name)
Below is an implementation that can help in this case:
class Flame(Pyro4.utils.flame.Flame):
...
def module(self, name):
packages = name.split('.')
package = __import__(packages[0])
modules = [package] + packages[1:]
sys.modules[name] = reduce(lambda a, b: getattr(a, b, a), modules)
return Pyro4.utils.flame.FlameModule(self, name)