python-3.7

How to fix ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)?

喜欢而已 提交于 2020-05-30 08:42:09
问题 I am trying to send an email with python, but it keeps saying ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056) . Here is my code: server = smtplib.SMTP_SSL('smtp.mail.com', 587) server.login("something0@mail.com", "password") server.sendmail( "something0@mail.com", "something@mail.com", "email text") server.quit() Do you know what is wrong? 回答1: That usually happens when the client doesn't understand the ServerHello message that is supposed to come from the server.

OpenCV VideoWriter Not Writing to Output.avi

五迷三道 提交于 2020-05-29 10:00:08
问题 I'm attempting to write a simple bit of code that takes a video, crops it, and writes to an output file. System Setup: OS: Windows 10 Conda Environment Python Version: 3.7 OpenCV Version: 3.4.2 ffmpeg Version: 2.7.0 File Input Specs: Codec: H264 - MPEG-4 AVC (part 10)(avc1) Type: Video Video resolution: 640x360 Frame rate: 5.056860 Code failing to produce output (it creates the file but doesn't write to it): import numpy as np import cv2 cap = cv2.VideoCapture('croptest1.mp4') # Define the

ContextVars across modules

…衆ロ難τιáo~ 提交于 2020-05-29 06:37:47
问题 I am completely newb on asyncio and ContextVars , I just read up what's new in 3.7 and discovered ContextVars , I struggle to understand it's usage, all I know it's helpful in coroutines, instead of using thread.local should use ContextVars . But none of the official doc and top google search result could help me truely understand its purpose. So is convextvars shared across modules? I tried: example.py from contextvars import ContextVar number = ContextVar('number', default=100) number.set(1

Python 3.7 on Ubuntu 20.04

僤鯓⒐⒋嵵緔 提交于 2020-05-27 04:37:10
问题 I am preparing a docker image for Ubuntu 20.04 and due to TensorFlow 2.0 requirement I need Python 3.7. TensorFlow runs on Python 3.5 to 3.7. Running apt install python3 installs Python 3.8 by default and that breaks my TensorFlow installation. Is there any way I can get apt package for Python 3.7 for Ubuntu 20.04? Since it is going to be inside docker image, I don't want to get into business of downloading Python 3.7 source code and compiling. Putting those commands in Dockerfile will be

Python 3.7 on Ubuntu 20.04

心已入冬 提交于 2020-05-27 04:37:06
问题 I am preparing a docker image for Ubuntu 20.04 and due to TensorFlow 2.0 requirement I need Python 3.7. TensorFlow runs on Python 3.5 to 3.7. Running apt install python3 installs Python 3.8 by default and that breaks my TensorFlow installation. Is there any way I can get apt package for Python 3.7 for Ubuntu 20.04? Since it is going to be inside docker image, I don't want to get into business of downloading Python 3.7 source code and compiling. Putting those commands in Dockerfile will be

How can I encforce some function parameters to be only positional only

こ雲淡風輕ζ 提交于 2020-05-26 09:20:53
问题 I want to mimic this behaviour of Python3.8 in Python3.7 Positional-only parameters / was the syntax introduced to indicate that some function parameters must be specified positionally and cannot be used as keyword arguments. #Python3.8 def f(a,b,/,**kwargs): print(a,b,kwargs) >>> f(1,2,**{'a':100,'b':200,'c':300}) # 1 2 {'a': 100, 'b': 200, 'c': 300} a , b are used only as positional parameters. How I do the same in Python3.7 #Python3.7 def f(a,b,**kwargs): print(a,b,kwargs) >>> f(1,2,**{'a'

How solve High latency in app engine caused by “This request caused a new process to be started for your application…”?

安稳与你 提交于 2020-05-17 07:02:54
问题 App working with standard environment app engine, python 3.7 and cloud sql (Mysql) Checking the logs there are some with very high latencies (more than 4 seconds), when the expected are 800ms. All these logs are accompanied by this message: "This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application." I understand that

Dataclass-style object with mutable and immutable properties?

可紊 提交于 2020-05-16 07:47:25
问题 I have been playing around with dataclasses dynamically loaded with property names from a file and I am unable to find a way to create both 'frozen' and 'non-frozen' properties. I believe dataclasses only allow you to set all properites to frozen or non-frozen. As of now, I create a frozen dataclass and add a mutable class as one of the properties which I can change as I go but I am not very happy with the readability of this approach. Is there another pythonic dataclass people would

Dataclass-style object with mutable and immutable properties?

倾然丶 夕夏残阳落幕 提交于 2020-05-16 07:47:05
问题 I have been playing around with dataclasses dynamically loaded with property names from a file and I am unable to find a way to create both 'frozen' and 'non-frozen' properties. I believe dataclasses only allow you to set all properites to frozen or non-frozen. As of now, I create a frozen dataclass and add a mutable class as one of the properties which I can change as I go but I am not very happy with the readability of this approach. Is there another pythonic dataclass people would

unable to install wxPython on Ubuntu with python3.7 using pip3

喜你入骨 提交于 2020-05-16 02:43:05
问题 I have to install wxPython . I have, Ubuntu 18.10 python version: Python 3.7.3 pip3 version: pip 19.0.3 from /usr/local/lib/python3.7/site-packages/pip (python 3.7) I run command, pip3 install wxPython it through the following errors: Checking for /tmp/pip-install-mjeu3aw7/wxpython/bin/waf-2.0.8... "/usr/local/bin/python3.7" /tmp/pip-install-mjeu3aw7/wxpython/bin/waf-2.0.8 --wx_config=/tmp/pip-install-mjeu3aw7/wxpython/build/wxbld/gtk3/wx-config --gtk3 --python="/usr/local/bin/python3.7" -