Python3.7 cannot start pyspider

after I install pyspider in python3.7, I always get an error after typing pyspider on the command line:

File "c:\ users\ 13733\ appdata\ local\ programs\ python\ python37\ lib\ site-packages\ pyspider\ run.py", line 231

async=True, get_object=False, no_input=False):
    ^

SyntaxError: invalid syntax

this is a really strange mistake

Mar.18,2021

async and await have been added to the reserved keywords since python3.7. Reference: python.org/3.7/whatsnew/3.7.html" rel=" nofollow noreferrer > What's New In Python 3.7 , so async and await cannot be used as parameter names of functions.

such as class is also an internally reserved keyword:

>>> def foo(class=None, bar=None):
  File "<stdin>", line 1
    def foo(class=None, bar=None):
                ^
SyntaxError: invalid syntax

see which keywords can be used keyword module, for example, in python3.6:

>>> import keyword
>>> keyword.kwlist
['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']

Let's take a look at the partial source code of ider" rel=" nofollow noreferrer > pyspider :
ider/blob/master/pyspider/run.py-sharpL231" rel=" nofollow noreferrer "run.py :

.
def fetcher(ctx, xmlrpc, xmlrpc_host, xmlrpc_port, poolsize, proxy, user_agent,
            timeout, phantomjs_endpoint, splash_endpoint, fetcher_cls,
            async=True, get_object=False, no_input=False):

here async is used as the parameter name, so an error will be reported under python3.7.

to sum up, you need to solve this problem, you can:

  1. lower your python version, for example, to python3.5
  2. tells the author of pyspider that the author should modify the code and do not use async as the parameter name to make the code compatible with python3.7.. Refer to this ider/pull/803" rel=" nofollow noreferrer "> Pull Request .

@ vibiu see that you merged this PR, with issue-sharp803, so why does the latest version of v0.3.10 still have this problem?


there is still this problem
I installed with anaconda, you can use the command: conda install python=3.6 to lower the python version


agree to the first floor, just replace the async (for example, change it to shark), and be careful not to change the part of the import package.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1befc66-31c91.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1befc66-31c91.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?