Re: [Solved] Re: Windows registry PermissionError

2022-05-12 Thread Eryk Sun
On 5/13/22, Mike Dewhirst wrote: > On 13/05/2022 4:14 pm, Eryk Sun wrote: >> Since self.connect() is always called, you should document that the >> initial hkey parameter has to be one of the following predefined key >> handles: >> >> HKEY_LOCAL_MACHINE >> HKEY_USERS > > I'm targeting HK

Re: [Solved] Re: Windows registry PermissionError

2022-05-12 Thread Mike Dewhirst
On 13/05/2022 4:14 pm, Eryk Sun wrote: Since self.connect() is always called, you should document that the initial hkey parameter has to be one of the following predefined key handles: HKEY_LOCAL_MACHINE HKEY_USERS I'm targeting HKEY_CURRENT_USER so I assume HK_USERS includes that.

Re: [Solved] Re: Windows registry PermissionError

2022-05-12 Thread Eryk Sun
Since self.connect() is always called, you should document that the initial hkey parameter has to be one of the following predefined key handles: HKEY_LOCAL_MACHINE HKEY_USERS HKEY_PERFORMANCE_DATA WinAPI RegConnectRegistryW() only matters when the target computer is a different machi

[Solved] Re: Windows registry PermissionError

2022-05-12 Thread Mike Dewhirst
Eryk Many thanks. It is working perfectly now. See below for the reworked code. Cheers Mike On 13/05/2022 1:42 pm, Eryk Sun wrote: On 5/12/22, Mike Dewhirst wrote: access=wr.KEY_ALL_ACCESS + wr.KEY_WRITE, import winreg as wr class Registry: def __init__(self, computer=None,

Re: Windows registry PermissionError

2022-05-12 Thread Eryk Sun
On 5/12/22, Mike Dewhirst wrote: > > access=wr.KEY_ALL_ACCESS + wr.KEY_WRITE, The access parameter is a bit mask of access rights that combine via bitwise OR (|), not via arithmetic addition. KEY_ALL_ACCESS (0x000F_003F) is a superset of KEY_WRITE (0x0002_0006): KEY_WRITE = (

Windows registry PermissionError

2022-05-12 Thread Mike Dewhirst
I'm trying to copy a value from HKLM to HKCU for application rollout via bulk installation by an administrator but individual Windows user setup. Getting this ... Traceback (most recent call last):   File "D:\Users\mike\envs\chemdata\registry\wreg\wreg.py", line 84, in     curegistry.setvalu

Accuracy of multiprocessing.Queue.qsize before any Queue.get invocations?

2022-05-12 Thread Tim Chase
The documentation says[1] > Return the approximate size of the queue. Because of > multithreading/multiprocessing semantics, this number is not > reliable. Are there any circumstances under which it *is* reliable? Most germane, if I've added a bunch of items to the Queue, but not yet launched an

Re: tail

2022-05-12 Thread Cameron Simpson
On 12May2022 19:48, Marco Sulla wrote: >On Thu, 12 May 2022 at 00:50, Stefan Ram wrote: >> There's no spec/doc, so one can't even test it. > >Excuse me, you're very right. > >""" >A function that "tails" the file. If you don't know what that means, >google "man tail" > >filepath: the file path

Re: tail

2022-05-12 Thread Dennis Lee Bieber
On Thu, 12 May 2022 22:45:42 +0200, Marco Sulla declaimed the following: > >Maybe. Maybe not. What if the file ends with no newline? https://github.com/coreutils/coreutils/blob/master/src/tail.c Lines 567-569 (also lines 550-557 for "bytes_read" determination) -- Wulfraed

Re: tail

2022-05-12 Thread Marco Sulla
Thank you very much. This helped me to improve the function: import os _lf = b"\n" _err_n = "Parameter n must be a positive integer number" _err_chunk_size = "Parameter chunk_size must be a positive integer number" def tail(filepath, n=10, chunk_size=100): if (n <= 0): raise ValueErr

Re: Changing calling sequence

2022-05-12 Thread Michael F. Stemper
On 11/05/2022 14.58, anthony.flury wrote: Why not do :   def TempsOneDayDT(date:datetime.date): return TempsOneDay(date.year, date.month, date.day) No repeat of code - just a different interface to the same functionality. Yeah, a one-line wrapper around the original functi

Re: "py" command for Linux and Mac?

2022-05-12 Thread De ongekruisigde
On 2022-05-12, Mats Wichmann wrote: > On 5/12/22 10:25, Dan Stromberg wrote: >> Hi folks. >> >> I heard there's a Windows-like "py" command for Linux (and Mac?). >> >> I'm finally getting to porting a particular project's Python 2.7 code to >> 3.x, and one of the first steps will probably be cha

Re: "py" command for Linux and Mac?

2022-05-12 Thread Mats Wichmann
On 5/12/22 10:25, Dan Stromberg wrote: > Hi folks. > > I heard there's a Windows-like "py" command for Linux (and Mac?). > > I'm finally getting to porting a particular project's Python 2.7 code to > 3.x, and one of the first steps will probably be changing a lot of "python2 > script.py" to use #

Re: tail

2022-05-12 Thread Marco Sulla
On Thu, 12 May 2022 at 00:50, Stefan Ram wrote: > > Marco Sulla writes: > >def tail(filepath, n=10, chunk_size=100): > >if (n <= 0): > >raise ValueError(_err_n) > ... > > There's no spec/doc, so one can't even test it. Excuse me, you're very right. """ A function that "tails" the

Re: "py" command for Linux and Mac?

2022-05-12 Thread MRAB
On 2022-05-12 17:25, Dan Stromberg wrote: Hi folks. I heard there's a Windows-like "py" command for Linux (and Mac?). I'm finally getting to porting a particular project's Python 2.7 code to 3.x, and one of the first steps will probably be changing a lot of "python2 script.py" to use #!/usr/bin

"py" command for Linux and Mac?

2022-05-12 Thread Dan Stromberg
Hi folks. I heard there's a Windows-like "py" command for Linux (and Mac?). I'm finally getting to porting a particular project's Python 2.7 code to 3.x, and one of the first steps will probably be changing a lot of "python2 script.py" to use #!/usr/bin/env python2 and chmod +x. Then we can upda

RE: Changing calling sequence

2022-05-12 Thread David Raymond
>>def TempsOneDay(*dateComponents): >>if len(dateComponents) == 3: >>year, month, date = dateComponents >>elif len(dateComponents) == 1 and isinstance(dateComponents[0], >> datetime.date): >>year, month, date = (dateComponents[0].year, dateComponents[0].month, >> dateCompo

Re: [docs] Reporting a Bug

2022-05-12 Thread anthony.flury via Python-list
This is exactly as expected. Strip removes any of the characters in the passed string from both the front and the end of the string being stripped. The letter 'T' from the start of 'The meaning of life' does not appear in the word 'meaning' so nothing is removed from the start of the stri