Questions tagged [python-3.8]

This tag is for issues that are specific to Python 3.8. For general questions use the more generic [python] and [python-3.x] tags.

Python 3.8 was released on 2019-10-14 (PEP 569).


Use this tag if your question is specifically related to Python 3.8. Otherwise, use the following guidelines to determine which tag(s) you should add to your question:

  • If your question applies to Python in general, use only the tag.
  • If your question applies to Python 3.x but not to Python 2.x, add the tag .
  • If you aren't sure, tag your question with and mention which version you're using in the post.

References

1757 questions
7
votes
1 answer

Python 3.8 shared_memory resource_tracker producing unexpected warnings at application close

I am using a multiprocessing.Pool which calls a function in 1 or more subprocesses to produce a large chunk of data. The worker process creates a multiprocessing.shared_memory.SharedMemory object and uses the default name assigned by…
David Parks
  • 25,796
  • 41
  • 148
  • 265
7
votes
3 answers

How can I get user input in a python discord bot?

I have a python discord bot and I need it to get user input after a command, how can I do this? I am new to python and making discord bots. Here is my code: import discord, datetime, time from discord.ext import commands from datetime import date,…
drakeerv
  • 191
  • 1
  • 1
  • 12
7
votes
1 answer

SimpleCookie generic type

SimpleCookie is apparently a generic type and thus the following code (test.py) gives an error when checked with mypy: from http.cookies import SimpleCookie cookie = SimpleCookie() test.py:3: error: Need type annotation for 'cookie' Now if I…
Agost Biro
  • 2,251
  • 14
  • 26
7
votes
1 answer

Getting the literal out of a python Literal type, at runtime?

How can I get the literal value out of a Literal[] from typing? from typing import Literal, Union Add = Literal['add'] Multiply = Literal['mul'] Action = Union[Add,Multiply] def do(a: Action): if a == Add: print("Adding!") elif a…
LudvigH
  • 1,769
  • 17
  • 33
7
votes
1 answer

Python 3.8 failed to compile Module _uuid

Compiling the recent version of Python 3.8, the UUID module failed with this following error: /home/centos/Python-3.8.0/Modules/_uuidmodule.c: In function ‘py_uuid_generate_time_safe’: /home/centos/Python-3.8.0/Modules/_uuidmodule.c:19:5: error:…
Herve Meftah
  • 701
  • 1
  • 6
  • 13
6
votes
3 answers

Top level object in './docker-compose.yml' needs to be an object not ''

I'm using python 3.8, Docker version 19.03.13, build 4484c46d9d 3.8 version: '3.8' services: web: build: . command: python /code/manage.py runserver 0.0.0.0:8000 volumes: - .:/code ports: - 8000:8000
6
votes
2 answers

How to build list of tasks for asyncio.gather in Python 3.8

Below I have attached a test program to demonstrate a problem I am having with asyncio.gather throwing a TypeError. My objective: To make multiple concurrent asynchronous calls to capture camera images to files from an array of USB cameras attached…
mcgregor94086
  • 1,229
  • 1
  • 10
  • 15
6
votes
2 answers

Confused why after 2nd evaluation of += operator of immutable string does not change the id in Python3

I'm using Python 3.8.3 & I got some unexpected output like below when checking id of strings. >>> a="d" >>> id(a) 1984988052656 >>> a+="e" >>> id(a) 1985027888368 >>> a+="h" >>> id(a) 1985027888368 >>> a+="i" >>> id(a) 1985027888368 >>> After the…
Chamod
  • 369
  • 2
  • 11
6
votes
1 answer

Did I/O become slower since Python 2.7?

I'm currently having a small side project in which I want to sort a 20GB file on my machine as fast as possible. The idea is to chunk the file, sort the chunks, merge the chunks. I just used pyenv to time the radixsort code with different Python…
Martin Thoma
  • 91,837
  • 114
  • 489
  • 768
6
votes
1 answer

What is the recommended way to annotate datetime objects?

Suppose I have a function which takes two datetimes and returns the difference in seconds: import datetime def diff(d1: datetime.datetime, d2: datetime.datetime) -> float: return (d2 - d1).total_seconds() if __name__ == '__main__': d1 =…
Martin Thoma
  • 91,837
  • 114
  • 489
  • 768
6
votes
3 answers

Trying to Install Sklearn on Python 3.8 Gives an Error

I'm trying to install sklearn (scikit-learn) on Python 3.8 on Windows 10 using the following: pip install sklearn I've also used: pip3 install sklearn pip install scikit-learn pip install -U scikit-learn As well as: pip install --only-binary…
6
votes
2 answers

PyWin32 and Python 3.8.0

Python 3.8.0 has been recently released (on 20191014, and can be downloaded from [Python]: Python 3.8.0). PyWin32 has builds for it on [PyPI]: pywin32 225 (released on 20190915). Unfortunately, after pip installing, it doesn't…
CristiFati
  • 28,721
  • 9
  • 41
  • 63
6
votes
3 answers

How to rewrite this simple loop using assignment expressions introduced in Python 3.8 alpha?

It appears to me that it is not that straight forward to interchange classic while loops with assignment-expressions-loops keeping the code looking great. Consider example1: >>> a = 0 >>> while (a := a+1) < 10: ... print(a) ...…
alec_djinn
  • 7,288
  • 8
  • 29
  • 58
5
votes
2 answers

Recover from segfault in Python

I have a few functions in my code that are randomly causing SegmentationFault error. I've identified them by enabling the faulthandler. I'm a bit stuck and have no idea how to reliably eliminate this problem. I'm thinking about some workaround.…
Djent
  • 1,311
  • 4
  • 24
  • 48
5
votes
11 answers

Pytube only works periodically (KeyError: 'assets')

Five out of ten times Pytube will send me this error when attempting to run my small testing script. Here's the script: import pytube import urllib.request from pytube import YouTube yt =…
theboy
  • 215
  • 2
  • 9