为了账号安全,请及时绑定邮箱和手机立即绑定

运行main.py后出现如下错误是怎么回事呢

我刚安装的python跟scrapy,按视频操作后出现一堆log(log就不列出了),跟如下错误信息,不知道是怎么回事呢


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/usr/local/lib/python3.7/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks

    current.result = callback(current.result, *args, **kw)

  File "/Users/Ca/douban/douban/spiders/douban_spider.py", line 18, in parse

    douban_item['serial_number'] = i_item.xpath(".//div[@class=item']//em/text()").extract_first()

  File "/usr/local/lib/python3.7/site-packages/parsel/selector.py", line 242, in xpath

    six.reraise(ValueError, ValueError(msg), sys.exc_info()[2])

  File "/usr/local/lib/python3.7/site-packages/six.py", line 692, in reraise

    raise value.with_traceback(tb)

  File "/usr/local/lib/python3.7/site-packages/parsel/selector.py", line 238, in xpath

    **kwargs)

  File "src/lxml/etree.pyx", line 1577, in lxml.etree._Element.xpath

  File "src/lxml/xpath.pxi", line 307, in lxml.etree.XPathElementEvaluator.__call__

  File "src/lxml/xpath.pxi", line 227, in lxml.etree._XPathEvaluatorBase._handle_result

ValueError: XPath error: Invalid predicate in .//div[@class=item']//em/text()


正在回答

1 回答

18行代码,单引号

0 回复 有任何疑惑可以回复我~
#1

慕瓜4233649 提问者

按视频敲的,没问题吧
2018-08-13 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

运行main.py后出现如下错误是怎么回事呢

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信