简体   繁体   English

进程以退出代码 245 结束

[英]Process finished with exit code 245

Ubuntu 18.04 Ubuntu 18.04

Python 3.7.3蟒蛇 3.7.3

Django==2.2.3姜戈==2.2.3

The stack trace:堆栈跟踪:

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

Several http requests are made in a loop.多个 http 请求是在循环中进行的。 In other words, this function was called several times:换句话说,这个函数被多次调用:

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)

The problem seems to have something with thread safety in python itself.这个问题似乎与 python 本身的线程安全有关。 It doesn't seem to have something with Django.它似乎与 Django 没有什么关系。 I tried to solve it by adding sleep up to 2 seconds between requests.我试图通过在请求之间添加最多 2 秒的睡眠来解决它。 It didn't help as far as I can see to the best of my ability.就我所能看到的尽我所能,它没有帮助。

Could you give me a kick here: 1. What does this code mean and where to read about it?你能在这里给我踢一下吗: 1. 这段代码是什么意思以及在哪里阅读它? 2. Is there any solution to this problem? 2. 这个问题有什么解决办法吗? 3. Can I switch on a more elaborate logging or find a more in-depth log somewhere? 3. 我可以打开更详细的日志记录或在某处找到更深入的日志吗? 4. Anyway, how to localize this problem? 4.无论如何,如何定位这个问题?

These warnings are coming from the urllib3 module due to the HTTPS certificate verification being disabled.由于 HTTPS 证书验证被禁用,这些警告来自urllib3模块。

The part responsible for that would be the verify=False to fix it simply remove it or replace it by verify=True (default)对此负责的部分是verify=False来修复它,只需将其删除或替换为verify=True (默认)

Another way to suppress the warnings ( highly not recommended ) would be to add the following before importing requests:另一种抑制警告的方法(强烈不推荐)是在导入请求之前添加以下内容:

import urllib3
urllib3.disable_warnings()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM