This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: [MacOS] Can't open file in a separate (threading.Thread) thread
Type: Stage: resolved
Components: macOS Versions: Python 3.8
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Jah-On, erlendaasland, mark.dickinson, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2020-12-30 22:08 by Jah-On, last changed 2022-04-11 14:59 by admin. This issue is now closed.

File name Uploaded Description Edit Jah-On, 2020-12-30 22:08 Minimal example of issue
lol.txt Jah-On, 2020-12-30 22:09 Text file
Pull Requests
URL Status Linked Edit
PR 26373 open erlendaasland, 2021-05-25 21:51
Messages (2)
msg384088 - (view) Author: Jah-On (Jah-On) * Date: 2020-12-30 22:08
Tested on MacOS Big Sur... Most recent version as of posting.
msg384090 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2020-12-30 23:01
Your test file has the line:

    f = open("lol.txt", "r", "utf-8")

But the third positional argument to the 'open' built-in function is "buffering", which expects an integer. Pass the "utf-8" argument by name instead:

    f = open("lol.txt", "r", encoding="utf-8")

As a side note, you probably also want to join your thread before exiting the script.

Closing here, since it looks as though there's no Python bug.
Date User Action Args
2022-04-11 14:59:39adminsetgithub: 86958
2021-05-25 21:51:17erlendaaslandsetpull_requests: + pull_request24965
2021-05-25 21:50:56erlendaaslandsetpull_requests: - pull_request24962
2021-05-25 21:50:49erlendaaslandsetpull_requests: - pull_request24961
2021-05-25 21:47:51erlendaaslandsetpull_requests: + pull_request24962
2021-05-25 21:40:14erlendaaslandsetnosy: + erlendaasland

pull_requests: + pull_request24961
2020-12-30 23:01:45mark.dickinsonsetstatus: open -> closed

nosy: + mark.dickinson
messages: + msg384090

resolution: not a bug
stage: resolved
2020-12-30 22:09:13Jah-Onsetfiles: + lol.txt
2020-12-30 22:08:17Jah-Oncreate