我突然在我一直使用的脚本中出错,这没有任何意义。当我从我编写的包调用一个函数时它得到它(它说这是一个递归错误),但是我可以在包main中调用相同的函数,就好了。没有涉及循环,也没有递归。
我现在也得到了其他软件包的错误。
import play_scraper
print(play_scraper.details("com.whatsapp"))
这会产生:
Traceback (most recent call last):
File "C:/Users/wd/OneDrive - UGent/Python/test/test.py", line 3, in <module>
print(play_scraper.details("com.whatsapp"))
File "C:\Users\wd\AppData\Roaming\Python\Python36\site-packages\play_scraper\api.py", line 22, in details
return s.details(app_id)
File "C:\Users\wd\AppData\Roaming\Python\Python36\site-packages\play_scraper\scraper.py", line 292, in details
response = send_request('GET', url)
File "C:\Users\wd\AppData\Roaming\Python\Python36\site-packages\play_scraper\utils.py", line 120, in send_request
verify=verify)
File "C:\Users\wd\AppData\Roaming\Python\Python36\site-packages\requests\api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\wd\AppData\Roaming\Python\Python36\site-packages\requests\sessions.py", line 502, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\wd\AppData\Roaming\Python\Python36\site-packages\requests\sessions.py", line 612, in send
r = adapter.send(request, **kwargs)
File "C:\Users\wd\AppData\Roaming\Python\Python36\site-packages\requests\adapters.py", line 440, in send
timeout=timeout
File "C:\Users\wd\AppData\Roaming\Python\Python36\site-packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "C:\Users\wd\AppData\Roaming\Python\Python36\site-packages\urllib3\connectionpool.py", line 345, in _make_request
self._validate_conn(conn)
File "C:\Users\wd\AppData\Roaming\Python\Python36\site-packages\urllib3\connectionpool.py", line 844, in _validate_conn
conn.connect()
File "C:\Users\wd\AppData\Roaming\Python\Python36\site-packages\urllib3\connection.py", line 314, in connect
cert_reqs=resolve_cert_reqs(self.cert_reqs),
File "C:\Users\wd\AppData\Roaming\Python\Python36\site-packages\urllib3\util\ssl_.py", line 265, in create_urllib3_context
context.options |= options
File "C:\Python36-32\lib\ssl.py", line 459, in options
super(SSLContext, SSLContext).options.__set__(self, value)
File "C:\Python36-32\lib\ssl.py", line 459, in options
super(SSLContext, SSLContext).options.__set__(self, value)
File "C:\Python36-32\lib\ssl.py", line 459, in options
super(SSLContext, SSLContext).options.__set__(self, value)
[Previous line repeated 323 more times]
RecursionError: maximum recursion depth exceeded while calling a Python object
显然,在我的双行脚本中不会发生任何类型的递归。我最好的猜测:我在3.6.1解释器中安装了一个未识别的包时改变了一些东西,因为我在3.5中没有得到这个错误。可能是我安装的play_scraper要求之一,
beautifulsoup4 (>=4.4.1)
grequests (>=0.3.0)
lxml (>=3.6.0)
requests (>=2.9.1)
尽管如此,这几乎是猜测。任何人都知道发生了什么事?
答案 0 :(得分:0)
我刚刚使用来自gunicorn gevent环境的请求遇到了同样的错误。
这可能与以下内容有关: https://github.com/gevent/gevent/issues/903
根据该问题,升级gevent版本应该可以解决问题,尽管我在版本1.2.2中看到了相同的错误。
答案 1 :(得分:0)
我在requests
之前导入grequests
时出现此错误。因此,为避免错误,请在grequests
之前导入grequests
(以及导入requests
的模块)(以及导入requests
的模块)。