Document.copy and AttributeError: 'NoneType' object has no attribute 'config'
Closed this issue · 0 comments
miknet commented
resp = g.go('http://google.com')
resp1 = resp.copy()
resp.select('//div')
<grab.selector.selector.SelectorList object at 0x7fed2275c808>
resp1.select('//div')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "../python3.4/site-packages/grab/document.py", line 490, in select
return XpathSelector(self.tree).select(*args, **kwargs)
File "../python3.4/site-packages/grab/document.py", line 351, in tree
if self.grab.config['content_type'] == 'xml':
AttributeError: 'NoneType' object has no attribute 'config'
possible solution
def copy(self):
return copy.deepcopy(self)