Re: FileNotFoundError thrown due to file name in file, rather than file itself

2024-11-12 Thread Rob Cliffe via Python-list
On 12/11/2024 08:52, Loris Bennett via Python-list wrote: Cameron Simpson writes: Generally you should put a try/except around the smallest possible piece of code. That is excellent advice. Best wishes Rob Cliffe So: config = configparser.ConfigParser() try

sys.call_tracing

2025-01-30 Thread Rob Cliffe via Python-list
call_tracing()| enables explicit recursion of the tracing function. Is there any reason it doesn't support sys.call_tracing(/func/, /args/, kargs) to call func(*args, **kargs) ? Best wishes Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

configparser get non-existent boolean

2025-06-30 Thread Rob Cliffe via Python-list
last):   File "R:\Test.py", line 7, in     MY_STR = config['DEFAULT']['MY_STR']  # This does raise an Exception, naturally ~^^   File "C:\Python313\Lib\configparser.py", line 1276, in __getitem__     raise K

Optimising constant expressions

2025-06-26 Thread Rob Cliffe via Python-list
avoided for possible future compatibility issues?     Is it too difficult?     Would it slow down the compiler too much? Question 2:     Couldn't this be done (or is it to some extent already done) with other-built-in types, e.g. couldn't         [1] + [2] be compiled as [1,2] Best wishes Rob Cliffe -- https://mail.python.org/mailman3//lists/python-list.python.org

Searching for a file

2025-05-22 Thread Rob Cliffe via Python-list
ing like     C:\Python311\Lib\os.py This idea was partly inspired by Michael Stemper asking about best practice for placing, and finding, a configuration file. Thoughts? Best wishes Rob Cliffe -- https://mail.python.org/mailman3//lists/python-list.python.org

Re: Best practice for config files?

2025-05-22 Thread Rob Cliffe via Python-list
isn't).  Alternatively look at the PATH envronment variable, which contains a list of directories separated by semicolons and which you can access as os.environ['PATH'] . Best wishes, Rob Cliffe -- https://mail.python.org/mailman3//lists/python-list.python.org

Re: Searching for a file

2025-05-23 Thread Rob Cliffe via Python-list
On 23/05/2025 18:55, Mats Wichmann wrote: On 5/22/25 21:04, Rob Cliffe via Python-list wrote: It occurs to me that it might be useful if Python provided a function to search for a file with a given name in various directories (much as the import.import_lib function searches for a module in

Re: PEP Idea: Extended import syntax for aliasing module attributes

2025-06-16 Thread Rob Cliffe via Python-list
ill only be imported once). Best wishes, Rob Cliffe -- https://mail.python.org/mailman3//lists/python-list.python.org

Re: Dynamic classes

2025-05-19 Thread Rob Cliffe via Python-list
#x27;Flag2': 2, 'Flag3: 4, ' '__init__' : __init__}) This is not my area of expertise, but there is a misplaced quote before     '__init__' that should be after     'Flags3 Correct this, and your example runs without error. Best wishes Rob Cliffe -- https://mail.python.org/mailman/listinfo/python-list

Re: Searching for a file

2025-05-24 Thread Rob Cliffe via Python-list
On 25/05/2025 00:18, Mats Wichmann wrote: On 5/23/25 16:05, Rob Cliffe via Python-list wrote: On 23/05/2025 18:55, Mats Wichmann wrote: On 5/22/25 21:04, Rob Cliffe via Python-list wrote: It occurs to me that it might be useful if Python provided a function to search for a file with a

Re: Slices by length

2025-10-18 Thread Rob Cliffe via Python-list
On 06/09/2025 17:21, MRAB wrote: On 2025-09-06 13:47, Rob Cliffe via Python-list wrote: I quite often find myself writing expressions of the form       someString[x : x+n] where n is often an int and x may be an int, a variable, or a (possibly complicated) expression. It would be more natural

Slices by length

2025-09-06 Thread Rob Cliffe via Python-list
(or less plausibly "321"). I don't have a strong opinion on this; there may be good reasons for preferring one to another. Does anybody think this is a good idea? Best wishes Rob Cliffe -- https://mail.python.org/mailman3//lists/python-list.python.org

Re: Error installing matplotlib

2025-09-05 Thread Rob Cliffe via Python-list
On 03/09/2025 15:45, Oscar Benjamin wrote: On Wed, 3 Sep 2025, 15:40 Rob Cliffe, wrote: On 03/09/2025 15:35, Oscar Benjamin wrote: On Wed, 3 Sep 2025, 15:21 Rob Cliffe via Python-list, wrote: On 03/09/2025 14:59, Mats Wichmann wrote: > On 9/3/25 07

Error installing matplotlib

2025-09-02 Thread Rob Cliffe via Python-list
->RendererAgg::get_width() * 4)' from 'unsigned int' to 'int' inside { } [-Wnarrowing]       ninja: build stopped: subcommand failed.       INFO: autodetecting backend as ninja       INFO: calculating backend command to run: C:\Users\robcl\AppData\Local\Temp\pip-build-env-1u

Re: Access to return / exception context in finally block

2025-09-01 Thread Rob Cliffe via Python-list
urned by f supposed to be 10/x or __exit_context__.value + 1 # whatever that is Best wishes Rob Cliffe Dear Rob, isinstance(__exit_context__, ReturnContext) would only be True, when the try, except or else block is left using a return statement. __exit_context__.value would be the return value o

Re: Access to return / exception context in finally block

2025-09-01 Thread Rob Cliffe via Python-list
urned by f supposed to be 10/x or __exit_context__.value + 1 # whatever that is Best wishes Rob Cliffe Dear Rob, isinstance(__exit_context__, ReturnContext) would only be True, when the try, except or else block is left using a return statement. __exit_context__.value would be the return value

Re: Access to return / exception context in finally block

2025-08-31 Thread Rob Cliffe via Python-list
isinstance(__exit_context__, ReturnContext) be True and when would it be False? What would __exit_context__.value be? I can't think of a sensible meaning for it. If no exception occurs, is the value returned by f supposed to be 10/x or __exit_context__.value + 1 # whatever that is Best wishe

Re: Error installing matplotlib

2025-09-03 Thread Rob Cliffe via Python-list
On 03/09/2025 14:59, Mats Wichmann wrote: On 9/3/25 07:20, Rob Cliffe wrote: On 03/09/2025 00:01, Mats Wichmann wrote: On 9/2/25 14:51, Rob Cliffe via Python-list wrote: There are two roots here: (1) it's not finding a prebuilt wheel.  You can see that because it's propos

Re: Error installing matplotlib

2025-09-03 Thread Rob Cliffe via Python-list
On 03/09/2025 15:35, Oscar Benjamin wrote: On Wed, 3 Sep 2025, 15:21 Rob Cliffe via Python-list, wrote: On 03/09/2025 14:59, Mats Wichmann wrote: > On 9/3/25 07:20, Rob Cliffe wrote: >> >> >> On 03/09/2025 00:01, Mats Wichmann wrote: >

Re: Error installing matplotlib

2025-09-03 Thread Rob Cliffe via Python-list
On 03/09/2025 00:01, Mats Wichmann wrote: On 9/2/25 14:51, Rob Cliffe via Python-list wrote: There are two roots here: (1) it's not finding a prebuilt wheel.  You can see that because it's proposing to use the source distribution instead: > Collecting matplotlib >

Re: Slices by length

2025-10-18 Thread Rob Cliffe via Python-list
On 07/10/2025 20:37, Thomas Passin wrote: On 10/7/2025 2:49 PM, Rob Cliffe via Python-list wrote: On 06/09/2025 17:21, MRAB wrote: On 2025-09-06 13:47, Rob Cliffe via Python-list wrote: I quite often find myself writing expressions of the form       someString[x : x+n] where n is often an

<    6   7   8   9   10   11