Questions tagged [python-3.9]

A version of the Python programming language, first released on October 5, 2020. This tag is for issues that are specific to Python 3.9. For general questions use the more generic [python] and [python-3.x] tags.

3.9 was released on October 5, 2020 (PEP 596).


Use this tag if your question is specifically related to Python 3.9. 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

1128 questions
10
votes
1 answer

typing.Any in Python 3.9 and PEP 585 - Type Hinting Generics In Standard Collections

I am trying to understand if the typing package is still needed? If in Python 3.8 I do: from typing import Any, Dict my_dict = Dict[str, Any] Now in Python 3.9 via PEP 585 it's now preferred to use the built in types for collections hence: from…
garyj
  • 1,302
  • 2
  • 13
  • 22
10
votes
2 answers

Get local time zone name on Windows (Python 3.9 zoneinfo)

Checking out the zoneinfo module in Python 3.9, I was wondering if it also offers a convenient option to retrieve the local time zone (OS setting) on Windows. On GNU/Linux, you can do from datetime import datetime from zoneinfo import…
FObersteiner
  • 22,500
  • 8
  • 42
  • 72
9
votes
1 answer

TypeError: Strings must be encoded before hashing

On this code: ##script qui brute force les hashs import hashlib while True : try : wordlist_user = input("entrez votre wordlist: ") wordlist = open(wordlist_user, "r", encoding='utf-8') hash = input('entrez le hash…
Ayoub.A
  • 91
  • 1
  • 2
9
votes
3 answers

Type-hinting parameters with a sentinel value as the default

I currently use this strategy when I cannot assign default arguments in a function's signature and/or None already has meaning. from typing import Optional DEFAULT = object() # `None` already has meaning. def spam(ham: Optional[list[str]] =…
9
votes
1 answer

Is collections.abc.Callable bugged in Python 3.9.1?

Python 3.9 includes PEP 585 and deprecates many of the types in the typing module in favor of the ones in collections.abc, now that they support __class_getitem__. This is the case with for example Callable. To me it would seem that typing.Callable…
ruohola
  • 21,987
  • 6
  • 62
  • 97
8
votes
5 answers

How to fix error: Cannot register 2 metrics with the same name: /tensorflow/api/keras/optimizers

When I am trying to run a Python code for deep learning utilizing the TensorFlow library, I am getting the following error: 2021-10-24 10:07:13.619481: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library…
GEOFFREY ZIMBA
  • 101
  • 1
  • 1
  • 2
8
votes
2 answers

How to get the first sheet of an excel workbook using openpyxl?

I'm able to get the desired sheet by using wb["sheet_name"] method but I want to get the first, or let's say the nth sheet, regardless of the name. wb = load_workbook(filename = xlsx_dir) # xlsx_dir is the workbook path ws = wb["Details"] #…
8
votes
2 answers

What is wrong with the syntax of this simple Python list?

Maybe I've gotten rusty with Python. Why is this not acceptable when pasted into a Python shell? hdr_filenames = [ "20210311_105300_HDR.jpg", "20210311_105306_HDR.jpg", "20210311_105310_HDR.jpg", "20210311_105314_HDR.jpg", …
DarenW
  • 16,549
  • 7
  • 63
  • 102
8
votes
3 answers

Python 3.9 and Pycharm, HTMLParser AttributeError

When trying to create new python 3.9 Virtualenv Environment in Pycharm I got such error AttributeError: 'HTMLParser' object has no attribute 'unescape' Traceback (most recent call last): File…
Headmaster
  • 2,008
  • 4
  • 24
  • 51
8
votes
5 answers

On CentOS, how do I build Python 3.9 from source while incorporating my openssl module?

I'm trying to build Python 3.9.1 with SSL support on CentOS 7. [myuser@server Python-3.9.1]$ which openssl /usr/local/bin/openssl [myuser@server Python-3.9.1]$ openssl version OpenSSL 1.1.1g 21 Apr 2020 Running this command sudo ./configure…
Dave
  • 15,639
  • 133
  • 442
  • 830
8
votes
2 answers

Interpreter crashes trying to use tkinter library

I have tried to staring the application in VSCODE by Python3. This is the code: from tkinter import * window = Tk() window.mainloop() only 3 lines :)), but when I'm trying to execute the file in terminal it will give me an error, which you can see…
Arash Khosravi
  • 103
  • 1
  • 7
8
votes
3 answers

Python 3.9 Microsoft Visual C++ 14.0 or greater is required

so I recently upgraded to Python 3.9 and when trying to install some libraries - specifically pip install discord - I encountered the following error: ERROR: Command errored out with exit status 1: command:…
cap
  • 117
  • 1
  • 2
  • 7
7
votes
1 answer

Why does Pyrebase4 give me a installation error when using python3.9 on macOS

I am using pip 3.9/python 3.9 because pyrebase4 doesn't work with python 3.10.5/pip3 Here's the error: --- Logging error --- Traceback (most recent call last): File…
Panda
  • 159
  • 1
  • 11
7
votes
2 answers

Reduce size of snowflake-connector-python[pandas] module

I am trying to create a lambda function in AWS which connects to a Snowflake database. For this I need the snowflake-connector-python[pandas] package (https://docs.snowflake.com/en/user-guide/python-connector-pandas.html), which together with all of…
7
votes
1 answer

clickhouse_driver.errors.UnexpectedPacketFromServerError: Code: 102. Unexpected packet from server None:None

I'm trying to connect clickhouse_driver => python3.9 =>clickhouse_driver-0.2.1 【error】clickhouse_driver.errors.UnexpectedPacketFromServerError: Code: 102. Unexpected packet from server None:None (expected Hello or Exception, got Unknown…
Erguzi
  • 71
  • 1
  • 2
1
2
3
74 75