error: scrapy TypeError: 'float' object is not iterable

简介: error: scrapy TypeError: 'float' object is not iterable

正常运行爬虫,在公司电脑上没问题,回到家自己电脑上就出现了下面的报错,百思不得解

Traceback (most recent call last):
  File "D:\.virtualenvs\spider\lib\site-packages\twisted\internet\defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "D:\.virtualenvs\spider\lib\site-packages\twisted\python\failure.py", line 422, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "D:\.virtualenvs\spider\lib\site-packages\scrapy\core\downloader\middleware.py", line 43, in process_request
    defer.returnValue((yield download_func(request=request,spider=spider)))
  File "D:\.virtualenvs\spider\lib\site-packages\scrapy\utils\defer.py", line 45, in mustbe_deferred
    result = f(*args, **kw)
  File "D:\.virtualenvs\spider\lib\site-packages\scrapy\core\downloader\handlers\__init__.py", line 65, in download_request
    return handler.download_request(request, spider)
  File "D:\.virtualenvs\spider\lib\site-packages\scrapy\core\downloader\handlers\http11.py", line 60, in download_request
    return agent.download_request(request)
  File "D:\.virtualenvs\spider\lib\site-packages\scrapy\core\downloader\handlers\http11.py", line 285, in download_request
    method, to_bytes(url, encoding='ascii'), headers, bodyproducer)
  File "D:\.virtualenvs\spider\lib\site-packages\twisted\web\client.py", line 1657, in request
    parsedURI.originForm)
  File "D:\.virtualenvs\spider\lib\site-packages\twisted\web\client.py", line 1435, in _requestWithEndpoint
    d = self._pool.getConnection(key, endpoint)
  File "D:\.virtualenvs\spider\lib\site-packages\twisted\web\client.py", line 1320, in getConnection
    return self._newConnection(key, endpoint)
  File "D:\.virtualenvs\spider\lib\site-packages\twisted\web\client.py", line 1332, in _newConnection
    return endpoint.connect(factory)
  File "D:\.virtualenvs\spider\lib\site-packages\twisted\internet\endpoints.py", line 924, in connect
    EndpointReceiver, self._hostText, portNumber=self._port
  File "D:\.virtualenvs\spider\lib\site-packages\twisted\internet\_resolver.py", line 189, in resolveHostName
    onAddress = self._simpleResolver.getHostByName(hostName)
  File "D:\.virtualenvs\spider\lib\site-packages\scrapy\resolver.py", line 21, in getHostByName
    d = super(CachingThreadedResolver, self).getHostByName(name, timeout)
  File "D:\.virtualenvs\spider\lib\site-packages\twisted\internet\base.py", line 276, in getHostByName
    timeoutDelay = sum(timeout)
TypeError: 'float' object is not iterable

网上查到是scrapy与twisted版本不兼容的问题

当前版本:


Scrapy==1.1.2
Twisted==18.4.0

卸载twisted重装

pip uninstall twisted
pip install twisted==16.6.0

参考


scrapy domz报错TypeError: ‘float’ object is not iterable

Scapry does not work with Twisted version 17.1.0

相关文章
|
6月前
|
关系型数据库 MySQL
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file
296 0
|
5月前
|
Python
【Error】DeprecationWarning: executable_path has been deprecated, please pass in a Service object
【Error】DeprecationWarning: executable_path has been deprecated, please pass in a Service object
86 2
|
1月前
|
存储 数据采集 数据处理
Pandas中批量转换object至float的高效方法
在数据分析中,常需将Pandas DataFrame中的object类型列转换为float类型以进行数值计算。本文介绍如何使用`pd.to_numeric`函数高效转换,并处理非数字值,包括用0或平均值填充NaN值的方法。
42 1
|
2月前
|
存储 Java 关系型数据库
LDAP: error code 32 - No Such Object
`亲测可用,之前搜索了很多博客,啥样的都有,就是不介绍报错以及配置用处,根本不懂照抄那些配置是干啥的,稀里糊涂的按照博客搭完也跑不起来,因此记录这个。` `项目背景`:公司项目当前采用http协议+shiro+mysql的登录认证方式,而现在想支持ldap协议认证登录然后能够访问自己公司的项目网站。 `举例说明`:假设我们公司有自己的门户网站,现在我们收购了一家公司,他们数据库采用ldap存储用户数据,那么为了他们账户能登陆我们公司项目所以需要集成,而不是再把他们的账户重新在mysql再创建一遍,万一人家有1W个账户呢,不累死了且也不现实啊。
99 14
|
1月前
|
TensorFlow 算法框架/工具
Tensorflow error(二):x and y must have the same dtype, got tf.float32 != tf.int32
本文讨论了TensorFlow中的一个常见错误,即在计算过程中,变量的数据类型(dtype)不一致导致的错误,并通过使用`tf.cast`函数来解决这个问题。
24 0
|
3月前
|
JSON 数据格式 Python
【python】解决json.dump(字典)时报错Object of type ‘float32‘ is not JSON serializable
在使用json.dump时遇到的“Object of type ‘float32’ is not JSON serializable”错误的方法,通过自定义一个JSON编码器类来处理NumPy类型的数据。
146 1
|
4月前
|
关系型数据库 MySQL
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file
300 2
|
4月前
|
存储 JSON JavaScript
【Python】已完美解决:TypeError: the JSON object must be str, bytes or bytearray, not dict
【Python】已完美解决:TypeError: the JSON object must be str, bytes or bytearray, not dict
229 1
|
6月前
|
JSON 数据格式
解决报错TypeError: Converting circular structure to JSON --> starting at object with constructor
解决报错TypeError: Converting circular structure to JSON --> starting at object with constructor
|
4月前
|
JSON 前端开发 数据格式
【Python】已解决:TypeError: Object of type JpegImageFile is not JSON serializable
【Python】已解决:TypeError: Object of type JpegImageFile is not JSON serializable
83 0