Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 级别必须为整数,elasticsearch中出现错误_Python_Selenium_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Web Scraping_Scrapy - Fatal编程技术网 elasticsearch,web-scraping,scrapy,Python,Selenium,elasticsearch,Web Scraping,Scrapy" /> elasticsearch,web-scraping,scrapy,Python,Selenium,elasticsearch,Web Scraping,Scrapy" />

Python 级别必须为整数,elasticsearch中出现错误

Python 级别必须为整数,elasticsearch中出现错误,python,selenium,elasticsearch,web-scraping,scrapy,Python,Selenium,elasticsearch,Web Scraping,Scrapy,我已经用python实现了一个小爬虫,我想尝试在elasticsearch中导出结果,如本文所述 由于ElasticSearchforScrapy插件(cf)的更新,我在评论中提出了修复方案。我用我的刮板中的现有字段更改了ELASTICSEARCH_UNIQ_键。当然,我已经安装了插件并检查了我的爬行器是否正常工作(我已经成功地通过json命令scrapy craw brand-o output.jsonbrand是我的爬行器的名称) 我已经安装了elasticsearch,它正在运行,我已经能

我已经用python实现了一个小爬虫,我想尝试在elasticsearch中导出结果,如本文所述

由于ElasticSearchforScrapy插件(cf)的更新,我在评论中提出了修复方案。我用我的刮板中的现有字段更改了ELASTICSEARCH_UNIQ_键。当然,我已经安装了插件并检查了我的爬行器是否正常工作(我已经成功地通过json命令
scrapy craw brand-o output.json
brand是我的爬行器的名称)

我已经安装了elasticsearch,它正在运行,我已经能够重现一些发现的示例。但当我使用以下命令时,它不起作用:
scrapy crawl brand

我在settings.py文件中的
ELASTICSEARCH\u LOG\u LEVEL='LOG.DEBUG'
行中添加了引号,因为在没有设置的情况下无法识别日志。但现在,我有以下错误:

Traceback (most recent call last):
  File "C:\Users\stephanie\Downloads\WinPython-32bit-2.7.9.2\python-2.7.9\lib\site-packages\twisted\internet\defer.py", line 588, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "C:\Users\stephanie\Downloads\WinPython-32bit-2.7.9.2\python-2.7.9\lib\site-packages\scrapyelasticsearch\scrapyelasticsearch.py", line 70, in process_item
    self.index_item(item)
  File "C:\Users\stephanie\Downloads\WinPython-32bit-2.7.9.2\python-2.7.9\lib\site-packages\scrapyelasticsearch\scrapyelasticsearch.py", line 53, in index_item
    log.msg("Generated unique key %s" % local_id, level=self.settings.get('ELASTICSEARCH_LOG_LEVEL'))
  File "C:\Users\stephanie\Downloads\WinPython-32bit-2.7.9.2\python-2.7.9\lib\site-packages\scrapy\log.py", line 49, in msg
    logger.log(level, message, *[kw] if kw else [])
  File "C:\Users\stephanie\Downloads\WinPython-32bit-2.7.9.2\python-2.7.9\lib\logging\__init__.py", line 1220, in log
    raise TypeError("level must be an integer")
TypeError: level must be an integer
2015-08-04 02:06:02 [scrapy] INFO: Crawled 1 pages (at 1 pages/min), scraped 0 items (at 0 items/min)
2015-08-04 02:06:02 [scrapy] INFO: Closing spider (finished)
2015-08-04 02:06:02 [selenium.webdriver.remote.remote_connection] DEBUG: DELETE
http://127.0.0.1:49654/hub/session/209677e4-1577-4f05-a418-8554159d8c74/window {
"sessionId": "209677e4-1577-4f05-a418-8554159d8c74"}
2015-08-04 02:06:03 [selenium.webdriver.remote.remote_connection] DEBUG: Finished Request
2015-08-04 02:06:03 [scrapy] INFO: Dumping Scrapy stats:
我正在使用python 2.7和elasticsearch 1.7.1
我是否必须使用弹性搜索进行一些配置,或者是什么原因导致此错误?谢谢您的帮助。

我没有ElasticSearch设置来尝试此功能,但您可以尝试修改settings.py,将以下内容添加到settings.py的顶部

import logging
改变

ELASTICSEARCH_LOG_LEVEL= 'log.DEBUG'

如果上述方法仍然无效,您可以尝试以下方法:

ELASTICSEARCH_LOG_LEVEL= 10

您的第一个解决方案有效!厉害!非常感谢,不用担心。我的荣幸。
ELASTICSEARCH_LOG_LEVEL= 10