bulbs
bulbs copied to clipboard
Attribute error when trying to instantiate the graph object in python3.5
I am using OrientDB and Rexster with the latest release of Bulb in python3.5
When I try:
from bulbs.config import Config
from bulbs.rexster import Graph
g = Graph(Config('http://localhost:8182/graphs/Freeth'))
I get the following error:
File "/home/kevin/Code/python/falcon/freeth/app/models.py", line 7, in <module>
graph = Graph(Config('http://localhost:8182/graphs/Freeth/'))
File "/home/kevin/Code/python/falcon/freeth/venv/lib/python3.5/site-packages/bulbs/rexster/graph.py", line 56, in __init__
super(Graph, self).__init__(config)
File "/home/kevin/Code/python/falcon/freeth/venv/lib/python3.5/site-packages/bulbs/base/graph.py", line 53, in __init__
self.client = self.client_class(config)
File "/home/kevin/Code/python/falcon/freeth/venv/lib/python3.5/site-packages/bulbs/rexster/client.py", line 324, in __init__
self.scripts = GroovyScripts(self.config)
File "/home/kevin/Code/python/falcon/freeth/venv/lib/python3.5/site-packages/bulbs/groovy.py", line 74, in __init__
self.update(file_path, self.default_namespace)
File "/home/kevin/Code/python/falcon/freeth/venv/lib/python3.5/site-packages/bulbs/groovy.py", line 120, in update
methods = self._get_methods(file_path)
File "/home/kevin/Code/python/falcon/freeth/venv/lib/python3.5/site-packages/bulbs/groovy.py", line 160, in _get_methods
return Parser(file_path).get_methods()
File "/home/kevin/Code/python/falcon/freeth/venv/lib/python3.5/site-packages/bulbs/groovy.py", line 255, in __init__
Scanner(handlers).scan(groovy_file)
File "/home/kevin/Code/python/falcon/freeth/venv/lib/python3.5/site-packages/bulbs/groovy.py", line 193, in __init__
self.group_pattern = self._get_group_pattern(flags)
File "/home/kevin/Code/python/falcon/freeth/venv/lib/python3.5/site-packages/bulbs/groovy.py", line 204, in _get_group_pattern
sub_pattern.groups = len(patterns) + 1
AttributeError: can't set attribute
However, there is no problem with python3.4.
Here is the updated function in groovy.py:
def _get_group_pattern(self,flags):
# combine phrases into a compound pattern
patterns = []
sub_pattern = sre_parse.Pattern()
sub_pattern.flags = flags
for phrase, action in self.lexicon:
gid = sub_pattern.opengroup()
patterns.append(sre_parse.SubPattern(sub_pattern, [
(SUBPATTERN, (len(patterns) + 1, sre_parse.parse(phrase, flags)$
]))
sub_pattern.closegroup(gid, patterns[-1])
#sub_pattern.groups = len(patterns) + 1
group_pattern = sre_parse.SubPattern(sub_pattern, [(BRANCH, (None, patt$
return sre_compile.compile(group_pattern)
@mariomcginley That works. Will be great if added to the repo.