gpt4 book ai didi

python - 进程以退出代码 245 结束

转载 作者:行者123 更新时间:2023-12-03 17:29:15 45 4
gpt4 key购买 nike

Ubuntu 18.04

Python 3.7.3

Django==2.2.3

堆栈跟踪:

pydev debugger: process 20074 is connecting

Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
August 31, 2019 - 14:28:33
Django version 2.2.3, using settings 'ads_manager.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Not Found: /]
[31/Aug/2019 14:30:22] "GET /] HTTP/1.1" 404 9405
[31/Aug/2019 14:30:24] "GET / HTTP/1.1" 200 4908
[31/Aug/2019 14:30:24] "GET /static/main.css HTTP/1.1" 304 0
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)
/home/michael/PycharmProjects/ads1/venv/lib/python3.7/site-packages/urllib3/connectionpool.py:851: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecureRequestWarning)

Process finished with exit code 245

几个 http 请求是在一个循环中发出的。换句话说,这个函数被多次调用:
import requests
def execute_request(ad_entity, data, url=None):
data_bytes = json.dumps(data, ensure_ascii=False).encode("utf-8")

headers = get_headers()

URL = url or '{}{}/'.format(API_ADDRESS, ad_entity.value.lower())

response = requests.post(URL, headers=headers, data=data_bytes,
verify=False)

这个问题似乎与python本身的线程安全有关。它似乎与 Django 无关。我试图通过在请求之间添加最多 2 秒的 sleep 来解决它。尽我所能,这并没有帮助。

你能在这里踢我吗:
1. 这段代码是什么意思,在哪里可以读到它?
2. 这个问题有什么解决办法吗?
3. 我可以打开更详细的日志记录或在某处找到更深入的日志吗?
4. 无论如何,如何定位这个问题?

最佳答案

这些警告来自 urllib3由于禁用了 HTTPS 证书验证而导致的模块。
对此负责的部分是 verify=False要修复它,只需将其删除或替换为 verify=True (默认)
另一种抑制警告的方法(强烈不推荐)是在导入请求之前添加以下内容:

import urllib3
urllib3.disable_warnings()

关于python - 进程以退出代码 245 结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57739139/

45 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com