# Python Help

**URL:** https://discuss.python.org/c/help/7.md

[Latest](https://discuss.python.org/latest.md) · [Categories](https://discuss.python.org/categories.md) · [Tags](https://discuss.python.org/tags.md)

---

## [About the Python Help category](https://discuss.python.org/t/about-the-python-help-category/42)

<div class="topic-metadata">

**Author:** [@system](https://discuss.python.org/u/system)\
**Replies:** 4\
**Last updated:** [May 31, 2022, 3:09am UTC](https://discuss.python.org/t/about-the-python-help-category/42 "2022-05-31T03:09:27Z")

</div>

General help/discussion forum for the Python programming language. All welcome. Please format your pasted code using Markdown backticks like this: \`\`\`python # YOUR CODE GOES HERE if me.is\_hungry: me.bake("bagel") \`\`…

---

## [Help with adding multiple $PATHS to a subprocess call to source multiple directories](https://discuss.python.org/t/help-with-adding-multiple-paths-to-a-subprocess-call-to-source-multiple-directories/109280)

<div class="topic-metadata">

**Author:** [@useronetoothreeeee](https://discuss.python.org/u/useronetoothreeeee)\
**Replies:** 1\
**Last updated:** [September 30, 2026, 11:31am UTC](https://discuss.python.org/t/help-with-adding-multiple-paths-to-a-subprocess-call-to-source-multiple-directories/109280 "2026-09-30T11:31:02Z")

</div>

I am not quite understanding how things work yet. I have cobbled something together in my main script and it is running the main program now, which it wasn’t before, but the program is not seeing the files even in the s…

---

## [Getting frustrated trying to setup my vim settings how I used to have them some years ago!](https://discuss.python.org/t/getting-frustrated-trying-to-setup-my-vim-settings-how-i-used-to-have-them-some-years-ago/109250)

<div class="topic-metadata">

**Author:** [@useronetoothreeeee](https://discuss.python.org/u/useronetoothreeeee)\
**Replies:** 3\
**Last updated:** [September 30, 2026, 10:59am UTC](https://discuss.python.org/t/getting-frustrated-trying-to-setup-my-vim-settings-how-i-used-to-have-them-some-years-ago/109250 "2026-09-30T10:59:06Z")

</div>

Just getting back into it after a few years and trying to set up Vim nicely how I remember it as when I started coding the settings came back to me of how I used to have them but been mucking about for about an hour now …

---

## [Passing a string containing keyword arguments to a function, combining into list comprehension](https://discuss.python.org/t/passing-a-string-containing-keyword-arguments-to-a-function-combining-into-list-comprehension/109266)

<div class="topic-metadata">

**Author:** [@NickC](https://discuss.python.org/u/NickC)\
**Replies:** 19\
**Last updated:** [September 30, 2026, 6:55am UTC](https://discuss.python.org/t/passing-a-string-containing-keyword-arguments-to-a-function-combining-into-list-comprehension/109266 "2026-09-30T06:55:33Z")

</div>

Having encountered the difficulty of passing a string of keyword arguments into a function I have found the solution below by converting the string into a dict. However I am having some difficulty combining the for...in …

---

## [Regex, string with diacritics](https://discuss.python.org/t/regex-string-with-diacritics/41013)

<div class="topic-metadata">

**Author:** [@marian](https://discuss.python.org/u/marian)\
**Replies:** 5\
**Last updated:** [September 30, 2026, 6:55am UTC](https://discuss.python.org/t/regex-string-with-diacritics/41013 "2026-09-30T06:55:17Z")

</div>

I noticed some strange behavior when searching string with diacritics using regex. Fortunately in Python I get the results right, without any extra setting. (So perhaps it’s wrong forum to write here, but still, I’d li…

---

## [Ouch: several instances of the same key in a dictionary. Duplicate keys in a dictionary](https://discuss.python.org/t/ouch-several-instances-of-the-same-key-in-a-dictionary-duplicate-keys-in-a-dictionary/109273)

<div class="topic-metadata">

**Author:** [@Mabooka-Mabooka](https://discuss.python.org/u/Mabooka-Mabooka)\
**Replies:** 10\
**Last updated:** [September 30, 2026, 5:31am UTC](https://discuss.python.org/t/ouch-several-instances-of-the-same-key-in-a-dictionary-duplicate-keys-in-a-dictionary/109273 "2026-09-30T05:31:40Z")

</div>

I ran into some very strange behavior. I have right now a \*.json file (that I am willing to upload / show); that json file is created by a simple single statement json.dump(d, file); the object d stored in this file …

---

## [How to annotate a dict containing classes](https://discuss.python.org/t/how-to-annotate-a-dict-containing-classes/109279)

<div class="topic-metadata">

**Author:** [@NickC](https://discuss.python.org/u/NickC)\
**Replies:** 1\
**Last updated:** [September 29, 2026, 11:38pm UTC](https://discuss.python.org/t/how-to-annotate-a-dict-containing-classes/109279 "2026-09-29T23:38:01Z")

</div>

How do I correctly annotate a dict containing a list of str and a class: local\_dict: dict\[(str, Any)\] = {"oRequest": Process.oRequest, "oResponse": self} Both oRequest and self are classes instances of their respective…

---

## [Should Python JSON decoders silently convert oversized integers to float?](https://discuss.python.org/t/should-python-json-decoders-silently-convert-oversized-integers-to-float/109278)

<div class="topic-metadata">

**Author:** [@Nineteendo](https://discuss.python.org/u/Nineteendo)\
**Replies:** 4\
**Last updated:** [September 29, 2026, 8:29pm UTC](https://discuss.python.org/t/should-python-json-decoders-silently-convert-oversized-integers-to-float/109278 "2026-09-29T20:29:56Z")

</div>

I came across a behavior in orjson that I’m curious about. \>\>\> n = 2\*\*64 + 1 \>\>\> s = json.dumps(n) \>\>\> json.loads(s) 18446744073709551617 \>\>\> orjson.loads(s) 1.8446744073709552e+19 So orjson.loads() turns a JSON intege…

---

## [Iteration While Nested Loop](https://discuss.python.org/t/iteration-while-nested-loop/109277)

<div class="topic-metadata">

**Author:** [@AmericanFailure](https://discuss.python.org/u/AmericanFailure)\
**Replies:** 0\
**Last updated:** [September 29, 2026, 6:40pm UTC](https://discuss.python.org/t/iteration-while-nested-loop/109277 "2026-09-29T18:40:34Z")

</div>

Can someone help me figure out this nested while loop This is what I was given to do: And this is what I have so far:

---

## [Lisp Machine style Listener for Python](https://discuss.python.org/t/lisp-machine-style-listener-for-python/109265)

<div class="topic-metadata">

**Author:** [@dharmatech](https://discuss.python.org/u/dharmatech)\
**Replies:** 2\
**Last updated:** [September 29, 2026, 11:34am UTC](https://discuss.python.org/t/lisp-machine-style-listener-for-python/109265 "2026-09-29T11:34:32Z")

</div>

Hey y’all :man\_raising\_hand: The Symbolics Lisp Machine had something called the Listener. It was sort of a combination of command shell and Lisp read eval print loop. But it also featured a “presentation based user i…

---

## [Py314t uses 2× memory](https://discuss.python.org/t/py314t-uses-2x-memory/108941)

<div class="topic-metadata">

**Author:** [@weixlu](https://discuss.python.org/u/weixlu)\
**Replies:** 20\
**Last updated:** [September 29, 2026, 3:46am UTC](https://discuss.python.org/t/py314t-uses-2x-memory/108941 "2026-09-29T03:46:19Z")

</div>

I’m migrating BEVFormer (an auto-driving model training framework) from Py3.14 to 3.14t. Functionally it runs, but memory usage (RAM, not GPU memory) on 3.14t is about twice that of 3.14. I’ve run many training epochs an…

---

## [I have issues with Python IDLE 3.xx under windows](https://discuss.python.org/t/i-have-issues-with-python-idle-3-xx-under-windows/108951)

<div class="topic-metadata">

**Author:** [@beta-tester](https://discuss.python.org/u/beta-tester)\
**Replies:** 4\
**Last updated:** [September 28, 2026, 8:56pm UTC](https://discuss.python.org/t/i-have-issues-with-python-idle-3-xx-under-windows/108951 "2026-09-28T20:56:54Z")

</div>

hi, i am new here. i have issues with Python IDLE 3.13.15 under Windows 11. if i have entries under “File|Recent Files \>” in Python IDLE Shell where the underlying file does not exist anymore, and i click that entry, …

---

## [Why doesn't str.strip work as I expect?](https://discuss.python.org/t/why-doesnt-str-strip-work-as-i-expect/109257)

<div class="topic-metadata">

**Author:** [@tjreedy](https://discuss.python.org/u/tjreedy)\
**Replies:** 4\
**Last updated:** [September 28, 2026, 1:43pm UTC](https://discuss.python.org/t/why-doesnt-str-strip-work-as-i-expect/109257 "2026-09-28T13:43:21Z")

</div>

A beginner who should have asked this here, opened a tracker issue thinking that " ##Python## ".lstrip('#') (edited to change ’ #’ to ‘#’) should produce "Python## ". In other words, that lstrip always deletes leading …

---

## [Python spell checker](https://discuss.python.org/t/python-spell-checker/109252)

<div class="topic-metadata">

**Author:** [@jason1](https://discuss.python.org/u/jason1)\
**Replies:** 9\
**Last updated:** [September 28, 2026, 4:37am UTC](https://discuss.python.org/t/python-spell-checker/109252 "2026-09-28T04:37:51Z")

</div>

I’m trying to make spell checker program that will compare words from a text file to a dictionary of words that are in alphabetical order. If the words don’t appear in the dictionary they should show up in a list as pote…

---

## [Segfault in CPython 3.14.7](https://discuss.python.org/t/segfault-in-cpython-3-14-7/109256)

<div class="topic-metadata">

**Author:** [@Zatt](https://discuss.python.org/u/Zatt)\
**Replies:** 1\
**Last updated:** [September 27, 2026, 6:40pm UTC](https://discuss.python.org/t/segfault-in-cpython-3-14-7/109256 "2026-09-27T18:40:35Z")

</div>

Is there anyplace specific to send a crash report so that the devs get the details?

---

## [Building different versions of a package for different editable venvs from a single checkout](https://discuss.python.org/t/building-different-versions-of-a-package-for-different-editable-venvs-from-a-single-checkout/109247)

<div class="topic-metadata">

**Author:** [@yannd](https://discuss.python.org/u/yannd)\
**Replies:** 2\
**Last updated:** [September 26, 2026, 9:19pm UTC](https://discuss.python.org/t/building-different-versions-of-a-package-for-different-editable-venvs-from-a-single-checkout/109247 "2026-09-26T21:19:54Z")

</div>

There is a dependency of a project of mine, on which I’d like to hack. That dependency (kivy) declares a few optional dependencies, and builds a few native modules with cython; my project requires a given set of them (a…

---

## [Type-hinting instance variables](https://discuss.python.org/t/type-hinting-instance-variables/109240)

<div class="topic-metadata">

**Author:** [@NickC](https://discuss.python.org/u/NickC)\
**Replies:** 4\
**Last updated:** [September 26, 2026, 2:22pm UTC](https://discuss.python.org/t/type-hinting-instance-variables/109240 "2026-09-26T14:22:48Z")

</div>

Not sure if I am doing this correctly, so far I have been type-hinting my instance variables by listing them under the class definition which seems to be the recommended Python way. However I am now getting concerned abo…

---

## [In IDLE, display id in Debug Control window](https://discuss.python.org/t/in-idle-display-id-in-debug-control-window/109201)

<div class="topic-metadata">

**Author:** [@Belami](https://discuss.python.org/u/Belami)\
**Replies:** 10\
**Last updated:** [September 25, 2026, 10:14pm UTC](https://discuss.python.org/t/in-idle-display-id-in-debug-control-window/109201 "2026-09-25T22:14:28Z")

</div>

It’s a very simple suggestion. In IDLE, display id in Debug Control window.

---

## [Struggling with packaging Pygame (Python 3.13.5) for Android APK under restricted network environment (China)](https://discuss.python.org/t/struggling-with-packaging-pygame-python-3-13-5-for-android-apk-under-restricted-network-environment-china/109026)

<div class="topic-metadata">

**Author:** [@asdd](https://discuss.python.org/u/asdd)\
**Replies:** 5\
**Last updated:** [September 25, 2026, 1:32pm UTC](https://discuss.python.org/t/struggling-with-packaging-pygame-python-3-13-5-for-android-apk-under-restricted-network-environment-china/109026 "2026-09-25T13:32:46Z")

</div>

Hi everyone, I am developing a 2D game using Python 3.13.5 and Pygame. I’ve spent over a month trying to package it as an APK for Android, but faced unsolvable issues due to toolchain incompatibilities and network restr…

---

## [Subclassing mysql.connector](https://discuss.python.org/t/subclassing-mysql-connector/109202)

<div class="topic-metadata">

**Author:** [@NickC](https://discuss.python.org/u/NickC)\
**Replies:** 6\
**Last updated:** [September 24, 2026, 4:12pm UTC](https://discuss.python.org/t/subclassing-mysql-connector/109202 "2026-09-24T16:12:15Z")

</div>

Any idea why I can’t subclass mysql.connector like this: import mysql.connector class Database(mysql.connector.MySQLConnection): def \_\_init\_\_(self, \*args, \*\*kwargs): super().\_\_init\_\_(\*\*kwargs) db\_config={'…

---

## [Whatsnewt - A TUI text adventure through what's new in Python 3.15 a TUI adventure](https://discuss.python.org/t/whatsnewt-a-tui-text-adventure-through-whats-new-in-python-3-15-a-tui-adventure/109204)

<div class="topic-metadata">

**Author:** [@barry](https://discuss.python.org/u/barry)\
**Replies:** 1\
**Last updated:** [September 24, 2026, 11:32am UTC](https://discuss.python.org/t/whatsnewt-a-tui-text-adventure-through-whats-new-in-python-3-15-a-tui-adventure/109204 "2026-09-24T11:32:21Z")

</div>

With Python 3.15 scheduled for release in 8 days, I had this idea to whip up a little TUI adventure game that takes you through a What’s New in Python 3.15. With the help of my agent buddy, I present to you “whatsnewt”: …

---

## [How to cleanly close sql connection pool](https://discuss.python.org/t/how-to-cleanly-close-sql-connection-pool/109200)

<div class="topic-metadata">

**Author:** [@NickC](https://discuss.python.org/u/NickC)\
**Replies:** 0\
**Last updated:** [September 23, 2026, 2:54pm UTC](https://discuss.python.org/t/how-to-cleanly-close-sql-connection-pool/109200 "2026-09-23T14:54:56Z")

</div>

How do I cleanly shutdown an sql connection pool and release all idle connections? I have looked at both mysql-connector-python and MyPySQL but neither seem to have a method to close all connections. This raises the qu…

---

## [Exceptions some time can be lost](https://discuss.python.org/t/exceptions-some-time-can-be-lost/109190)

<div class="topic-metadata">

**Author:** [@FeelUsM](https://discuss.python.org/u/FeelUsM)\
**Replies:** 17\
**Last updated:** [September 23, 2026, 1:50pm UTC](https://discuss.python.org/t/exceptions-some-time-can-be-lost/109190 "2026-09-23T13:50:38Z")

</div>

Main problem: exceptions some time can be lost. Assume E1 and E2 are two completely unrelated exceptions. (For example E1 is FileNotFoundError and E2 is AttributeError) class E1(Exception): pass class E2(Exception): p…

---

## [Please help I'm beginner](https://discuss.python.org/t/please-help-im-beginner/109198)

<div class="topic-metadata">

**Author:** [@Bludingtonn](https://discuss.python.org/u/Bludingtonn)\
**Replies:** 2\
**Last updated:** [September 23, 2026, 11:14am UTC](https://discuss.python.org/t/please-help-im-beginner/109198 "2026-09-23T11:14:44Z")

</div>

I am trying to use append command, and it doesnt work. Is this code written correctly? cool\_list = “luisgamercool”, “flimflam”, “flamingo” print(cool\_list) cool\_list.append(“ok”) print(cool\_list)

---

## [How to write binary file in python and read it in C++](https://discuss.python.org/t/how-to-write-binary-file-in-python-and-read-it-in-c/109187)

<div class="topic-metadata">

**Author:** [@Machiel](https://discuss.python.org/u/Machiel)\
**Replies:** 7\
**Last updated:** [September 22, 2026, 1:08pm UTC](https://discuss.python.org/t/how-to-write-binary-file-in-python-and-read-it-in-c/109187 "2026-09-22T13:08:19Z")

</div>

Hi, I have some C++ code that reads binary data from a file. When I use a C++ code to write to it, everything works. But I need a python code to write the file. It works for the first word that I write (using “\`fout.wri…

---

## [Understand gil in practical scenarios](https://discuss.python.org/t/understand-gil-in-practical-scenarios/108404)

<div class="topic-metadata">

**Author:** [@anandkaka](https://discuss.python.org/u/anandkaka)\
**Replies:** 7\
**Last updated:** [September 22, 2026, 3:27am UTC](https://discuss.python.org/t/understand-gil-in-practical-scenarios/108404 "2026-09-22T03:27:16Z")

</div>

i need to understand gill in practical way. Some of the facts i understood - it is for reference count of objects without gil or with gil, still if there is possibility of race condition it will crash or misbehave no-…

---

## [Is urllib.parse.urljoin() harmful](https://discuss.python.org/t/is-urllib-parse-urljoin-harmful/109165)

<div class="topic-metadata">

**Author:** [@mcepl](https://discuss.python.org/u/mcepl)\
**Replies:** 0\
**Last updated:** [September 21, 2026, 11:47pm UTC](https://discuss.python.org/t/is-urllib-parse-urljoin-harmful/109165 "2026-09-21T23:47:15Z")

</div>

I was fixing security issue in WebOb for openSUSE and in one of the concerned commits I found this: Subject: Replace the use of Python’s stdlib urljoin with our own Reliance on the version shipped with Python has led …

---

## [Checking if reused mySQL connection is still live before use](https://discuss.python.org/t/checking-if-reused-mysql-connection-is-still-live-before-use/109158)

<div class="topic-metadata">

**Author:** [@NickC](https://discuss.python.org/u/NickC)\
**Replies:** 0\
**Last updated:** [September 21, 2026, 10:26pm UTC](https://discuss.python.org/t/checking-if-reused-mysql-connection-is-still-live-before-use/109158 "2026-09-21T22:26:21Z")

</div>

Does anyone know if it is necessary to check whether a mysql.connector is connected each time I reuse ti before running any SQL statements or is this something which is already built-in to mysql.connector? Do I need to c…

---

## [Hasattr() performance on objects with \_\_slots\_\_](https://discuss.python.org/t/hasattr-performance-on-objects-with-slots/109134)

<div class="topic-metadata">

**Author:** [@crj](https://discuss.python.org/u/crj)\
**Replies:** 4\
**Last updated:** [September 20, 2026, 3:49pm UTC](https://discuss.python.org/t/hasattr-performance-on-objects-with-slots/109134 "2026-09-20T15:49:32Z")

</div>

For a particular application I was wondering whether to represent a state by the absence of an attribute, or by the attribute being None. Curious, I decided to benchmark it, and the result surprised me a lot: hasattr() …

---

## [Minimal debugger for C++ application Python script](https://discuss.python.org/t/minimal-debugger-for-c-application-python-script/109093)

<div class="topic-metadata">

**Author:** [@dan-t](https://discuss.python.org/u/dan-t)\
**Replies:** 6\
**Last updated:** [September 20, 2026, 10:39am UTC](https://discuss.python.org/t/minimal-debugger-for-c-application-python-script/109093 "2026-09-20T10:39:31Z")

</div>

Hi, we’ve a C++ Qt application that’s scriptable by Python. We would like to have a minimal debugger when such a Python script is executed with the application. Being able to set breakpoints, single stepping and step…

[Next page](https://discuss.python.org/c/help/7.md?page=1)
