Could not able to use pyspider

pyspider.exe
Traceback (most recent call last):
File “”, line 198, in _run_module_as_main
File “”, line 88, in run_code
File "C:\Users\陈凯\AppData\Local\Programs\Python\Python312\Scripts\pyspider.exe_main
.py", line 4, in
File “C:\Users\陈凯\AppData\Local\Programs\Python\Python312\Lib\site-packages\pyspider\run.py”, line 231
async=True, get_object=False, no_input=False):
^^^^^
SyntaxError: invalid syntax

Hello,

Notice that you’re missing an opening parenthesis. I also noticed that you have a colon at the end of this term as if though it were a function definition.

Should it instead be (?):

async=(True, get_object=False, no_input=False) # Leading opening parenthesis no colon

Please review the documentation for the proper way to define async for your application.

async is a keyword to define coroutines, here it looks like it’s been used as the name of a parameter. You probably have an old version of the library, try updating it.

In pyspider/pyspider/run.py at master · binux/pyspider · GitHub at line 245 there is:

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

so it looks like a file got corrupted somehow, and that line isn’t being interpreted as part of the preceding command.

2 Likes