0

After Pycharm installs pyspider,enter "pyspider all" on command,and an error is reported. C:

C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspider\libs\utils.py:196: FutureWarning: timeout is not supported on your platform.
  warnings.warn("timeout is not supported on your platform.", FutureWarning)                                                                                  
[I 220529 09:16:16 result_worker:49] result_worker starting...
Exception in thread Thread-4 (invoke):
Traceback (most recent call last):    
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\threading.py", line 946, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\click\decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspider\run.py", line 236, in fetcher
    Fetcher = load_cls(None, None, fetcher_cls)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspider\run.py", line 48, in load_cls
    return utils.load_object(value)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspider\libs\utils.py", line 369, in load_object
    module = __import__(module_name, globals(), locals(), [object_name])
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspider\fetcher\__init__.py", line 1, in <module>
    from .tornado_fetcher import Fetcher
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\pyspider\fetcher\tornado_fetcher.py", line 21, in <module>
    import tornado.httputil
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\tornado\httputil.py", line 106, in <module>
    class HTTPHeaders(collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'

How to solve this situation?

  • You are using Python 3.10, and it seems your version of pyspider (and its dependency tornado) does not yet support the change in Python 3.10 that [removed `MutableMapping` from the `collections` module](https://stackoverflow.com/a/59636876/2745495). – Gino Mempin May 29 '22 at 01:40
  • The [pyspider Github page](https://github.com/binux/pyspider) says "*Python 2.{6,7}, 3.{3,4,5,6} support, etc...*" so seems latest supported version is Python 3.6. [Latest releases](https://github.com/binux/pyspider/releases) show support for Python 3.6, but nothing for 3.7+. Also, if you look at their [Issues page](https://github.com/binux/pyspider/issues?q=is%3Aissue+is%3Aopen+python+version), you'll find several other people having issues using that package from 3.7 and up. You might have to downgrade your Python version to use that package :( – Gino Mempin May 29 '22 at 01:46

0 Answers0