Re: Simple question - end a raw string with a single backslash ?

2020-10-18 Thread Mladen Gogala via Python-list
On Sun, 18 Oct 2020 12:19:18 -0600, Michael Torrie wrote: > Python certainly is procedural. A script starts at the top and executes > through to the bottom and ends, barring any flow control in the middle. > Like Perl you can use it in many different ways and paradigms including &g

Re: Simple question - end a raw string with a single backslash ?

2020-10-18 Thread Mladen Gogala via Python-list
ules which are not compatible with Perl6 or "Roku" as it is known. -- Mladen Gogala Database Consultant http://mgogala.byethost5.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Debugging a memory leak

2020-10-22 Thread Karen Shaeffer via Python-list
> On Oct 22, 2020, at 5:51 PM, Pasha Stetsenko wrote: > > Dear Python gurus, > > I'm a maintainer of a python library "datatable" (can be installed from > PyPi), and i've been recently trying to debug a memory leak that occurs in > my library. >

Re: Is there a log file that tracks every statement that is being executed when a program is running?

2020-10-25 Thread Mladen Gogala via Python-list
but YMMV. > > Maxime Thank you. I am a YAPN (yet another Python newbie) and this helps me a lot. -- Mladen Gogala Database Consultant http://mgogala.byethost5.com -- https://mail.python.org/mailman/listinfo/python-list

Re: Live Write to File with Code That is Reading File and Writing to Serial Port

2020-10-28 Thread Karen Shaeffer via Python-list
if I need > to stop the code for any reason, I can't gather current data and the text > file is blank. I'm not as familiar with buffering and things like that and > tried "outputFile = open("./outputFile.txt", "a", 0)" but that gave me the > erro

Re: Why x+=1 doesn't return x value instead of an object

2020-10-30 Thread Jon Ribbens via Python-list
s, when they do. -- https://mail.python.org/mailman/listinfo/python-list

Re: Why x+=1 doesn't return x value instead of an object

2020-10-30 Thread Jon Ribbens via Python-list
On 2020-10-31, Chris Angelico wrote: > On Sat, Oct 31, 2020 at 1:51 PM Jon Ribbens via Python-list > wrote: >> >> On 2020-10-31, Stefan Ram wrote: >> > Siddhharth Choudhary writes: >> >>I want to know why x+=1 does not return the value of the variable.

RE: Find word by given characters

2020-11-03 Thread Avi Gross via Python-list
simple problem to solve unless I misunderstand it. Elegance aside, what would be wrong with this approach. - Read a word at a time in a loop from the file of dictionary words (non-Python meaning of dictionary.) For each one do the following, perhaps using a function: Break the current word into a

RE: Find word by given characters

2020-11-03 Thread Avi Gross via Python-list
loops within, albeit it may be implemented in a compiled language like C++. I did not write out my algorithm in Python but have done it for myself. It runs fast enough with most of the time spent in the slow I/O part. We can agree all algorithms have to read in all the words in a data file. There

RE: Find word by given characters

2020-11-04 Thread Avi Gross via Python-list
My comments at end: -Original Message- From: Python-list On Behalf Of duncan smith Sent: Wednesday, November 4, 2020 1:09 PM To: [email protected] Subject: Re: Find word by given characters On 04/11/2020 04:21, Avi Gross wrote: > Duncan, my comments below yours at

Re: Is there a conflict of libraries here?

2020-11-08 Thread SMOA BLX via Python-list
inter import ttk     ttk = sys.modules['tkinter'].ttk All of these 3 things set local variables/names in your script to some value. The "*" import sets a bunch of variables. Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

io.TextIOWrapper.readlines

2020-11-11 Thread Karen Shaeffer via Python-list
? The builtin ‘open’ function is defined in the io streams module. I presume the builtin open(‘file’, ‘r’) returns an io.TextIOWrapper object. And maybe the readlines method just isn’t documented? Just curious and lazy. thanks, Karen -- https://mail.python.org/mailman/listinfo/python-list

Cannot update parso

2020-11-21 Thread Cecil Westerhof via Python-list
ion is active. Why is jedi not updated. (I cannot uninstall jedi, because it is used by ipython.) -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Error issue - Kindly resolve

2020-11-22 Thread sheetal chavan via Python-list
Dear Sir/Madam,I am trying to install python on my laptop with windows 7, 32 bit operating system with service pac 1 installed. I have installed python 3.7.1 and some more versions but while opening the command prompt always it is showing the message as :The above program can’t start because

Python Error

2020-11-23 Thread Mayukh Chakraborty via Python-list
Hi, I had uninstalled and installed Python in Windows 10 but I am getting the error below. Can you please help ? C:\Users\mchak>pythonFatal Python error: init_sys_streams: can't initialize sys standard streamsPython runtime state: core initializedAttributeError: module 'io'

Re: Python Error

2020-11-23 Thread Mayukh Chakraborty via Python-list
1. The command 'py' doesn't work. It gives me the error below : C:\Users\mchak>pyFatal Python error: init_sys_streams: can't initialize sys standard streamsPython runtime state: core initializedAttributeError: module 'io' has no attribute 'open' Curren

Re: Python Error

2020-11-23 Thread Mayukh Chakraborty via Python-list
Hi Terry, 1. The command py doesn't work. It gives me the error below : C:\Users\mchak>pyFatal Python error: init_sys_streams: can't initialize sys standard streamsPython runtime state: core initializedAttributeError: module 'io' has no attribute 'open' Curre

Re: Python Error

2020-11-23 Thread Mayukh Chakraborty via Python-list
Hi, I have solved the issue by updating the Environment variables, now I am able to launch 'py' from the command prompt. However, I can't launch 'python' from command prompt. I am also encountering an issue when I try to execute the 'python' command from co

Re: Python Error

2020-11-24 Thread Mayukh Chakraborty via Python-list
Thanks - I am able to launch 'py' from the command prompt and it gives me the python versions installed in my machine from python.org website. However, when I am trying to execute a python program from command prompt, I am getting the error below. I had reinstalled python packa

Re: Python Error

2020-11-24 Thread Mayukh Chakraborty via Python-list
09:27:00 PM GMT, Barry wrote: Two observations. Python.exe is not on your PATH. But that does not matter as you can use the py command instead And nymph may not be available for python 3.9 yet. Check on pypi to see if there is a build for 3.9. Maybe use 3.8 for the time being. Barry &

Re: Fw: See example

2020-12-04 Thread DL Neil via Python-list
On 05/12/2020 09:17, Dan Stromberg wrote: On Fri, Dec 4, 2020 at 12:01 PM dn via Python-list mailto:[email protected]>> wrote: On 05/12/2020 07:57, Arthur R. Ott wrote: ... >     Microsoft Windows [Version 10.0.19042.630] >     (c) 2020 Microsoft Corp

Error

2020-12-06 Thread Barry Fitzgerald via Python-list
Good day," I purchased a book for my son and followed the directions to a T. (Coding Games in Python) Whenever I got to the point of of moving the "hello" file over to pgzrun is where my trouble began. Its not finding a path because I'm getting this "pgzrun is not reco

Re: Letter replacer - suggestions?

2020-12-07 Thread Jon Ribbens via Python-list
t;notes.err", "a") as err: > traceback.print_exc(file=err) > raise > > since print_exc() can go fetch the exception via sys.exc_info(). ... but even if you do think you want "except BaseException:" or "except:", you almost never actually do - you almost certainly want "except Exception:", because the former two will stop sys.exit() from working, or the user from pressing ctrl-C. -- https://mail.python.org/mailman/listinfo/python-list

RE: Returning from a multiple stacked call at once

2020-12-12 Thread Avi Gross via Python-list
s, it unwinds easily and only in low probability cases look for an abrupt exit. And for a really abrupt exit, there is a way to shut down the program very abruptly perhaps even too abruptly. -Original Message- From: Python-list On Behalf Of Dieter Maurer Sent: Saturday, December 12, 2020

dict.get(key, default) evaluates default even if key exists

2020-12-15 Thread Mark Polesky via Python-list
else default.  Nothing in that docstring suggests that the default value is evaluated even if the key exists, and I can't think of any good reason to do so. Am I missing something? Thanks, Mark -- https://mail.python.org/mailman/listinfo/python-list

Re: dict.get(key, default) evaluates default even if key exists

2020-12-15 Thread Mark Polesky via Python-list
Storchaka wrote: 15.12.20 19:07, Mark Polesky via Python-list пише: > # Running this script > > D = {'a':1} > def get_default(): >     print('Nobody expects this') >     return 0 > print(D.get('a', get_default())) > >

RE: How do you find what exceptions a class can throw?

2020-12-20 Thread Avi Gross via Python-list
environment and may use different functions/methods if on one kind of machine or OS or version of python than another. Ideally you would need to know the profile for the build you are on. And with interpreted languages, some are not so much built ahead of time as assembled as they go. Loading an alternate

RE: How do you find what exceptions a class can throw?

2020-12-21 Thread Avi Gross via Python-list
can change your code to specifically handle only those you have some idea what to do about. As mentioned, you have traceback info that may help you figure out where the exceptions come from or even why. Good luck. -Original Message- From: Python-list On Behalf Of Chris Green Sent

RE: Which method to check if string index is queal to character.

2020-12-28 Thread Avi Gross via Python-list
strings but, of course, as noted by Chris, to really validate that an address works might require sending something and validating a human replied and that can be quite task. -Original Message- From: Python-list On Behalf Of Chris Angelico Sent: Monday, December 28, 2020 2:24 PM To

RE: Which method to check if string index is queal to character.

2020-12-28 Thread Avi Gross via Python-list
. Dropping out, ... -Original Message- From: Python-list On Behalf Of Chris Angelico Sent: Monday, December 28, 2020 8:02 PM To: Python Subject: Re: Which method to check if string index is queal to character. On Tue, Dec 29, 2020 at 10:08 AM Avi Gross via Python-list wrote: > > This

Re: Funny error message

2020-12-31 Thread DL Neil via Python-list
On 1/1/21 11:46 AM, Bob van der Poel wrote: > When I run python from the command line and generate an error I get the > following: > > Python 3.8.5 (default, Jul 28 2020, 12:59:40) > [GCC 9.3.0] on linux > Type "help", "copyright", "credits" or &q

Re: Funny error message

2021-01-01 Thread DL Neil via Python-list
a guess as to why I had a .local tree (nope, I did >> not create >> it ... I don't think!). >> > > That is where "python3.8 -m pip install --user" puts the packages > you install. > > Barry > > > > Okay ... I'll

Re: Funny error message

2021-01-01 Thread DL Neil via Python-list
On 1/2/21 9:39 AM, Bob van der Poel wrote: > > > On Fri, Jan 1, 2021 at 12:17 PM DL Neil via Python-list > mailto:[email protected]>> wrote: > > On 1/2/21 6:35 AM, Bob van der Poel wrote: > > Found it! > > Well done! > > > &

learning python building 2nd app, need advices

2021-01-08 Thread pascal z via Python-list
Hi, This is a python app I was working on, can you help making it a beautiful looking app like bleachbit or ccleaner? The whole code below (what it does: it lists all folders and files from a specified path and tells some infos like size in mb or gb... and export it to a csv file for further

Re: learning python building 2nd app, need advices

2021-01-08 Thread pascal z via Python-list
any way to attach a file because I loose indentation? -- https://mail.python.org/mailman/listinfo/python-list

Re: learning python building 2nd app, need advices

2021-01-08 Thread pascal z via Python-list
n.org/mailman/listinfo/python-list

Re: learning python building 2nd app, need advices

2021-01-11 Thread pascal z via Python-list
ray5",highlightbackground="HoneyDew3", highlightcolor="HoneyDew3", highlightthickness=1) frm22.place(width=150, height=40, x=820, y=220) ### button btn_FileRen = tk.Button(frm22, text="Files rename", bg='lightblue4', font=("Verdana", 10,"normal")) btn_FileRen.pack(expand = 1, fill ="both",padx=0, pady=0) ### BUTTON BROWSE entry fx BASIC LISTING btn_FileRen['command'] = fx_FileRen ### ### FRAME 23 LABEL FOLDERS RENAME frm23 = tk.Frame(frm20, bg="gray5",highlightbackground="HoneyDew3", highlightcolor="HoneyDew3", highlightthickness=1) frm23.place(width=775, height=100, x=20, y=320) # Top label title tk.Label(frm23,text ="Rename folders only from csv file below", font=("Tahoma", 14, "normal"), fg='gray80', bg='gray5').place(x=20, y=10) ### LABEL PATH entry box tk.Label(frm23, text="CSV file path", fg='gray80', bg='gray5').place(x=20, y=55) # TEST FOLDER full_path = os.path.realpath(__file__) new_text = os.path.dirname(full_path) + os.sep + 'csv_folder' + os.sep + "csvtxt_1_foldernamelisting.csv" # vtxt_path2.set(new_text) ### PATH ENTRY BOX vtxt_path3=tk.StringVar(root, value=new_text) # Value saved here txt_path3 = tk.Entry(frm23,width=43, textvariable=vtxt_path3, fg='brown').place(width=620, height=30, x=140, y=50) # TEST FOLDER zzz ### ### FRAME 24 BUTTON FOLDERS RENAME frm24 = tk.Frame(frm20, bg="gray5",highlightbackground="HoneyDew3", highlightcolor="HoneyDew3", highlightthickness=1) frm24.place(width=150, height=40, x=820, y=345) ### button btn_FoldRen = tk.Button(frm24, text="Folders rename", bg='brown', font=("Verdana", 10,"normal")) btn_FoldRen.pack(expand = 1, fill ="both",padx=0, pady=0) ### BUTTON BROWSE entry fx BASIC LISTING btn_FoldRen['command'] = fx_FoldRen ###///...///...///...///...///### # TAB 3 # ###///...///...///...///...///### ###///...///...///...///...///### # zZZZz # ###///...///...///...///...///### if __name__ == '__main__': root.mainloop() -- https://mail.python.org/mailman/listinfo/python-list

Re: learning python building 2nd app, need advices

2021-01-11 Thread pascal z via Python-list
ray5",highlightbackground="HoneyDew3", highlightcolor="HoneyDew3", highlightthickness=1) frm22.place(width=150, height=40, x=820, y=220) ### button btn_FileRen = tk.Button(frm22, text="Files rename", bg='lightblue4', font=("Verdana", 10,"normal")) btn_FileRen.pack(expand = 1, fill ="both",padx=0, pady=0) ### BUTTON BROWSE entry fx BASIC LISTING btn_FileRen['command'] = fx_FileRen ### ### FRAME 23 LABEL FOLDERS RENAME frm23 = tk.Frame(frm20, bg="gray5",highlightbackground="HoneyDew3", highlightcolor="HoneyDew3", highlightthickness=1) frm23.place(width=775, height=100, x=20, y=320) # Top label title tk.Label(frm23,text ="Rename folders only from csv file below", font=("Tahoma", 14, "normal"), fg='gray80', bg='gray5').place(x=20, y=10) ### LABEL PATH entry box tk.Label(frm23, text="CSV file path", fg='gray80', bg='gray5').place(x=20, y=55) # TEST FOLDER full_path = os.path.realpath(__file__) new_text = os.path.dirname(full_path) + os.sep + 'csv_folder' + os.sep + "csvtxt_1_foldernamelisting.csv" # vtxt_path2.set(new_text) ### PATH ENTRY BOX vtxt_path3=tk.StringVar(root, value=new_text) # Value saved here txt_path3 = tk.Entry(frm23,width=43, textvariable=vtxt_path3, fg='brown').place(width=620, height=30, x=140, y=50) # TEST FOLDER zzz ### ### FRAME 24 BUTTON FOLDERS RENAME frm24 = tk.Frame(frm20, bg="gray5",highlightbackground="HoneyDew3", highlightcolor="HoneyDew3", highlightthickness=1) frm24.place(width=150, height=40, x=820, y=345) ### button btn_FoldRen = tk.Button(frm24, text="Folders rename", bg='brown', font=("Verdana", 10,"normal")) btn_FoldRen.pack(expand = 1, fill ="both",padx=0, pady=0) ### BUTTON BROWSE entry fx BASIC LISTING btn_FoldRen['command'] = fx_FoldRen ###///...///...///...///...///### # TAB 3 # ###///...///...///...///...///### ###///...///...///...///...///### # zZZZz # ###///...///...///...///...///### if __name__ == '__main__': root.mainloop() -- https://mail.python.org/mailman/listinfo/python-list

Re: learning python building 2nd app, need advices

2021-01-11 Thread pascal z via Python-list
e').place(width=620, height=30, x=140, y=50) # TEST FOLDER zzz ### ### FRAME 22 TOP BUTTON FILE RENAME frm22 = tk.Frame(frm20, bg="gray5",highlightbackground="HoneyDew3", highlightcolor="HoneyDew3", highlightthickness=1) frm22.place(width=150, height=40, x=820, y=220) ### button btn_FileRen = tk.Button(frm22, text="Files rename", bg='lightblue4', font=("Verdana", 10,"normal")) btn_FileRen.pack(expand = 1, fill ="both",padx=0, pady=0) ### BUTTON BROWSE entry fx BASIC LISTING btn_FileRen['command'] = fx_FileRen ### ### FRAME 23 LABEL FOLDERS RENAME frm23 = tk.Frame(frm20, bg="gray5",highlightbackground="HoneyDew3", highlightcolor="HoneyDew3", highlightthickness=1) frm23.place(width=775, height=100, x=20, y=320) # Top label title tk.Label(frm23,text ="Rename folders only from csv file below", font=("Tahoma", 14, "normal"), fg='gray80', bg='gray5').place(x=20, y=10) ### LABEL PATH entry box tk.Label(frm23, text="CSV file path", fg='gray80', bg='gray5').place(x=20, y=55) # TEST FOLDER full_path = os.path.realpath(__file__) new_text = os.path.dirname(full_path) + os.sep + 'csv_folder' + os.sep + "csvtxt_1_foldernamelisting.csv" # vtxt_path2.set(new_text) ### PATH ENTRY BOX vtxt_path3=tk.StringVar(root, value=new_text) # Value saved here txt_path3 = tk.Entry(frm23,width=43, textvariable=vtxt_path3, fg='brown').place(width=620, height=30, x=140, y=50) # TEST FOLDER zzz ### ### FRAME 24 BUTTON FOLDERS RENAME frm24 = tk.Frame(frm20, bg="gray5",highlightbackground="HoneyDew3", highlightcolor="HoneyDew3", highlightthickness=1) frm24.place(width=150, height=40, x=820, y=345) ### button btn_FoldRen = tk.Button(frm24, text="Folders rename", bg='brown', font=("Verdana", 10,"normal")) btn_FoldRen.pack(expand = 1, fill ="both",padx=0, pady=0) ### BUTTON BROWSE entry fx BASIC LISTING btn_FoldRen['command'] = fx_FoldRen ###///...///...///...///...///### # TAB 3 # ###///...///...///...///...///### ###///...///...///...///...///### # zZZZz # ###///...///...///...///...///### if __name__ == '__main__': root.mainloop() -- https://mail.python.org/mailman/listinfo/python-list

Re: learning python building 2nd app, need advices

2021-01-11 Thread pascal z via Python-list
ks, I'm going to try As alternative, I pasted it into github and pasted it back into this page, it's ok when pasting but when posting it fails keeping spaces... Until I can find a way to do it, this is the github link https://github.com/barpasc/listfiles/blob/main/pyFilesGest_6B18.py -- https://mail.python.org/mailman/listinfo/python-list

Re: learning python building 2nd app, need advices

2021-01-11 Thread pascal z via Python-list
tried sending a few times and it seemed it didn't work when refreshing the google group discussion page. However, just looking now at the discussion through emails, shows indentation right. I'm using firefox. I'll try using chromium for later posts if that makes things easier. -- https://mail.python.org/mailman/listinfo/python-list

Re: learning python building 2nd app, need advices

2021-01-11 Thread pascal z via Python-list
On Monday, January 11, 2021 at 2:07:03 PM UTC, Chris Angelico wrote: > On Tue, Jan 12, 2021 at 1:01 AM pascal z via Python-list > wrote: > > > > On Monday, January 11, 2021 at 1:45:31 PM UTC, Greg Ewing wrote: > > > On 12/01/21 1:12 am, pascal z wrote: > >

Re: on writing a number as 2^s * q, where q is odd

2023-11-29 Thread Alan Bawden via Python-list
c = (n ^ (n - 1)).bit_count() - 1 return bc, n >> bc -- https://mail.python.org/mailman/listinfo/python-list

Re: on writing a number as 2^s * q, where q is odd

2023-12-03 Thread Julieta Shem via Python-list
owers_of_2_in(n // 2) return 1 + s, r --8<---cut here---end--->8--- -- https://mail.python.org/mailman/listinfo/python-list

Re: on writing a number as 2^s * q, where q is odd

2023-12-03 Thread Julieta Shem via Python-list
>> --8<---cut here---end--->8--- > > for n = 0 your function get stack overflow That's right. Let's say ``assert n > 0'' before we say ``if''. -- https://mail.python.org/mailman/listinfo/python-list

Re: on writing a number as 2^s * q, where q is odd

2023-12-03 Thread Oscar Benjamin via Python-list
On Sun, 3 Dec 2023 at 10:25, Julieta Shem via Python-list wrote: > > Alan Bawden writes: > > > > def powers_of_2_in(n): > > bc = (n ^ (n - 1)).bit_count() - 1 > > return bc, n >> bc > > That's pretty fancy and likely the fastest. It might b

Request: inspect: signature & getfullargspec & getcallargs

2023-12-03 Thread Dom Grigonis via Python-list
without `bound_arg` * `getfullargspec` to `follow_wrapper_chains` * `signature` to include `bound_arg`. Regards, DG -- https://mail.python.org/mailman/listinfo/python-list

Re: Request: inspect: signature & getfullargspec & getcallargs

2023-12-04 Thread Barry Scott via Python-list
> On 4 Dec 2023, at 02:29, Dom Grigonis via Python-list > wrote: > > Hello, > > I have a request. > > Would it be possible to include `follow_wrapper_chains` and `skip_bound_arg` > arguments to higher level functions of `inspect` module? > > Would expos

Re: on writing a number as 2^s * q, where q is odd

2023-12-05 Thread Alan Bawden via Python-list
en.wikipedia.org/wiki/Hacker%27s_Delight>. - Alan -- https://mail.python.org/mailman/listinfo/python-list

How/where to store calibration values - written by program A, read by program B

2023-12-05 Thread Chris Green via Python-list
he program readability point of view it would be good to have a Python module with the values in it but using a Python program to write/update a Python module sounds a bit odd somehow. I could simply write the values to a file (or a database) and I suspect that this may be the best answer but it

Re: How/where to store calibration values - written by program A, read by program B

2023-12-05 Thread Mats Wichmann via Python-list
On 12/5/23 07:37, Chris Green via Python-list wrote: Is there a neat, pythonic way to store values which are 'sometimes' changed? My particular case at the moment is calibration values for ADC inputs which are set by running a calibration program and used by lots of programs which d

Re: How/where to store calibration values - written by program A, read by program B

2023-12-05 Thread Barry Scott via Python-list
> On 5 Dec 2023, at 14:37, Chris Green via Python-list > wrote: > > Are there any Python modules aimed specifically at this sort of > requirement? I tend to use JSON for this type of thing. Suggest that you use the options to pretty print the json that is saved so that a hu

Re: How/where to store calibration values - written by program A, read by program B

2023-12-05 Thread DL Neil via Python-list
On 12/6/23 03:37, Chris Green via Python-list wrote: Is there a neat, pythonic way to store values which are 'sometimes' changed? My particular case at the moment is calibration values for ADC inputs which are set by running a calibration program and used by lots of programs which d

Re: How/where to store calibration values - written by program A, read by program B

2023-12-05 Thread DL Neil via Python-list
Apologies: neglected suggested web.refs: https://datagy.io/python-environment-variables/ https://pypi.org/project/json_environ/ -- Regards =dn -- https://mail.python.org/mailman/listinfo/python-list

Re: How/where to store calibration values - written by program A, read by program B

2023-12-05 Thread Thomas Passin via Python-list
On 12/5/2023 11:50 AM, MRAB via Python-list wrote: On 2023-12-05 14:37, Chris Green via Python-list wrote: Is there a neat, pythonic way to store values which are 'sometimes' changed? My particular case at the moment is calibration values for ADC inputs which are set by running a c

Re: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread Chris Green via Python-list
Thomas Passin wrote: > On 12/5/2023 11:50 AM, MRAB via Python-list wrote: > > On 2023-12-05 14:37, Chris Green via Python-list wrote: > >> Is there a neat, pythonic way to store values which are 'sometimes' > >> changed? > >> > >> My part

Re: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread Chris Green via Python-list
27;t like the proliferation of markup formats > of this type. So while I don't know exactly what TOML is, I figure it > must be bad. > > I sometimes use ast.literal_eval though it is Python specific. > That's interesting, I'll add it to my armoury anyway. :-) > Of c

Re: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread Chris Green via Python-list
Thank you everyone for all the suggestions, I now have several possibilities to follow up. :-) -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread Dan Sommers via Python-list
On 2023-12-06 at 09:32:02 +, Chris Green via Python-list wrote: > Thomas Passin wrote: [...] > > Just go with an .ini file. Simple, well-supported by the standard > > library. And it gives you key/value pairs. > > > My requirement is *slightly* more complex t

Re: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread Barry Scott via Python-list
> On 6 Dec 2023, at 09:32, Chris Green via Python-list > wrote: > > My requirement is *slightly* more complex than just key value pairs, > it has one level of hierarchy, e.g.:- > >KEY1: > a: v1 > c: v3 > d: v4 >KEY2: >

Re: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread Dan Purgert via Python-list
n application-specific configuration directory). Or an .ini file with two sections (although I don't think you can re-use key-names in a single ini file) -- |_|O|_| |_|_|O| Github: https://github.com/dpurgert |O|O|O| PGP: DDAB 23FB 19FA 7D85 1CC1 E067 6D65 70E5 4CE7 2860 -- https://mail.python.org/mailman/listinfo/python-list

Re: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread Thomas Passin via Python-list
On 12/6/2023 6:35 AM, Barry Scott via Python-list wrote: On 6 Dec 2023, at 09:32, Chris Green via Python-list wrote: My requirement is *slightly* more complex than just key value pairs, it has one level of hierarchy, e.g.:- KEY1: a: v1 c: v3 d: v4 KEY2: a

Re: How/where to store calibration values - written by program A, read by program B

2023-12-06 Thread Thomas Passin via Python-list
On 12/6/2023 1:12 PM, MRAB via Python-list wrote: On 2023-12-06 12:23, Thomas Passin via Python-list wrote: On 12/6/2023 6:35 AM, Barry Scott via Python-list wrote: On 6 Dec 2023, at 09:32, Chris Green via Python-list wrote: My requirement is *slightly* more complex than just key value

Python 3.12.1 is now available

2023-12-07 Thread Thomas Wouters via Python-list
Python 3.12.1 is now available. https://www.python.org/downloads/release/python-3121/ This is the first maintenance release of Python 3.12 Python 3.12 is the newest major release of the Python programming language, and it contains many new features and optimizations. 3.12.1 is the latest

A problem with str VS int.

2023-12-09 Thread Steve GS via Python-list
er valid sensor test strip Reading.") I converted the variable to int along with the if statement comparison and it works as expected. See if it fails for you... Steve -- https://mail.python.org/mailman/listinfo/python-list

RE: A problem with str VS int.

2023-12-09 Thread AVI GROSS via Python-list
user can enter any text, they might enter ".01" or "hello" or al kinds of nonsense. If you converted to numbers and tested whether it failed, ... -Original Message- From: Python-list On Behalf Of Steve GS via Python-list Sent: Saturday, December 9, 2023 9:42 PM To: pyth

Re: A problem with str VS int.

2023-12-09 Thread Thomas Passin via Python-list
On 12/9/2023 9:42 PM, Steve GS via Python-list wrote: If I enter a one-digit input or a three-digit number, the code works but if I enter a two digit number, the if statement fails and the else condition prevails. tsReading = input(" Enter the " + Brand + " tes

How to enter multiple, similar, dictionaries?

2023-12-11 Thread Chris Green via Python-list
;:0, 'name':'BowProp Volts'} It's effectively a 'table' with columns named 'dev', 'input' and 'name' and I want to access the values of the table using the variable name. I could, obviously, store the data in a database (sqlite), I have some similar data in a database already but the above sort of format in Python source is more human readable and accessible. I'm just looking for a less laborious way of entering it really. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread Chris Green via Python-list
', 'dev':'bbb', 'input':'0', 'name':'Starter volts'}, {'abbr':'la', 'dev':'bbb', 'input':'2', 'name':'Leisure Amps'}, {'abbr':'sa', 'dev':'bbb', 'input':'3', 'name':'Starter Amps'}, {'abbr':'bv', 'dev':'adc2', 'input':0, 'name':'BowProp Volts'} ] This pickles nicely, I just want an easy way to enter the data! > I could, obviously, store the data in a database (sqlite), I have some > similar data in a database already but the above sort of format in > Python source is more human readable and accessible. I'm just looking > for a less laborious way of entering it really. > -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread Grant Edwards via Python-list
On 2023-12-11, Chris Green via Python-list wrote: > Is there a way to abbreviate the following code somehow? > > lv = {'dev':'bbb', 'input':'1', 'name':'Leisure volts'} > sv = {'dev':'bbb', &#x

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread Jon Ribbens via Python-list
#x27;input':'1', 'name':'Leisure volts'}, > {'abbr':'sv', 'dev':'bbb', 'input':'0', 'name':'Starter volts'}, > {'abbr':'la', 'dev':'bbb', 'input':'2', 'name':'Leisure Amps'}, > {'abbr':'sa', 'dev':'bbb', 'input':'3', 'name':'Starter Amps'}, > {'abbr':'bv', 'dev':'adc2', 'input':0, 'name':'BowProp Volts'} > ] > > This pickles nicely, I just want an easy way to enter the data! adccfg = [ dict(zip(('abbr', 'dev', 'input', 'name'), row)) for row in ( ('lv', 'bbb', '1', 'Leisure volts'), ('sv', 'bbb', '0', 'Starter volts'), ('la', 'bbb', '2', 'Leisure Amps'), ('sa', 'bbb', '3', 'Starter Amps'), ('bv', 'adc2', 0, 'BowProp Volts'), ) ] -- https://mail.python.org/mailman/listinfo/python-list

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread Chris Green via Python-list
', 'name':'Starter volts'}, > > {'abbr':'la', 'dev':'bbb', 'input':'2', 'name':'Leisure Amps'}, > > {'abbr':'sa', 'dev':'bbb', 'input':'3', 'name':'Starter Amps'}, > > {'abbr':'bv', 'dev':'adc2', 'input':0, 'name':'BowProp Volts'} > > ] > > > > This pickles nicely, I just want an easy way to enter the data! > > adccfg = [ > dict(zip(('abbr', 'dev', 'input', 'name'), row)) > for row in ( > ('lv', 'bbb', '1', 'Leisure volts'), > ('sv', 'bbb', '0', 'Starter volts'), > ('la', 'bbb', '2', 'Leisure Amps'), > ('sa', 'bbb', '3', 'Starter Amps'), > ('bv', 'adc2', 0, 'BowProp Volts'), > ) > ] Neat, I like that, thank you. -- Chris Green · -- https://mail.python.org/mailman/listinfo/python-list

Re: How to enter multiple, similar, dictionaries?

2023-12-11 Thread Piergiorgio Sartor via Python-list
#x27;dev':'adc2', 'input':0, 'name':'BowProp Volts'} It's effectively a 'table' with columns named 'dev', 'input' and 'name' and I want to access the values of the table using the variable name. I could

RE: A problem with str VS int.

2023-12-12 Thread Steve GS via Python-list
now more of a curiosity as I did use the integer comparisons. SGA -Original Message- From: Python-list On Behalf Of dn via Python-list Sent: Sunday, December 10, 2023 12:53 AM To: [email protected] Subject: Re: A problem with str VS int. On 10/12/23 15:42, Steve GS via Python-list

IDLE editor suggestion.

2023-12-12 Thread Steve GS via Python-list
it every time. If this is inappropriate to post this here, please tell me where to go. Life should be so complicated. -- https://mail.python.org/mailman/listinfo/python-list

Re: A problem with str VS int.

2023-12-12 Thread Roel Schroeven via Python-list
Op 12/12/2023 om 9:22 schreef Steve GS via Python-list: With all these suggestions on how to fix it, no one seems to answer why it fails only when entering a two-digit number. One and three work fine when comparing with str values. It is interesting that the leading 0 on a two digit worked

RE: A problem with str VS int.

2023-12-12 Thread AVI GROSS via Python-list
Roel, I sent a similar reply in private to someone who may not be listening as their mind is made up. This points to a serious problem with people not testing hypotheses adequately. Perhaps for homework, we can assign a request for a Python program that creates a random sample of quite a few

Re: IDLE editor suggestion.

2023-12-12 Thread Friedrich Romstedt via Python-list
Hi! Am Di., 12. Dez. 2023 um 09:28 Uhr schrieb Steve GS via Python-list : > > Maybe this already exists but > I have never seen it in any > editor that I have used. You might want to choose Microsoft Code from its Visual Studio family of software, or, if you're ready for a dee

Re: IDLE editor suggestion.

2023-12-12 Thread Thomas Passin via Python-list
On 2023-12-12 08:22, Steve GS via Python-list wrote: > Maybe this already exists but > I have never seen it in any > editor that I have used. > > It would be nice to have a > pull-down text box that lists > all of the searches I have > used during this session. It &g

Re: IDLE editor suggestion.

2023-12-12 Thread Mats Wichmann via Python-list
On 12/12/23 13:50, Thomas Passin via Python-list wrote: On 2023-12-12 08:22, Steve GS via Python-list wrote: > Maybe this already exists but > I have never seen it in any > editor that I have used. > > It would be nice to have a > pull-down text box that lists > all o

RE: IDLE editor suggestion.

2023-12-12 Thread Steve GS via Python-list
Does anything from the Visual Studio family of software have a pull down menu that lists previous searches so that I don’t have to enter them every time? SGA -Original Message- From: Friedrich Romstedt Sent: Tuesday, December 12, 2023 12:52 PM To: Steve GS Cc: [email protected]

Type hints - am I doing it right?

2023-12-12 Thread Frank Millman via Python-list
'DbParams']). But I would still like an answer to the original question, as I am sure similar situations will occur without such a simple solution. Thanks Frank Millman -- https://mail.python.org/mailman/listinfo/python-list

Re: Type hints - am I doing it right?

2023-12-13 Thread Cameron Simpson via Python-list
ince I imagine config_database() would accept any kind of mapping (dicts, etc etc). Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Announcement: distlib 0.3.8 released on PyPI

2023-12-13 Thread Vinay Sajip via Python-list
during test. * Fix #208: handle deprecation removals in Python 3.13. * Fix #209: use legacy version implementation for Python versions. A more detailed change log is available at [2]. Please try it out, and if you find any problems or have any suggestions for improvements, please give some

ANN: A new version (0.5.2) of python-gnupg has been released.

2023-12-13 Thread Vinay Sajip via Python-list
ource code repository is at [1]. Documentation is available at [5]. As always, your feedback is most welcome (especially bug reports [3], patches and suggestions for improvement, or any other points via this group). Enjoy! Cheers Vinay Sajip [1] https://github.com/vsajip/python-gnupg [2]

Re: Type hints - am I doing it right?

2023-12-13 Thread Mats Wichmann via Python-list
On 12/13/23 00:19, Frank Millman via Python-list wrote: I have to add 'import configparser' at the top of each of these modules in order to type hint the method. This seems verbose. If it is the correct way of doing it I can live with it, but I wondered if there was an easier way.

TLS support for SysLogHandler (currently in pypi)

2023-12-13 Thread A Tammy via Python-list
ke a TLS > syslog handler but don’t seem to have been maintained for a long time. For a > feature like this, it makes sense to have it in core python rather than an > unmaintained package. Feedback and bug reports are very welcome. Thanks, Tammy -- https://mail.python.org/mailman/listinfo/python-list

Request to Review: Tutorial about Python Packaging offering different use case

2023-12-13 Thread Christian Buhtz via Python-list
Hello, I would like to point to my Python Packaging Tutorial explaining several common use cases using minimal demo projects. <https://codeberg.org/buhtz/tech-demo-python-packaging> I am not an expert and assume that some of my solutions might not be the best. So I would appreciate

Re: Type hints - am I doing it right?

2023-12-13 Thread Thomas Passin via Python-list
On 12/13/2023 11:17 AM, Mats Wichmann via Python-list wrote: On 12/13/23 00:19, Frank Millman via Python-list wrote: I have to add 'import configparser' at the top of each of these modules in order to type hint the method. This seems verbose. If it is the correct way of doing it

Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread Sibylle Koczian via Python-list
Hello, I always install Python on Windows in the same manner: - Python is not on the path, - it is installed for all users, - the Python Launcher is installed for all users, - the file types .py, .pyw etc. are associated with Python. My shebang line is usually "#!/usr/bin/env python3&qu

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread Sibylle Koczian via Python-list
Am 22.12.2023 um 14:13 schrieb Barry: On 22 Dec 2023, at 12:39, Sibylle Koczian via Python-list wrote: Hello, I always install Python on Windows in the same manner: - Python is not on the path, - it is installed for all users, - the Python Launcher is installed for all users, - the file

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread J.O. Aho via Python-list
On 22/12/2023 13.36, Sibylle Koczian wrote: Hello, I always install Python on Windows in the same manner: - Python is not on the path, - it is installed for all users, - the Python Launcher is installed for all users, - the file types .py, .pyw etc. are associated with Python. My shebang line

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread Christian Buhtz via Python-list
What is the "command line" on your Windows 11? On Windows 10 it usually is "cmd.exe" (Windows Command Prompt). On Windows 11 it usually is the "Terminal" which is different from cmd.exe. -- https://mail.python.org/mailman/listinfo/python-list

making your own DirEntry.

2023-12-22 Thread Antoon Pardon via Python-list
ks parameter in the is_dir, is_file, ... methods. -- Antoon Pardon. -- https://mail.python.org/mailman/listinfo/python-list

Re: making your own DirEntry.

2023-12-22 Thread DL Neil via Python-list
Antoon, On 12/23/23 01:00, Antoon Pardon via Python-list wrote: I am writing a program that goes through file hierarchies and I am mostly using scandir for that which produces DirEntry instances. At times it would be usefull if I could make my own DirEntry for a specific path, however when I

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread Thomas Passin via Python-list
On 12/22/2023 7:36 AM, Sibylle Koczian via Python-list wrote: Hello, I always install Python on Windows in the same manner: - Python is not on the path, - it is installed for all users, - the Python Launcher is installed for all users, - the file types .py, .pyw etc. are associated with Python

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread Thomas Passin via Python-list
On 12/22/2023 9:29 AM, Sibylle Koczian via Python-list wrote: Am 22.12.2023 um 14:13 schrieb Barry: On 22 Dec 2023, at 12:39, Sibylle Koczian via Python-list wrote: Hello, I always install Python on Windows in the same manner: - Python is not on the path, - it is installed for all

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread Michael Torrie via Python-list
On 12/22/23 11:42, Thomas Passin via Python-list wrote: > There is some important context that is missing here. Python on Windows > does not normally install to that location. That is not even a Windows > path, neither by directory name nor by path separators. No, that's just

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread Michael Torrie via Python-list
On 12/22/23 07:02, Thomas Passin via Python-list wrote: > On my Windows 10 machine, Python scripts run without a shebang line. > Perhaps Windows 11 has added the ability to use one, but then you would > need to use the actual location of your Python executable. Yes if you associate .p

Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread Thomas Passin via Python-list
On 12/22/2023 7:19 PM, Barry wrote: On 23 Dec 2023, at 00:15, Thomas Passin via Python-list wrote: In neither case is the shebang line used. As i understand it, not in front of my windows box to check. The handler for .py file extension is set to be the py.exe It is py.exe that

<    44   45   46   47   48   49   50   51   52   53   >