Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-11 Thread Dennis Lee Bieber via Python-list
On Sat, 10 Jun 2023 11:32:53 -0500, Eryk Sun  declaimed
the following:

>On 6/10/23, Thomas Passin via Python-list  wrote:
>>
>> We can find pip.exe using good old-fashioned dir (we don't need any
>> new-fangled Powershell):
>>
>> C:\Users\tom>dir AppData\Local\Programs\Python /Aa /S /W /B |find
>> "pip"|find "Scripts"
>
>CMD's `dir` and `for` commands support simple wildcard matching. For
>example, the following recursively searches for a file named
>"pip*.exe" under "%ProgramFiles%\Python311":
>

So far we've had examples of Python installed for current user, and
Python installed for all users /in Program Files/.

My install is for all users, but is in a top-level directory of its own
(Program Files causes problems when using pip and not remembering to open
an Admin shell).

>C:\>dir /b /s "%ProgramFiles%\Python311\pip*.exe"

So... Here are the results on my machine searching ALL of C:\

C:\Users\Owner>dir /b /s c:\pip*.exe
c:\Apps\ADW Software Modula-2\ASCII\pipedexec.exe
c:\Apps\ADW Software Modula-2\Unicode\pipedexec.exe
c:\GNAT\2019\share\gdb-8.3\python-2.7.16\Scripts\pip.exe
c:\GNAT\2019\share\gdb-8.3\python-2.7.16\Scripts\pip2.7.exe
c:\GNAT\2019\share\gdb-8.3\python-2.7.16\Scripts\pip2.exe
c:\Program Files (x86)\Common Files\Microsoft Shared\ink\pipanel.exe
c:\ProgramData\{F87E77CE-BAA2-49E1-AAE3-1F6B2704ABAA}\OFFLINE\8AFA5EE\A9DCCED0\Pipe.exe
c:\Users\All
Users\{F87E77CE-BAA2-49E1-AAE3-1F6B2704ABAA}\OFFLINE\8AFA5EE\A9DCCED0\Pipe.exe
c:\Users\Owner\AppData\Local\python\mu\mu_venv-38-20230331-155858\Scripts\pip-3.8.exe
c:\Users\Owner\AppData\Local\python\mu\mu_venv-38-20230331-155858\Scripts\pip.exe
c:\Users\Owner\AppData\Local\python\mu\mu_venv-38-20230331-155858\Scripts\pip3.8.exe
c:\Users\Owner\AppData\Local\python\mu\mu_venv-38-20230331-155858\Scripts\pip3.exe
c:\Users\Public\Programs\mblock\resources\app\mlink-v2\exec\python-env\win\Scripts\pip.exe
c:\Users\Public\Programs\mblock\resources\app\mlink-v2\exec\python-env\win\Scripts\pip3.6.exe
c:\Users\Public\Programs\mblock\resources\app\mlink-v2\exec\python-env\win\Scripts\pip3.exe
c:\Windows\WinSxS\wow64_microsoft-windows-t..acyinkingcomponents_31bf3856ad364e35_10.0.19041.1_none_023783a15d5391a7\pipanel.exe

C:\Users\Owner>

GNAT was the last AdaCore/Libre build that included the GPS IDE (I
believe AdaCore still does periodic source code releases of GPS to Linux,
putting the effort to get it working on the Linux distributions -- but that
doesn't help for Windows). Mu is an overly simplistic Python editor pushed
by AdaFruit as it is CircuitPython board-aware. MBlock is a graphical
(drag code templates, fill in any parameters) which I have for an
Arduino-powered robot vehicle.

NO pip*.exe anywhere for Python 3.10 -- and as I stated earlier in the
thread, I even ran the Python Org installer python-3.10.11-amd64.exe in
/repair/ mode; though if that just spawns off ensurepip the result does not
repair anything, as ensurepip finds the library module valid. (Maybe I
should rename the module to junk, and try again? *)

C:\Users\Owner>dir c:\p*
 Volume in drive C is Sys_OS
 Volume Serial Number is B650-6F92

 Directory of c:\

12/07/2019  05:14 AM  PerfLogs
05/16/2023  04:37 PM  Program Files
05/16/2023  04:37 PM  Program Files (x86)
04/26/2023  03:16 PM  ProgramData
01/01/2017  04:28 PM  PSFONTS
02/11/2020  02:50 PM  PSFONTS_Converted
06/08/2023  03:01 PM  Python310
   0 File(s)  0 bytes
   7 Dir(s)  1,881,417,326,592 bytes free



*
*   What a pain... Just renaming Lib\site-packages\pip =>
Lib\site-packages\pip-junk (and similar for the dist-info file) still had
ensurepip locating it. I had to /delete/ those files completely before
ensurepip would do any processing.

C:\Users\Owner>python -m ensurepip
Looking in links: c:\Users\Owner\AppData\Local\Temp\tmpfof5ikfr
Requirement already satisfied: setuptools in c:\python310\lib\site-packages
(67.6.1)
Requirement already satisfied: pip in c:\python310\lib\site-packages (junk)

C:\Users\Owner>python -m ensurepip
Looking in links: c:\Users\Owner\AppData\Local\Temp\tmpwtielpq_
Requirement already satisfied: setuptools in c:\python310\lib\site-packages
(67.6.1)
Processing
c:\users\owner\appdata\local\temp\tmpwtielpq_\pip-23.0.1-py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-23.0.1

That finally installed 

C:\Users\Owner>where pip*
C:\Python310\Scripts\pip3.10.exe
C:\Python310\Scripts\pip3.exe

(NO pip.exe, however).
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-09 Thread Dennis Lee Bieber via Python-list
On Thu, 8 Jun 2023 17:22:22 -0400, Thomas Passin 
declaimed the following:

>On 6/8/2023 3:14 PM, Dennis Lee Bieber via Python-list wrote:
> C:\Users\Owner>
>> -=-=-
>> Windows PowerShell
>> Copyright (C) Microsoft Corporation. All rights reserved.
>> 
>> Try the new cross-platform PowerShell https://aka.ms/pscore6
>> 
>> PS C:\Users\Owner> Get-ChildItem -Path C:\Python310\ -Recurse -Name -Filter
>> "pip.*"
>> Lib\site-packages\pip
>> Lib\site-packages\pipenv\patched\pip
>> Lib\site-packages\pipenv\utils\pip.py
>> Lib\site-packages\pipenv\utils\__pycache__\pip.cpython-310.pyc
>> PS C:\Users\Owner>
>> -=-=-
>> 
>>  I've just run the installer -- python-3.10.11-amd64.exe -- as admin, in
>> "repair" mode! There is NO pip.exe under the Python install directory.
>
>It's in the Scripts directory:
>
>C:\Users\tom\AppData\Local\Programs\Python\Python311\Scripts\pip3.exe
>
>Note that this installation was made for a single user, not "All Users" 
>- this is an install-time option.  For an "All Users" location (I 
>happened to install 3.9 for "All Users"), it does go into %PROGRAMFILES%:
>
I always install in "All Users" mode, but specify a directory that is
NOT under "Program Files" -- in this case, C:\Python310

The PowerShell command recurses into all subdirectories of the -path
argument. As it shows, the ONLY "pip" found is the actual library module.

PS C:\Users\Owner> Get-ChildItem -Path C:\P*\ -Recurse -Name -Filter
"pip.*"
R\R-4.2.3\library\climextRemes\pip
R\R-4.2.3\library\vICC\help\figures\pip.png
Package Cache\{5C3F818F-9EF5-444C-9386-77A0063A383A}v3.10.11150.0\pip.msi
Package Cache\{861EF849-90A5-4F4A-BAD4-479141466551}v3.10.10150.0\pip.msi
Lib\site-packages\pip
Lib\site-packages\pipenv\patched\pip
Lib\site-packages\pipenv\utils\pip.py
Lib\site-packages\pipenv\utils\__pycache__\pip.cpython-310.pyc
PS C:\Users\Owner> Get-ChildItem -Path C:\P*\ -Recurse -Name -Filter
"pip*.exe"
Common Files\Microsoft Shared\ink\pipanel.exe
{F87E77CE-BAA2-49E1-AAE3-1F6B2704ABAA}\OFFLINE\8AFA5EE\A9DCCED0\Pipe.exe
PS C:\Users\Owner>

Two variations, both now including "Program Files" (and x86),
"ProgramData", and the Python install; one looking for
"pip", the other "pipexe". Again, nothing
found except the library module.

"ensurepip" appears to only verify that the library module is installed
and does not seem to look for any .exe or other convenience access file.

PS C:\Users\Owner> python -m ensurepip
Looking in links: c:\Users\Owner\AppData\Local\Temp\tmp0cr7yu4s
Requirement already satisfied: setuptools in c:\python310\lib\site-packages
(67.6.1)
Requirement already satisfied: pip in c:\python310\lib\site-packages
(23.0.1)
PS C:\Users\Owner>

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-08 Thread Dennis Lee Bieber via Python-list
On Wed, 7 Jun 2023 10:36:22 -0600, Mats Wichmann 
declaimed the following:


>I'm assuming you checked - say, with Explorer - that pip.exe really is 
>where you think it is?
>Anyway,  if you ask a Windows shell (cmd) to locate it, and it doesn't, 
>then your PATH is not set up correctly after all.
>
>where pip
>
>should give you back a path that ends witn ...\Scripts\pip.exe
>

I'm having a suspicion that recent Windows installers are not including
a pip.exe...

-=-=-
C:\Users\Owner>echo %path%
C:\Python310\Scripts\;C:\Python310\;C:\Python310\Tools\Scripts;C:\Program
Files\PuTTY\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program
Files (x86)\Common Files\Acronis\VirtualFile\;C:\Program Files (x86)\Common
Files\Acronis\VirtualFile64\;C:\Program Files (x86)\Common
Files\Acronis\FileProtector\;C:\Program Files (x86)\Common
Files\Acronis\FileProtector64\;C:\Program Files (x86)\Common
Files\Acronis\SnapAPI\;C:\Program Files\ooRexx;C:\Program
Files\rexx.org\Regina;C:\Program Files\Microchip\xc8\v2.41\bin;C:\Program
Files\Microchip\xc8\v2.36\bin;C:\Program
Files\Microchip\xc16\v2.00\bin;C:\Program
Files\Microchip\xc32\v4.21\bin;C:\Program Files\Microsoft VS
Code\bin;C:\Program Files\dotnet\;C:\Program Files\TortoiseHg\;C:\Program
Files\Calibre2\;C:\Program Files\Microsoft SQL
Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client
SDK\ODBC\170\Tools\Binn\;C:\Program Files (x86)\IVI
Foundation\VISA\WinNT\Bin\;C:\Users\Owner\AppData\Local\Microsoft\WindowsApps;C:\Program
Files\JetBrains\PyCharm Community Edition
2021.1.2\bin;;C:\Users\Owner\.dotnet\tools

C:\Users\Owner>where pip.*
INFO: Could not find files for the given pattern(s).

C:\Users\Owner>
-=-=-
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\Owner> Get-ChildItem -Path C:\Python310\ -Recurse -Name -Filter
"pip.*"
Lib\site-packages\pip
Lib\site-packages\pipenv\patched\pip
Lib\site-packages\pipenv\utils\pip.py
Lib\site-packages\pipenv\utils\__pycache__\pip.cpython-310.pyc
PS C:\Users\Owner>
-=-=-

I've just run the installer -- python-3.10.11-amd64.exe -- as admin, in
"repair" mode! There is NO pip.exe under the Python install directory.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fwd: Problems Installing and getting started.

2023-05-31 Thread Dennis Lee Bieber
On Wed, 31 May 2023 08:34:48 +0100, Mark Bass 
declaimed the following:

>-- Forwarded message -
>From: Mark Bass 
>Date: Wed, 31 May 2023 at 08:09
>Subject: Problems Installing and getting started.
>To: 
>
>
>Good morning,
>
>I installed python several hours ago (from python.org), I then installed
>the IDE PyCharm. I'm using AI to help with a project that requires
>statistical analysis.
>I cannot open python, when I double clicked a "Modify Setup" window
>appeared with the three options Modify, Repair and Uninstall to click. I
>assumed this was part of the final installation process and clicked Modify
>- it seemed to be successful. I still could not open python. I asked the AI
>and it suggested to click Repair, this still made no difference. I finally
>Uninstalled it, shut down my laptop, had a coffee then re-installed it but
>the same problem occurred.
>Can you help ? Any suggestions?
>I'm really pleased with the AI so far  and looking forward to using Python
>to get my project started.
>Best Regards.Mark

You are RERUNNING the Python installer package.

Once you installed Python -- move that installer package to some
safe/obscure location on your computer (you should only need it if you
really need to fix an error with the installation).

Python does not provide, normally, a "click me" icon to run Python.
Python is a command line language INTERPRETER/COMPILER. If file
associations are set up, clicking on a script (.py) file /will/ run it --
but the window it opens goes away as soon as the script completes. Instead
one opens a command shell window and runs Python/scripts from that
window...

Microsoft Windows [Version 10.0.19045.2965]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Owner>python
Python 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

C:\Users\Owner>dir *.py
 Volume in drive C is Sys_OS
 Volume Serial Number is B650-6F92

 Directory of C:\Users\Owner

04/15/2023  04:57 PM50 junk.py
   1 File(s) 50 bytes
   0 Dir(s)  1,884,894,617,600 bytes free

C:\Users\Owner>python junk.py
2 4 6 8 10 12
C:\Users\Owner>junk.py
2 4 6 8 10 12
C:\Users\Owner>

Note: depending upon your environment, neither file associates nor
Python may be set up on the path. You may have a "py" command that is set
up to find and run Python (and allow specifying which version if you have
multiple versions (in different directories). Also, you may be affected by
whether Python was installed for "all users" or just the account that did
the install.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Weak Type Ability for Python

2023-04-14 Thread Dennis Lee Bieber


{one more entry in the thread drift, and then I think I'll shut up}

On Fri, 14 Apr 2023 17:22:47 +1000, Chris Angelico 
declaimed the following:


>Yeah, the "ADDRESS" command has so much potential. Back in the day, I
>built a MUD with REXX scripting, and within those scripts, the default
>ADDRESS target was "send message to the invoker of the command", so
>you could do something like this:

I used to think (Open)VMS would have been a potential platform for an
effective ADDRESS command. Where ARexx used a shared memory linked-list for
the "port" (as I'd stated, avoiding copying of data), (Open)VMS had
"mailboxes" (they would have to copy data -- or at best remap the virtual
memory from one process to another) which could serve the same purpose;
receiving application creates/owns the named mailbox, sending applications
would provide the data packet including a return mailbox link.

>
>/* A bare string gets sent to the client */
>"Hello!"
>/* You can still invoke shell commands, if you actually need to */
>address cmd "do_a_thing"
>
Yeah, that was the other feature -- anything that could not be parsed
as a REXX statement was automatically sent to whatever the current ADDRESS
host happened to be.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Weak Type Ability for Python

2023-04-14 Thread Dennis Lee Bieber
On Fri, 14 Apr 2023 05:35:22 +1000, Chris Angelico 
declaimed the following:

>It was quite the experience back in the day (as OS/2's native
>scripting language), and one that I'm truly glad to have had, as it
>taught me so much about the differences between languages.
>

I still miss the Amiga ARexx implementation which piggy-backed on the
Amiga IPC scheme* such that any application that opened a "RexxPort" could
be the target for "ADDRESS ", and hence scripted using ARexx (Did
IBM ever get beyond the two choices of command-line and a line-editor?).


*   Granted, that IPC relied upon the fact that all applications shared one
memory space, so there wasn't the overhead of copying data structures from
sending application to the port's linked list and thence to the receiving
application.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Weak Type Ability for Python

2023-04-14 Thread Dennis Lee Bieber
On Thu, 13 Apr 2023 20:53:21 -0400, Richard Damon
 declaimed the following:

>On 4/13/23 7:25 PM, avi.e.gr...@gmail.com wrote:
>> s there any concept in Python of storing information in some way, such as
>> text, and implementing various ideas or interfaces so that you can query if
>> the contents are willing and able to be viewed in one of many other ways?
>
>There is nothing that I know of built into Python that does this.
>
>There is no reason you can't write your own class to implement this. 
>Something that by "default" looks like a string, but in some contexts 
>(operated on by certain types) sees if its string could be treated as a 
>value of some other type, and if so, converts its value to that type and 
>does the operation.

I sure don't want to see the documentation for that...

a = thisType(3)
b = thisType(7)
c = 9   #plain integer

print(a + b + c)

(Since I presume left to right evaluation of equal level operations) Does
this result in

46 ("3" + "7" => "37", int("37") + 9 => 46)

or

19 (as int("3") + int("7") => 10, + 9 => 19)

Worse... changing order of a/b/c would make completely different
results...

82 (b + a + c)
127 (int(a) + c returning thisType(12) + b as strings)

and does (c + a) result in returning an integer (a conforming to c); or a
string (a coercing c to thisType).

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: for a 'good python'

2023-04-13 Thread Dennis Lee Bieber
On Thu, 13 Apr 2023 00:21:58 +0200, jak  declaimed the
following:


>Thank you too. I had seen this library but I always try not to use
>libraries outside the standard ones. Now I don't remember why I was
>convinced that this wasn't part of it, perhaps because it was like that
>at the time or because I got confused. Only now I realized that it is
>not necessary to install it. Now I'm considering whether to use
>'ipaddress' or 'socket'. What is certain is that this one you have
>suggested is really comfortable. Thanks again for the report.

It is useful to skim the contents of the standard library documentation
every couple of releases. ipaddress came in with Python 3.3

https://docs.python.org/3.10/library/index.html (I dropped down to 3.10
just as that is the version I have installed; some 3rd party modules
weren't ready when I tried to install on 3.11)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Weak Type Ability for Python

2023-04-13 Thread Dennis Lee Bieber
On Thu, 13 Apr 2023 12:21:58 +1000, Cameron Simpson 
declaimed the following:

>On 12Apr2023 22:12, avi.e.gr...@gmail.com  wrote:
>>I suspect the OP is thinking of languages like PERL or JAVA which guess 
>>for
>>you and make such conversions when it seems to make sense.
>
>JavaScript guesses. What a nightmare. Java acts like Python and will 
>forbid it on type grounds (at compile time with Java, being staticly 
>typed).
>

REXX -- where everything is considered a string until it needs to be
something else.

REXX-ooRexx_5.0.0(MT)_64-bit 6.05 23 Dec 2022
  rexxtry.rex lets you interactively try REXX statements.
Each string is executed when you hit Enter.
Enter 'call tell' for a description of the features.
  Go on - try a few...Enter 'exit' to end.
x = 1;
  ... rexxtry.rex on WindowsNT
y = "a";
  ... rexxtry.rex on WindowsNT
say x||y;
1a
  ... rexxtry.rex on WindowsNT
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: built-in pow() vs. math.pow()

2023-03-30 Thread Dennis Lee Bieber
On Thu, 30 Mar 2023 19:22:53 +0200, Roel Schroeven 
declaimed the following:

>Either import the things you need explicitly: "from math import sin, 
>cos, exp" (for example).
>Or a plain import: "import math" combined with "math.sin", "math.cos".
>Or use an abbreviation: "import math as m" combined with "m.sin", "m.cos".

Or, for this particular example of not wanting math.pow...

>>> from math import *
>>> pow(3, 4)
81.0
>>> del pow
>>> pow(3, 4)
81
>>> 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What kind of "thread safe" are deque's actually?

2023-03-29 Thread Dennis Lee Bieber
On Wed, 29 Mar 2023 10:50:49 -0400, Jack Dangler 
declaimed the following:

>Sorry for any injected confusion here, but that line "data = 
>sorted(data)" appears as though it takes the value of the variable named 
>_data_, sorts it and returns it to the same variable store, so no copy 
>would be created. Am I missing something there?

The entire Python object/data model.

Data is not "stored in" variables -- rather names are "attached to"
data.

sorted() creates a new data object, allocating memory for it. THEN the
name "data" is attached to this new data object (and disconnected from the
previous object). If there are no names left connected to the original
object, the garbage collector reaps its memory.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Standard class for time *period*?

2023-03-28 Thread Dennis Lee Bieber
On Tue, 28 Mar 2023 08:14:55 +0200, "Loris Bennett"
 declaimed the following:

>
>No, it doesn't.  I already know about timedelta.  I must have explained
>the issue badly, because everyone seems to be fixating on the
>formatting, which is not a problem and is incidental to what I am really
>interested in, namely:
>
>1. Is there a standard class for a 'period', i.e. length of time
>   specified by a start point and an end point?  The start and end
>   points could obviously be datetimes and the difference a timedelta,
>   but the period '2022-03-01 00:00 to 2022-03-02 00:00' would be
>   different to '2023-03-01 00:00 to 2023-03-02 00:00' even if the
>   *duration* of both periods is the same.
>
>2. If such a standard class doesn't exist, why does it not exist?
>

So far, you seem to be the only person who has ever asked for a single
entity incorporating an EPOCH (datetime.datetime) + a DURATION
(datetime.timedelta). You are asking for two durations of the same length
to be considered different if they were computed from different "zero"
references (epochs). I don't think I've ever encountered an application
that doesn't use a single epoch (possibly per run) with all internal
computations using a timedelta FROM THAT EPOCH! (The exception may have
been computing star atlases during the conversion from B1900 to J2000
reference frames.)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Look free ID genertion (was: Is there a more efficient threading lock?)

2023-03-02 Thread Dennis Lee Bieber
On Thu, 2 Mar 2023 12:45:50 +1100, Chris Angelico 
declaimed the following:

>
>As have all CPUs since; it's the only way to implement locks (push the
>locking all the way down to the CPU level).
>

Xerox Sigma (circa 1970): Modify and Test (byte/halfword/word)

Granted, that was a "mainframe" system, not a microprocessor.

Looks like Intel didn't catch the boat until 1985 and the i386.



-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a more efficient threading lock?

2023-02-25 Thread Dennis Lee Bieber
On Sat, 25 Feb 2023 15:41:52 -0600, Skip Montanaro
 declaimed the following:


>concurrent.futures.ThreadPoolExecutor() with the default number of workers (
>os.cpu_count() * 1.5, or 12 threads on my system) to process each month, so
>12 active threads at a time. Given that the process is pretty much CPU
>bound, maybe reducing the number of workers to the CPU count would make

Unless things have improved a lot over the years, the GIL still limits
active threads to the equivalent of a single CPU. The OS may swap among
which CPU as it schedules system processes, but only one thread will be
running at any moment regardless of CPU count.

Common wisdom is that Python threading works well for I/O bound
systems, where each thread spends most of its time waiting for some I/O
operation to complete -- thereby allowing the OS to schedule other threads.

For CPU bound, use of the multiprocessing package may be more suited --
though you'll have to device a working IPC system transfer data to/from the
separate processes (no shared objects as possible with threads).


-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Usenet vs. Mailing-list

2023-01-28 Thread Dennis Lee Bieber
On Sat, 28 Jan 2023 20:07:44 +, Chris Green  declaimed the
following:


>As far as I am aware the mirroring of the Python mailing list on
>comp.lan.python works perfectly.  I love gmane! :-)

Is gmane's gmane.comp.python.general allowing posts to go through
again? I had to revert to comp.lang.python some time back when gmane kept
rejecting outgoing posts.


-- 
Wulfraed     Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Usenet vs. Mailing-list (was: evaluation question)

2023-01-28 Thread Dennis Lee Bieber
On Sat, 28 Jan 2023 15:30:59 +0100, "Peter J. Holzer" 
declaimed the following:

>On 2023-01-27 21:04:58 +, Ben Bacarisse wrote:
>> mutt...@dastardlyhq.com writes:
>> 
>> > Hi
>> 
>> It looks like you posted this question via Usenet.  comp.lang.python is
>> essentially dead as a Usenet group.  It exists, and gets NNTP versions
>> of mail sent to the mailing list, but nothing posted to the group via
>> NNTP get send on the mailing list.
>
>This is wrong. I did get Muttley's any your postings via the
>mailing-list.
>

I had been tempted to ask when the list<>newsgroup link had changed,
since it hadn't been announced...

Now -- last time I checked the gmane server says posting is prohibited.
I used to use gmane as it retrieved directly from the mailing list (which
has been filtered from much spam) and not Usenet (and its open spam
problem).


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: bool and int

2023-01-25 Thread Dennis Lee Bieber
On Tue, 24 Jan 2023 20:16:31 -0500, Mike Baskin 
declaimed the following:

>Will all of you please stop sending me emails
>

Nobody is sending "you" emails deliberately (unless they have a poorly
[to me] set up client that sends to the list AND the person who wrote the
message they replied to) -- they are sending them to a Python mailing list.
The mailing list only sends them to /subscribed/ users.

Read the headers in the message for instructions...

List-Id: General discussion list for the Python programming language
 
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
 <mailto:python-list-requ...@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-requ...@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
 <mailto:python-list-requ...@python.org?subject=subscribe>


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to make argparse accept "-4^2+5.3*abs(-2-1)/2" string argument?

2023-01-24 Thread Dennis Lee Bieber
On Tue, 24 Jan 2023 15:13:33 + (UTC), Mike Baskin
 declaimed the following:

>Can you stop please
>

Stop what?

You appear to be subscribed to the Python mailing list -- as such you
WILL receive all traffic that appears on that list. There is nothing we can
do. It is not a personal "you post, and only direct replies to you show
up".

BTW: the mailing list is gatewayed to newsgroup comp.lang.python...




-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: To clarify how Python handles two equal objects

2023-01-11 Thread Dennis Lee Bieber
On Tue, 10 Jan 2023 16:59:59 -0500, Thomas Passin 
declaimed the following:

>Just to add a possibly picky detail to what others have said, Python 
>does not have an "array" type.  It has a "list" type, as well as some 
>other, not necessarily mutable, sequence types.
>
However, it has long had https://docs.python.org/3/library/array.html



-- 
    Wulfraed     Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Single line if statement with a continue

2022-12-18 Thread Dennis Lee Bieber
On Wed, 14 Dec 2022 10:53:10 -0800 (PST), Aaron P
 declaimed the following:

Late response here, and the concept may have been covered in
skimmed-over posts..

>I occasionally run across something like:
>
>for idx, thing in enumerate(things):
>if idx == 103: 
>continue
>do_something_with(thing)
>

For this example, I'd probably reverse the condition.

if idx != 103:
do_something_with(thing)

and hence completely drop the "continue" -- after all, if idx is 103, the
if statement falls through, and the end of the loop acts as an implicit
"continue"

OTOH: if the "if/continue" is buried in four or five layers of
conditionals, it could be cleaner than trying to configure the conditionals
to have a chained exit.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: FTP without username and password

2022-12-06 Thread Dennis Lee Bieber
On Tue, 6 Dec 2022 20:42:42 +0100, ^Bart 
declaimed the following:

>
>I tried the written Python code but it needs to insert a username and 
>password so it's a different service than TFTP but maybe there's also a 
>code to do it in Python! ;)
>

It's a whole different protocol. TFTP is simplified to the point it
will fit on embedded devices which don't need security (the assumption
being that one has the embedded device physically present, FTP assumes
distributed networks).

https://wiki.python.org/moin/tftp


-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: argparse — adding a --version flag in the face of positional args

2022-11-28 Thread Dennis Lee Bieber
On Sun, 27 Nov 2022 22:23:16 -0600, Karen Park  declaimed
the following:

>I figured it out…there was a logistics file given with the assignment! I 
>thought it was supposed to be a download included with the python 
>download…oops!
>
I think you made this response in the wrong thread...


-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python coding

2022-11-27 Thread Dennis Lee Bieber
On Sun, 27 Nov 2022 16:47:29 -0600, Karen Park  declaimed
the following:

>I am trying to do a python code. Using Windows, I got as far as the step that 
>asks me to “copy the logistics.py file and save it in the same folder that you 
>are running python from” (as displayed by the command prompt). 
>Can you help direct me where to go to copy and save this “logistics.py“ file?

Well, where do the instructions tell you to obtain "logistics.py"? Or
maybe that is the file you are supposed to create using some editor?

Unless you've changed directories, opening a command shell should
reveal something like:

Microsoft Windows [Version 10.0.19044.2251]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Wulfraed>

... C:\Users\Wulfraed   would be the directory in which to save the file
(for my machine)... But if I run a few directory changes...

Microsoft Windows [Version 10.0.19044.2251]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Wulfraed>cd "Documents\_Hg-Repositories\Python Progs"

C:\Users\Wulfraed\Documents\_Hg-Repositories\Python Progs>

... means the directory to save in would be 
C:\Users\Wulfraed\Documents\_Hg-Repositories\Python Progs

The idea is to save the .py file in the /current working directory/.
That way you only need to type the name of the file, without the long
directory path, when invoking the program (which assumes 'python"
[python.exe] is on your system path).


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: In code, list.clear doesn't throw error - it's just ignored

2022-11-14 Thread Dennis Lee Bieber
On Tue, 15 Nov 2022 09:11:10 +1100, Cameron Simpson 
declaimed the following:

>On 13Nov2022 22:23, DFS  wrote:
>>This is an easy check for the interpreter to make.
>
>It really isn't, given that (a) this isn't known by the interpreter to 
>be a `list` until runtime and (b) that would need embedding special 
>knowledge that looking up an attribute on a `list` has no side effects 
>(versus some other things, where it is not the case).
>

There is also the minor facet that "x.clear" can be bound to a
different name...

>>> x = [1, 2, 3.145926536, "Pie"]
>>> clearx = x.clear
>>> x
[1, 2, 3.145926536, 'Pie']
>>> clearx()
>>> x
[]
>>> 



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need max values in list of tuples, based on position

2022-11-12 Thread Dennis Lee Bieber
On Sat, 12 Nov 2022 13:24:37 -0500, Dennis Lee Bieber
 declaimed the following:


>   Granted, this will NOT work with "select *" unless one does the select
>*/fetchall first, AND extracts the names from the cursor description --
>then run a loop to create the select max(length(col)), ... statement (which
>is why I state the fetchall step, as unless one creates a second cursor,
>the latter select will wipe out any unfetched data from the first).
>

Okay, a follow-up...


>>> import sqlite3 as db
>>> con = 
>>> db.connect("c:/users/wulfraed/documents/.localdatabases/solitaire-sqlite/solitaire.db")
>>> cur = con.cursor()
>>> cur.execute("select * from game")

>>> columns = [ "max(length(%s))" % col[0] for col in cur.description ]
>>> columns
['max(length(ID))', 'max(length(Variant))', 'max(length(Num_of_Decks))',
'max(length(Cards_in_Deck))', 'max(length(Num_Tableau_Cards))',
'max(length(Num_Reserve_Cards))', 'max(length(Foundation_Value))',
'max(length(Tableau_Value))', 'max(length(Reserve_Value))']
>>> sql = "select %s from game" % ", ".join(columns)
>>> data = cur.fetchall()
>>> cur.execute(sql)

>>> widths = cur.fetchone()
>>> widths
(1, 16, 1, 2, 2, 2, 1, 2, 2)
>>> pformat = [ f'%{w}s' for w in widths ]
>>> pformat
['%1s', '%16s', '%1s', '%2s', '%2s', '%2s', '%1s', '%2s', '%2s']
>>> pformat = " | ".join(pformat)
>>> for row in data:
... print(pformat % row)
... 
1 |  Klondike draw-3 | 1 | 52 | 28 | 24 | 1 | -1 | -2
2 | Perpetual Motion | 1 | 52 |  0 | 52 | 1 | -1 | -1
3 |  Klondike draw-1 | 1 | 52 | 28 | 24 | 1 | -1 | -2

I used " | " rather than "\t" as column separators. View with a fixed
width font.

It could be a tad shorter -- the list-comps for columns and widths
(pformat) could be embedded IN the .join() calls.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need max values in list of tuples, based on position

2022-11-12 Thread Dennis Lee Bieber
On Fri, 11 Nov 2022 21:20:10 -0500, DFS  declaimed the
following:

>Yeah, I don't know why cursor.description doesn't work with SQLite; all 
>their columns are basically varchars.
>
If you read PEP 249 (the general DB-API), everything except column name
and data type code are optional. And the documentation for the sqlite3
module explicitly states that it only provides the column name, not even
type code.
 
>
>The query is literally any SELECT, any type of data, including SELECT *. 
>  The reason it works with SELECT * is the cursor.description against 
>SQLite DOES give the column names:
>
>select * from timezone;
>print(cur.description)
>(
>('TIMEZONE', None, None, None, None, None, None),
>('TIMEZONEDESC', None, None, None, None, None, None),
>('UTC_OFFSET',   None, None, None, None, None, None)
>)
>
>(I lined up the data)
>
>

Consider (table definition first)

CREATE TABLE Game (
ID INTEGER PRIMARY KEY NOT NULL,
Variant VARCHAR(64) NOT NULL,
Num_of_Decks INTEGER DEFAULT 1 NOT NULL,
Cards_in_Deck INTEGER DEFAULT 52 NOT NULL,
Num_Tableau_Cards INTEGER NOT NULL,
Num_Reserve_Cards INTEGER  
GENERATED ALWAYS 
AS ((Num_of_Decks * Cards_in_Deck) - Num_Tableau_Cards) STORED,
Foundation_Value INTEGER DEFAULT 1 NOT NULL,
Tableau_Value INTEGER DEFAULT -1 NOT NULL,
Reserve_Value INTEGER DEFAULT -2 NOT NULL
);
CREATE UNIQUE INDEX idx_Variant ON Game (Variant);

followed by a session retrieving three columns...

>>> import sqlite3 as db
>>> con = 
>>> db.connect("c:/users/wulfraed/documents/.localdatabases/solitaire-sqlite/solitaire.db")
>>> cur = con.cursor()
>>> cur.execute("""select max(length(variant)), max(length(cards_in_deck)),
... max(length(num_reserve_cards)) from Game""")

>>> widths = cur.fetchall()
>>> widths
[(16, 2, 2)]
>>> 
>>> widths[0]
(16, 2, 2)
>>> pformat = [f'%{w}s' for w in widths[0] ]
>>> pformat
['%16s', '%2s', '%2s']
>>> pformat = "\t".join(pformat)
>>> pformat
'%16s\t%2s\t%2s'
>>> for row in cur.fetchall():
... print(pformat % row)
... 
 Klondike draw-352  24
Perpetual Motion52  52
 Klondike draw-152  24
>>> 

Granted, this will NOT work with "select *" unless one does the select
*/fetchall first, AND extracts the names from the cursor description --
then run a loop to create the select max(length(col)), ... statement (which
is why I state the fetchall step, as unless one creates a second cursor,
the latter select will wipe out any unfetched data from the first).

It lets SQLite do the work of determining the max width occupied by
each column, rather than some complicated Python loop.



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need max values in list of tuples, based on position

2022-11-11 Thread Dennis Lee Bieber
On Fri, 11 Nov 2022 15:03:49 -0500, DFS  declaimed the
following:


>Thanks for looking at it.  I'm trying to determine the maximum length of 
>each column result in a SQL query.  Normally you can use the 3rd value 
>of the cursor.description object (see the DB-API spec), but apparently 
>not with my dbms (SQLite).  The 'display_size' column is None with 
>SQLite.  So I had to resort to another way.

Not really a surprise. SQLite doesn't really have column widths --
since any column can store data of any type; affinities just drive it into
what may be the optimal storage for the column... That is, if a column is
"INT", SQLite will attempt to convert whatever the data is into an integer
-- but if the data is not representable as an integer, it will be stored as
the next best form.

123 => stored as integer
"123"   => converted and stored as integer
123.0   => probably converted to integer
123.5   => likely stored as numeric/double
"one two three" => can't convert, store it as a string

We've not seen the SQL query in question, but it might suffice to use a
second (first?) SQL query with aggregate (untested)

max(length(colname))

for each column in the main SQL query.

"""
length(X)

For a string value X, the length(X) function returns the number of
characters (not bytes) in X prior to the first NUL character. Since SQLite
strings do not normally contain NUL characters, the length(X) function will
usually return the total number of characters in the string X. For a blob
value X, length(X) returns the number of bytes in the blob. If X is NULL
then length(X) is NULL. If X is numeric then length(X) returns the length
of a string representation of X. 
"""

        Note the last sentence for numerics. 


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need max values in list of tuples, based on position

2022-11-11 Thread Dennis Lee Bieber
On Fri, 11 Nov 2022 02:22:34 -0500, DFS  declaimed the
following:

>
>[(0,11), (1,1),  (2,1),
>  (0,1) , (1,41), (2,2),
>  (0,9) , (1,3),  (2,12)]
>
>The set of values in elements[0] is {0,1,2}
>
>I want the set of max values in elements[1]: {11,41,12}

Do they have to be IN THAT ORDER?

>>> data = [(0,11), (1,1),  (2,1), (0,1) , (1,41), (2,2), (0,9) , (1,3),  
>>> (2,12)]
>>> reshape = list(zip(*data))
>>> result = sorted(reshape[1])[-3:]
>>> result
[11, 12, 41]



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problems with IDLE in Windows 8.1 and installer x86 Version 3.10.8

2022-11-09 Thread Dennis Lee Bieber
On Thu, 10 Nov 2022 00:02:44 +,  declaimed the
following:

>Is there no one who can help?
>

Your problem description isn't detailed enough to even guess what you
are finding incorrect.

If you are on Windows, once you've done an install, shove the installer
file off into some archive and don't touch it again unless you need to
reinstall or repair the existing install.


Do a search for idle.*

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\Wulfraed> Get-ChildItem -Path C:\Python38\ -Recurse -Name
-Filter "idle.*"
Lib\idlelib\idle.bat
Lib\idlelib\idle.py
Lib\idlelib\idle.pyw
Lib\idlelib\Icons\idle.ico
Lib\site-packages\pythonwin\pywin\idle
Lib\site-packages\pythonwin\pywin\IDLE.cfg
PS C:\Users\Wulfraed> type C:\Python38\Lib\idlelib\idle.bat
@echo off
rem Start IDLE using the appropriate Python interpreter
set CURRDIR=%~dp0
start "IDLE" "%CURRDIR%..\..\pythonw.exe" "%CURRDIR%idle.pyw" %1 %2 %3 %4
%5 %6 %7 %8 %9
PS C:\Users\Wulfraed> c:\python38\lib\idlelib\idle.bat

... opens something IDLE related (seems to be an interactive Python shell,
but a configuration item allows setting it to open an edit window instead).

Interesting -- I could have sworn there was a Python38 entry on the
Windows start menu, but I seem to have removed it. I don't use IDLE, and
that was the primary item in the Python38 entry. I normally use an old
version of PythonWin (fyi: I'm using an old version of the ActiveState
Python package). I also have PyCharm installed.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Are Floating Point Numbers still a Can of Worms?

2022-10-24 Thread Dennis Lee Bieber
On Mon, 24 Oct 2022 14:52:28 +, "Schachner, Joseph (US)"
 declaimed the following:

>Floating point will always be a can of worms, as long as people expect it to 
>represent real numbers with more precision that float has.  Usually this is 
>not an issue, but sometimes it is.  And, although this example does not 
>exhibit subtractive cancellation, that is the surest way to have less 
>precision that the two values you subtracted.  And if you try to add up lots 
>of values, if your sum grows large enough, tiny values will not change it 
>anymore, even if there are many of them  - there are simple algorithms to 
>avoid this effect.  But all of this is because float has limited precision.
>

Might I suggest this to those affected...
https://www.amazon.com/Real-Computing-Made-Engineering-Calculations/dp/0486442217/ref=tmm_pap_swatch_0?_encoding=UTF8=134371=8-1

(Wow -- they want a fortune for the original hard-cover, which I own)


-- 
        Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: for -- else: what was the motivation?

2022-10-17 Thread Dennis Lee Bieber
On Wed, 12 Oct 2022 23:19:39 +0100, Rob Cliffe 
declaimed the following:

>I too have occasionally used for ... else.  It does have its uses. But 
>oh, how I wish it had been called something else more meaningful, 
>whether 'nobreak' or whatever.  It used to really confuse me.  Now I've 

"expired"?


-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to fix Python error, The term '.../python.exe' is not recognized as the name of a cmdlet, function, script file, or operable program, in VS Code?

2022-10-12 Thread Dennis Lee Bieber
On Tue, 11 Oct 2022 16:40:31 -0700, LouisAden Capellupo
 declaimed the following:

> So basically, I get, "The term '...\python.exe' is not recognized as the 
>name of a cmdlet, function, script, file, or operable program... At line: 1 
>char: 3." It works the first way I showed with Code Runner, but the second or 
>original way doesn't work. What if I don't want to use Code Runner? Any help 
>in fixing this problem would be greatly appreciated. Sorry if certain things 
>are unclear as this is my first time using Python.
>

What happens if you change the system to use the "command" shell
INSTEAD OF PowerShell?

PowerShell may not honor the same environment variables.


-- 
    Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Polot severa figures inside a for loopin

2022-10-10 Thread Dennis Lee Bieber
On Sun, 9 Oct 2022 09:27:55 +1100, Cameron Simpson 
declaimed the following:


>
>And what's IDL? Can you provide a URL to it?
>

Off hand, given the references to plots, and netcdf & 2D
specifically...

<https://en.wikipedia.org/wiki/IDL_(programming_language)>

So a nearly different domain of languages... I'd hope the OP is porting
IDL constructs (vector/array) to numpy/scipy.

But that also opens the question of what plotting package is being
used? Matplotlib or something else?



-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to get the current set LOG_MASK in Python's syslog module?

2022-09-22 Thread Dennis Lee Bieber
On Thu, 22 Sep 2022 13:28:57 +, c.bu...@posteo.jp declaimed the
following:


>I would like to get the current `LOG_MASK`, which is kind of a logging 
>level. According to the docu it seems that `syslog` doesn't have a 
>mechanism for that.
>

There is a function .LOG_MASK() but it seems to just return 2^arg

>>> import syslog
>>> syslog.LOG_MASK(1)
2
>>> syslog.LOG_MASK(2)
4
>>> syslog.LOG_MASK(3)
8
>>> syslog.LOG_MASK(4)
16
>>> syslog.LOG_MASK(0)
1
>>> syslog.LOG_MASK(256)
1
>>> syslog.LOG_MASK(16)
65536
>>> syslog.__doc__
>>> syslog.LOG_MASK(17)
131072
>>> syslog.LOG_MASK(32)
1
>>> syslog.LOG_MASK(24)
16777216
>>>

That is in the Windows Linux (Debian) subsystem.


>Does someone has an idea?
>
>The docu also tells me that `syslog` does let pass all messages by 
>default.
>My point is I do manipulate via `syslog.setlogmask()` the current log 
>leve. At the end I would like to set it back to its previous value.
>
>Kind


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: problem downloading python

2022-09-14 Thread Dennis Lee Bieber
On Wed, 14 Sep 2022 11:42:39 +0200, "carlharrison"
 declaimed the following:

>I am working on a PC with windows 10 and use Eset internet security. I have
>tried downloading  python 3.10.7 for windows. Using a tutorial I see that a
>checkbox should appear called "Add python 3/7 to path" but this does not
>appear whichever version I try to download. I wondered if Eset was stopping
>this somehow and tried it with Eset switched off but the result is the same.
>Can you help?

Download from where? (There are a number of distributions available,
including ones in the M$ "app" store, Visual Studio, etc.)

"Add Python..." is a step when RUNNING the installer. It should not
appear when DOWNLOADING the installer.

The general sequence is:

Download the installer file for the distribution.

RUN the installer program to install Python (and any other stuff
the distribution includes)

Hide the installer program/icons -- since they do NOT run Python
itself. Pure Python is run from a command line/shell interface; it is NOT a
graphical IDE.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Question about learning Python

2022-09-09 Thread Dennis Lee Bieber
On Thu, 8 Sep 2022 07:42:19 +1200, dn 
declaimed the following:

>TSRs? Now that was an ugly period of history! (trying to make a
>single-process operating system do multi-processing - only to find that
>many program[me]s assumed they had full use and undisputed control of
>the computer. Happy days...)
>

I laughed when M$ MSDOS (2?) introduced TSRs... My TRS-80 running
L(S)DOS had similar things at least a year earlier. And these were
/run-time/ loadable. They called them "filters" (and device drivers were
also an option). Key-click was one such -- though it also showed some
quirks (like... If the processor was really busy, the key-board driver
would buffer key-strokes, but the filter activated when an application
/read/ the key-board). Filter to control printer formatting, a JobLog
filter, Key-Stroke Multiply filter (I never used it, but it apparently uses
a table of special keys and expands them to longer strings). Commands to
load device drivers (or remove them!). Could even change the number of
cylinders for a floppy drive -- My drives were "loose" enough to allow my
to add 2 cylinders.

>On the other hand, one can start too 'high' or too 'modern'. Like the
>person enthusing about MSFT's and AWS' programming AIs, thinking that
>such tools will replace programmers (one of the aims of the COBOL
>language back in the 1960s). His short-form description spoke volumes:
>'it saves anyone from having to look-up Stack Overflow any more' - a
>'blind' cut-and-paste prospect that saves the 'author' from the
>difficulties of 'learning stuff'; until it is time to, um, learn-stuff -
>to know why one needs to learn-stuff BEFORE taking from SO/AI.

I once worked with someone whose idea of programming was to find
examples of working code, and cut snippets to make an application. We
needed to control four devices via GPIB... She wrote four short programs
and a DCL script to run them in sequence.

Problem: each program had to issue a GPIB initialization command before
it could continue to talk to any device. But each initialization command
would UNDO any configuration the previous program had set up! We discovered
THAT when TDY to the remote site (and she'd already returned home). I had
to debug the situation, and rewrite the four programs into a single
consolidate program over a weekend (and I'd never worked with GPIB before
this -- my task was the post processing of the data that was collected
after the GPIB chain had been set up for data collection).

I think I'm not giving away any secrets these days, but this was a
Quick Response Contract for a proof of concept -- that a geo-bird could
catch over the horizon GPS signals, and thereby improve the satellite
tracking data for ephemeris generation. Had to be over-the-horizon as
geo-birds are above GPS, and GPS aims signals down to earth. We had to
catch side-lobes as GPS birds were high enough to avoid
ionosphere/troposphere effects.



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: any author you find very good has written a book on Python?

2022-09-06 Thread Dennis Lee Bieber
On Mon, 05 Sep 2022 23:22:34 -0300, Meredith Montgomery
 declaimed the following:

>I never read a book on Python.  I'm looking for a good one now.  I just
>searched the web for names such as Charles Petzold, but it looks like he

So far as I know, Petzold is a Windows Internals type person. Python is
not a M$ product (even if they stuff it into their Win10 "app store" and is
an option in Visual Studio.

Searching for Python books using authors that may or may not have ever
seen Python seems futile... Many of my Python books are O'Reilly
publications, with specialized books from Packt and APress.


-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: venv questions

2022-08-30 Thread Dennis Lee Bieber
On Mon, 29 Aug 2022 22:57:50 -0400, gene heskett 
declaimed the following:

>Greetings all;
>
>The command to setup a venv, "python -m venv venv" has no man page that 
>I have
>found.
>

https://docs.python.org/3/library/venv.html



-- 
    Wulfraed     Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What can I do about this?

2022-08-29 Thread Dennis Lee Bieber
On Mon, 29 Aug 2022 04:51:13 -0400, gene heskett 
declaimed the following:

>What, on the arms, substitutes for the missing "*.whl" file?
>
In Debian -- apt-get
https://packages.debian.org/stable/source/wxpython4.0
of course, that will install things system-wide, not in a virtual
environment, and compatible with the system Python. For Bullseye, that is
still Python 3.9!

pi@rpi3bplus-1:~$ uname -a
Linux rpi3bplus-1 5.15.32-v7+ #1538 SMP Thu Mar 31 19:38:48 BST 2022 armv7l
GNU/Linux
pi@rpi3bplus-1:~$ sudo apt search wxpython
Sorting... Done
Full Text Search... Done
gnumed-client/stable 1.8.5+dfsg-2 all
  medical practice management - Client

psychopy/stable 2020.2.10+dfsg-2 all
  environment for creating psychology stimuli in Python

pyscanfcs/stable 0.3.6+ds-2+b1 armhf
  scientific tool for perpendicular line scanning FCS

python3-genx/stable 3.0.2-1 armhf
  differential evolution algorithm for fitting

python3-opengl/stable 3.1.5+dfsg-1 all
  Python bindings to OpenGL (Python 3)

python3-pyface/stable 6.1.2-2 all
  traits-capable windowing framework

python3-squaremap/stable 1:1.0.5-2 all
  wxPython control to display hierarchic data as nested squares

python3-wxgtk-media4.0/stable 4.0.7+dfsg-10 armhf
  Python 3 interface to the wxWidgets Cross-platform C++ GUI toolkit
(wx.media)

python3-wxgtk-webview4.0/stable 4.0.7+dfsg-10 armhf
  Python 3 interface to the wxWidgets Cross-platform C++ GUI toolkit
(wx.html2)

python3-wxgtk4.0/stable 4.0.7+dfsg-10 armhf
  Python 3 interface to the wxWidgets Cross-platform C++ GUI toolkit

soundgrain/stable 6.0.1-2 all
  Graphical interface to control granular sound synthesis modules

wxglade/stable 1.0.1-1 all
  GUI designer written in Python with wxPython

wxpython-tools/stable 4.0.7+dfsg-10 all
  Tools from the wxPython distribution

pi@rpi3bplus-1:~$

pi@rpi3bplus-1:~$ sudo apt install python3-wxgtk4.0
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  libwxbase3.0-0v5 libwxgtk3.0-gtk3-0v5
Suggested packages:
  wx3.0-doc
The following NEW packages will be installed:
  libwxbase3.0-0v5 libwxgtk3.0-gtk3-0v5 python3-wxgtk4.0
0 upgraded, 3 newly installed, 0 to remove and 161 not upgraded.
Need to get 10.5 MB of archives.
After this operation, 51.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf
libwxbase3.0-0v5 armhf 3.0.5.1+dfsg-2 [918 kB]
Get:2 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf
libwxgtk3.0-gtk3-0v5 armhf 3.0.5.1+dfsg-2 [3650 kB]
Get:3 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf
python3-wxgtk4.0 armhf 4.0.7+dfsg-10 [5970 kB]
Fetched 10.5 MB in 8s (1346 kB/s)
Selecting previously unselected package libwxbase3.0-0v5:armhf.
(Reading database ... 175515 files and directories currently installed.)
Preparing to unpack .../libwxbase3.0-0v5_3.0.5.1+dfsg-2_armhf.deb ...
Unpacking libwxbase3.0-0v5:armhf (3.0.5.1+dfsg-2) ...
Selecting previously unselected package libwxgtk3.0-gtk3-0v5:armhf.
Preparing to unpack .../libwxgtk3.0-gtk3-0v5_3.0.5.1+dfsg-2_armhf.deb ...
Unpacking libwxgtk3.0-gtk3-0v5:armhf (3.0.5.1+dfsg-2) ...
Selecting previously unselected package python3-wxgtk4.0.
Preparing to unpack .../python3-wxgtk4.0_4.0.7+dfsg-10_armhf.deb ...
Unpacking python3-wxgtk4.0 (4.0.7+dfsg-10) ...
Setting up libwxbase3.0-0v5:armhf (3.0.5.1+dfsg-2) ...
Setting up libwxgtk3.0-gtk3-0v5:armhf (3.0.5.1+dfsg-2) ...
Setting up python3-wxgtk4.0 (4.0.7+dfsg-10) ...
Processing triggers for libc-bin (2.31-13+rpt2+rpi1+deb11u2) ...
pi@rpi3bplus-1:~$






Or... You wait until somebody builds a Python3.10 ARMHF compatible
wheel.


-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What can I do about this?

2022-08-28 Thread Dennis Lee Bieber
On Sun, 28 Aug 2022 18:40:17 -0400, gene heskett 
declaimed the following:


>Collecting wxPython>=4.1
>   Using cached wxPython-4.2.0.tar.gz (71.0 MB)
>   Preparing metadata (setup.py) ... error
>   error: subprocess-exited-with-error
>

>     File 
>"/tmp/pip-install-c9gmbpsr/wxpython_1a0e096c87d84229b709c31ccb920a24/buildtools/config.py",
> 
>line 30, in 
>   from attrdict import AttrDict
>   ModuleNotFoundError: No module named 'attrdict'
>   [end of output]
>

Well... First I'd ask where you obtained a 4.2.0 tar.gz version of
wxPython? Maybe try overriding it with a 4.1 variant of it -- or whatever
you can find in the OS's package manager.
>
>What do I need to do to fix this? It supposedly works on a rpi4b, but 
>this is a rock64, V2,
>older stuff with 4 gigs of dram.
>
>Thank you for any help you can toss my way.
>

Ask in a forum specific to the OS? Heck, what IS the OS on that board,
and how up-to-date is it? The R-Pi is running a Raspberry Foundation
modified Debian Buster or Bullseye (appears they've pulled Buster, oldest
OS in the archive is January's Bullseye release).

This does not appear to really be a Python related problem -- rather it
looks like OS misconfiguration/disagreement.

However, you may wish to review
https://github.com/wxWidgets/Phoenix/issues/2225 

Python3.10 is, perhaps, too NEW and various third-party libraries have
not been updated to be compatible with IT. Maybe install a version of
Python3.9 and start over loading all those extra packages.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python 3.10 vs breakage

2022-08-28 Thread Dennis Lee Bieber
On Fri, 26 Aug 2022 17:36:39 -0400, gene heskett 
declaimed the following:

>
>Bullseye is the current debian-11, buster is last years, bookworm is next.
>
>Linuxcnc builds just fine on armhf buster, with its python-3.9.4. fails 
>from 3.10 in bullseye. Pronterface.py can't find wxPython 4.0 or 
>greater, with 4.0.7 installed. Octoprint did work, but has now stopped. 
>So my 3d printing has become a sneakernet exercise again. Adding 3 to 5 
>more steps between OpenCSAD and the printer that will make my designs. 

All of this suggests to me that you need to make your complaints to the
Debian devs WRT how they have configured things (or, if using an R-Pi, the
R-Pi Foundation, as they customize Debian for their release).
.


-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem using cx_Freeze > auto-py-to-exe

2022-08-19 Thread Dennis Lee Bieber
On Thu, 18 Aug 2022 12:17:25 -0600, David at Booomer 
declaimed the following:

>
>I did count but hadn’t noticed this argument list before you mentioned it. 
>However, I still don’t see any of these argument names in the Executable list 
>or anywhere else.
>

It's your responsibility to provide them when you called Executable().
As I said, you are (were?) providing a whole bunch of .py files, which were
being mapped to these arguments.


>"""
>argument name  description
>
>#1
>script the name of the file containing 
>the script
>which is to be frozen
>
prjui.py

>#2
>init_scriptthe name of the initialization 
>script that will
>be executed before the actual script is executed; this script is used to
>set up the environment for the executable; if a name is given without an
>absolute path the names of files in the initscripts subdirectory of the
>cx_Freeze package is searched
>
Maiui.py

>#3
>base   the name of the base 
>executable; if a name is
>given without an absolute path the names of files in the bases subdirectory
>of the cx_Freeze package is searched
>
about.py

>#4
>target_namethe name of the target executable; the 
>default
>value is the name of the script; the extension is optional (automatically
>added on Windows); support for names with version; if specified a pathname,
>raise an error.
>
dict.py

>#5
>icon   name of icon which should be 
>included in the
>executable itself on Windows or placed in the target directory for other
>platforms (ignored in Microsoft Store Python app)
>
geometry.py

>#6
>manifest   name of manifest which should 
>be included in
>the executable itself (Windows only - ignored by Python app from Microsoft
>Store)
>
getEquation.py

>#7
>uac-admin  creates a manifest for an 
>application that will
>request elevation (Windows only - ignored by Python app from Microsoft
>Store)
>
gtrail.py

>#8
>shortcut_name  the name to give a shortcut for the 
>executable
>when included in an MSI package (Windows only).
>
main.py

>#9
>shortcut_dir   the directory in which to place 
>the
>shortcut when being installed by an MSI package; see the MSI Shortcut table
>documentation for more information on what values can be placed here
>(Windows only).

matchingstring.py

>#10
>copyright  the copyright value to include 
>in the version
>resource associated with executable (Windows only).
>
producelatex.py

>#11
>trademarks the trademarks value to include 
>in the version
>resource associated with the executable (Windows only).

readfile.py

and
separete.py
speak.py
are not mapped to anything, hence the too-many arguments error.
>"""

As you can see, a lot of those don't even fit with the data type of the
argument.
>
>I tried passing just main.py or one of the others that might be a starting 
>point but just got ’NoneType has no len()

What did the traceback say? Just reporting the last line message is
meaningless.

>Then I searched for ‘python executable’ and found auto-py-to-exe and 
>pyinstaller which I must/might explore later. First tries ran into PyQt4 to 
>PyQt5 conversions. Good start at 
>https://towardsdatascience.com/how-to-easily-convert-a-python-script-to-an-executable-file-exe-4966e253c7e9
>

Note that pretty much all such python->executable scheme is just making
an archive of the required Python source files, and packaging the core of
the Python interpreter is such a way that running this archive is simply
extracting the source files and running the packaged Python interpreter
with them.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: UTF-8 and latin1

2022-08-19 Thread Dennis Lee Bieber
On Thu, 18 Aug 2022 11:33:59 -0700, Tobiah  declaimed the
following:

>
>So how does this break down?  When a person enters
>Montréal, Quebéc into a form field, what are they
>doing on the keyboard to make that happen?  As the
>string sits there in the text box, is it latin1, or utf-8
>or something else?  How does the browser know what
>sort of data it has in that text box?
>

If this were my ancient Amiga -- most of the accented characters in
ISO-Latin-1 were entered by using one of the meta/alt keys simultaneously
with one of five or six designated "dead keys" (in days of typewriters, a
dead key was one that did not advance the carriage to the next character
space). The dead key indicated which accent mark was to be applied to the
subsequent "regular" character.

On Windows, many of the characters might be entered using 
(where  are keys on the numeric pad!)  (such as 1254 => µ).

As for what the browser receives? Unless the browser is asking for raw
key codes and translating them internally to some encoding, it is likely
receiving characters in whatever encoding has been defined for the
computer/OS (Windows, most likely CP1252, which is a superset of latin-1 as
I recall). Whether the browser then re-encodes that to UTF-8 is something I
can't answer.



-- 
    Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem using cx_Freeze

2022-08-17 Thread Dennis Lee Bieber
On Wed, 17 Aug 2022 12:09:14 -0600, David at Booomer 
declaimed the following:

>executables=[
>Executable(
>
> "prjui.py","Maiui.py","about.py","dict.py","geometry.py","getEquation.py",
>
> "gtrail.py","main.py","matchingstring.py","producelatex.py","readfile.py",
>"separete.py","speak.py",
>)
>]
>)
>
You are defining a list "executables" with only ONE member... (and is
that really how you spelled "separate").

>Searching for ‘__init__(' in the 13 *.py files returned five lines in two 
>files (algorithm.py and prjui.py). As mentioned searching for this error only 
>produced mention of adding self which is in these lines already. Previously I 
>had search for __init__() which returned no lines due to the closing ).
>
You are still searching the wrong place... The __init__() that is
complaining is the one in cx_Freeze.Executable().

>I had visited the page you provided 
>(https://cx-freeze.readthedocs.io/en/latest/setup_script.html#cx-freeze-executable)
> but didn’t noticed the 11 plus self as 12 arguments.

Really? Please count (reformatted from cut):
"""
argument name   description

#1
script  the name of the file containing 
the script
which is to be frozen

#2
init_script the name of the initialization 
script that will
be executed before the actual script is executed; this script is used to
set up the environment for the executable; if a name is given without an
absolute path the names of files in the initscripts subdirectory of the
cx_Freeze package is searched

#3
basethe name of the base 
executable; if a name is
given without an absolute path the names of files in the bases subdirectory
of the cx_Freeze package is searched

#4
target_name the name of the target executable; the 
default
value is the name of the script; the extension is optional (automatically
added on Windows); support for names with version; if specified a pathname,
raise an error.

#5
iconname of icon which should be 
included in the
executable itself on Windows or placed in the target directory for other
platforms (ignored in Microsoft Store Python app)

#6
manifestname of manifest which should 
be included in
the executable itself (Windows only - ignored by Python app from Microsoft
Store)

#7
uac-admin   creates a manifest for an 
application that will
request elevation (Windows only - ignored by Python app from Microsoft
Store)

#8
shortcut_name   the name to give a shortcut for the 
executable
when included in an MSI package (Windows only).

#9
shortcut_dirthe directory in which to place 
the
shortcut when being installed by an MSI package; see the MSI Shortcut table
documentation for more information on what values can be placed here
(Windows only).

#10
copyright   the copyright value to include 
in the version
resource associated with executable (Windows only).

#11
trademarks  the trademarks value to include 
in the version
resource associated with the executable (Windows only).
"""

You are passing 13 .py file names. There are only two arguments that
really want file names: script, and init_script. Most of the other
arguments are either optional or Windows specific (#6-11).

I suspect you need to pass JUST main.py or Maiui.py (based on casing)
-- which ever is really the file you'd invoke to start the program running.
I'd hope the freeze system then scans (recursively) that file to find
anything imported, and include those in the final product.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem using cx_Freeze

2022-08-16 Thread Dennis Lee Bieber
On Mon, 15 Aug 2022 18:00:48 -0600, David at Booomer 
declaimed the following:


>However I now get an error
>
>init() takes from 2 to 12 positional arguments but 14 were given
>
>I found a couple instances of init in two .py files that were part of the 
>whole.
>
>One .py file
>def __init__(self):
>

Please cut the TEXT of the console where the errors are displayed
-- don't paraphrase!

init() is NOT the same as __init__()

WHAT "One .py file"? This is a meaningless bit of information.

The most likely __init__() involved is the one where
cx_Freeze.Executable is instantiated.
https://cx-freeze.readthedocs.io/en/latest/setup_script.html#cx-freeze-executable
shows 11 parameters (and "self" would make the 12th).





-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem using cx_Freeze

2022-08-15 Thread Dennis Lee Bieber
On Mon, 15 Aug 2022 10:30:41 -0600, David at Booomer 
declaimed the following:

>I’m trying to use cx_Freeze (https://pypi.org/project/cx-Freeze/) in a python 
>app but running into an error message:
>
>AttributeError: module 'cx_Freeze' has no attribute ‘BdistDMG’

What operating system? BdistDMG appears to be a Macintosh OS module --
something to do with disk images

https://cx-freeze.readthedocs.io/en/latest/setup_script.html
"""
On Windows, you can build a simple installer containing all the files
cx_Freeze includes for your application, by running the setup script as:

python setup.py bdist_msi

On Mac OS X, you can use bdist_dmg to build a Mac disk image.
"""

Note the command syntax and last line...


-- 
    Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python getting problem of installing pyqt5

2022-08-15 Thread Dennis Lee Bieber
On Sat, 13 Aug 2022 08:32:19 -0700 (PDT), Varad Gore 
declaimed the following:

>Collecting pyqt5
>  Using cached PyQt5-5.15.7-cp37-abi3-win_amd64.whl (6.8 MB)

Where did this one come from? The "cp37" seems to imply it is a Python
3.7 variant.

You also didn't include the command line that started this sequence...

>(venv) PS C:\Users\gorev\OneDrive\Desktop\Medidost> ^C

... was it also run from inside the virtual environment?

>(venv) PS C:\Users\gorev\OneDrive\Desktop\Medidost> pip install pyqt5-tools 

Personally, anytime I see OneDrive involved, my first thought is to
blame it (It plays hob with multi-file relational databases, such as Visual
FoxPro used by the TMG genealogy program -- VFP opens/closes table files
(there are three per table) on an as-needed scheme; OneDrive sees a
modified file and locks it while synching it to the cloud -- and that
blocks VFP from being able to do the next update, and often causing
corruption of the database when the three table files become
unsynchronized).

However... as a test (note: I have Python (an older ActiveState build)
installed "for all users", and not in a user specific install.

C:\Users\Wulfraed>pip install pyqt5_tools
Collecting pyqt5_tools
  Downloading pyqt5_tools-5.15.4.3.2-py3-none-any.whl (29 kB)
Collecting pyqt5-plugins<5.15.4.3,>=5.15.4.2.2
  Downloading pyqt5_plugins-5.15.4.2.2-cp38-cp38-win_amd64.whl (67 kB)
 || 67 kB 988 kB/s
Collecting python-dotenv
  Downloading python_dotenv-0.20.0-py3-none-any.whl (17 kB)
Collecting pyqt5==5.15.4
  Downloading PyQt5-5.15.4-cp36.cp37.cp38.cp39-none-win_amd64.whl (6.8 MB)
 || 6.8 MB 541 kB/s

>>>NOTE the file name for PyQt5

Requirement already satisfied: click in c:\python38\lib\site-packages (from
pyqt5_tools) (7.1.2)
Collecting qt5-tools<5.15.2.2,>=5.15.2.1.2
  Downloading qt5_tools-5.15.2.1.2-py3-none-any.whl (13 kB)
Collecting PyQt5-Qt5>=5.15
  Downloading PyQt5_Qt5-5.15.2-py3-none-win_amd64.whl (50.1 MB)
 || 50.1 MB 25 kB/s
Requirement already satisfied: PyQt5-sip<13,>=12.8 in
c:\python38\lib\site-packages (from pyqt5==5.15.4->pyqt5_tools) (12.8.1)
Collecting qt5-applications<5.15.2.3,>=5.15.2.2.2
  Downloading qt5_applications-5.15.2.2.2-py3-none-win_amd64.whl (60.9 MB)
 || 60.9 MB 5.5 kB/s
Installing collected packages: PyQt5-Qt5, pyqt5, qt5-applications,
qt5-tools, pyqt5-plugins, python-dotenv, pyqt5-tools
  Attempting uninstall: pyqt5
Found existing installation: PyQt5 5.15.1
Uninstalling PyQt5-5.15.1:
  Successfully uninstalled PyQt5-5.15.1
Successfully installed PyQt5-Qt5-5.15.2 pyqt5-5.15.4
pyqt5-plugins-5.15.4.2.2 pyqt5-tools-5.15.4.3.2 python-dotenv-0.20.0
qt5-applications-5.15.2.2.2 qt5-tools-5.15.2.1.2

C:\Users\Wulfraed>



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Persistent Error: Python was not found

2022-08-15 Thread Dennis Lee Bieber
On Mon, 15 Aug 2022 14:38:25 +1000, Mike Dewhirst 
declaimed the following:

>If you want to execute a python script without first opening a cmd 
>prompt, you need a bat file or shortcut which contains the command line 
>you want executed. Give that a double-click and it should also work.
>

I've never had to do that... But I have file associations set up so
that .py is considered to be an executable file.

Just double-clicking on the file will run it. The problem is that it
will open a command shell, run, and then close the command shell UNLESS one
explicitly codes some sort of "hold" at the end of the program

jnk = input("Press return to exit")

.pyw extension does not open the command shell -- but is meant for
programs that use one of the various GUI frameworks, which is probably more
than the new-comer is ready to attack.


-- 
    Wulfraed     Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parallel(?) programming with python

2022-08-10 Thread Dennis Lee Bieber
On Wed, 10 Aug 2022 19:33:04 +0200, "Dieter Maurer" 
declaimed the following:

>Schachner, Joseph (US) wrote at 2022-8-9 17:04 +:
>>Why would this application *require* parallel programming?   This could be 
>>done in one, single thread program.   Call time to get time and save it as 
>>start_time.   Keep a count of the number of 6 hour intervals, initialize it 
>>to 0.
>
>You could also use the `sched` module from Python's library.

 Time to really read the library reference manual again...

Though if I read this correctly, a long running action /will/ delay
others -- which could mean the (FFT) process could block collecting new
1-second readings while it is active. It also is "one-shot" on the
scheduled actions, meaning those actions still have to reschedule
themselves for the next time period.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parallel(?) programming with python

2022-08-09 Thread Dennis Lee Bieber
On Mon, 8 Aug 2022 19:39:27 +0200, Andreas Croci 
declaimed the following:

>
>Do you mean queues in the sense of deque (the data structure)? I ask 
>because I can see the advantage there when I try to pop data from the 
>front of it, but I don't see the sense of the following statement ("than 

Most likely this was a reference to the Queue module -- which is used
to pass data from one thread to another. Your "fetch" thread would package
up the "new" data to be processed by the FFT thread. The FFT thread is
blocked waiting for data to appear on the queue -- when it appears, the FFT
thread reads the entire packet of data and proceeds to process it.

Note that in this scheme, the FFT thread is NOT on a timer -- the fetch
thread controls the timing by when it puts data into the queue.

cf:
https://docs.python.org/3/library/threading.html
https://docs.python.org/3/library/queue.html

>
>That would obviusly save some coding (but would introduce the need to 
>code the interaction with the database), but I'm not sure it would speed 
>up the thing. Would the RDBMS allow to read a table while something else 
>is writing to it? I doubt it and I'm not sure it doesn't flush the cache 
>before letting you read, which would include a normally slow disk access.
>

Depends upon the RDBMs. Some are "multi-version concurrency" -- they
snapshot the data at the time of the read, while letting new writes
proceed. But if one is doing read/modify/write, this can cause a problem as
the RDBM will detect that a record was modified by someone else and prevent
you from changing it -- you have to reselect the data to get the current
version.

You will want to treat each of your network fetches as a transaction --
and close the transaction fast. Your FFT process would need to select all
data in the range to be processed, and load it into memory so you can free
that transaction

https://www.sqlite.org/lockingv3.html See section 3.0 and section 5.0



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Parallel(?) programming with python

2022-08-08 Thread Dennis Lee Bieber
On Mon, 8 Aug 2022 12:47:26 +0200, Andreas Croci 
declaimed the following:

>tI would like to write a program, that reads from the network a fixed 
>amount of bytes and appends them to a list. This should happen once a 
>second.
>

Ignoring leap seconds, there are 86400 seconds in a day -- how many
bytes are you planning to read each second?

Maybe more important? Is this a constant network connection feeding you
bytes (in which case the bytes available to read will be controlled by the
sender -- which may be sending continuously and building up a back log if
you don't empty the stream. Or are you planning to make a socket
connection, read n-bytes, close socket? 

>Another part of the program should take the list, as it has been filled 
>so far, every 6 hours or so, and do some computations on the data (a FFT).
>

"6 hours or so"? That leaves one open to all sorts of variable timing.
In either event, a 6 hour interval is more suited to a process started by a
cron job (Linux/Unix) or Task Scheduler (Windows). Having a thread sleep
for 6 hours means no safeguard if the parent process should die at some
point (and if you are keeping the data in an internal list, you lose all
that data too)

>Every so often (say once a week) the list should be saved to a file, 

This REQUIRES the process to not fail at any point, nor any system
restarts, etc. And (see prior paragraphs) how much data are you
accumulating. In one week you have 604800 "reads". If you are reading 10
bytes each time, that makes 6MB of data you could potentially lose (on most
modern hardware, 6MB is not a memory concern... Even 32-bit OS should be
able to find space for 600MB of data...).

Much better would be to write the file as you read each chunk. If the
file is configured right, a separate process should be able to do read-only
processing of the file even while the write process is on-going. OR, you
attempt an open/write/close cycle which could be blocked while your FFT is
processing -- you'd have to detect that situation and buffer the read data
until you get a subsequent successful open, at which time you'd write all
the backlog data.

Or you could even have your FFT process copy the data to the long term
file, while the write process just starts a new file when it finds itself
blocked (and the FFT deletes the file it was reading).

>shorthened in the front by so many items, and filled further with the 
>data coming fom the network. After the first saving of the whole list, 
>only the new part (the data that have come since the last saving) should 
>be appended to the file. A timestamp is in the data, so it's easy to say 
>what is new and what was already there.
>

Personally, this sounds more suited for something like SQLite3...
Insert new records as the data is read, with timestamps. FFT process
selects records based upon last data ID (that it processed previously) to
end of new data. SQLite3 database IS the long-term storage. Might need a
second table to hold the FFT process "last data ID" so on start up it can
determine where to begin.

>I'm not sure how to do this properly: can I write a part of a program 
>that keeps doing its job (appending data to the list once every second) 
>while another part computes something on the data of the same list, 
>ignoring the new data being written?
>
Well, if you really want ONE program -- you'll likely be looking at the
Threading module (I don't do "async", and your task doesn't seem suited for
async type call backs -- one thread that does the fetching of data, and a
second that does the FFT processing, which will be sleeping most of the
time).

But either way, I'd suggest not keeping the data in an internal list;
use some RDBM to keep the long-term data, accumulating it as you fetch it,
and letting the FFT read from the database for its processing.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: More efficient code, but slower program

2022-07-27 Thread Dennis Lee Bieber
On Wed, 27 Jul 2022 14:58:02 +0200, Cecil Westerhof 
declaimed the following:

>It is not very important, but I am just curious.
>
>Original I had in a program:
>values  = [*range(100)]
>
>But because it is done quite often I expected that initialising:
>range_list  = [*range(100)]
>
>and then use:
>values  = range_list.copy()
>
>Would be more efficient. So I tried:
>timeit('values  = [*range(100)]')
>1.6964535564184189
>
>and:
>timeit('new_values = values.copy()', 'values = [*range(100)]')
>0.6457642465829849
>
Were these done in the same program/session? If so, the first
invocation may be initializing/caching the first 100 integers (Python tends
to keep some number of integers in a permanent cache to speed later access
to common values).

Also rather than * unpacking of the range iterator into a [] list...
just...

>>> list(range(100))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
97, 98, 99]
>>> 

... will do it. 

Also, if your goal is to /remove/ and entry from the list via some
index, you might consider if this is more effective than copying the list
and THEN popping a value.

>>> full = list(range(100))
>>> import random
>>> idx = random.randint(0, len(full))
>>> idx
74
>>> trim = full[:idx] + full[idx+1:]
>>> trim
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
98, 99]
>>> trim == full
False
>>> 

or

>>> trim2 = full[:]
>>> del trim2[idx]
>>> trim
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
98, 99]
>>> 

The first does two partial copies skipping the item to be removed, and
joins the results into a new list. The second does a full copy and DELETES
the element to be removed from the copy.

>>> trim3 = full[:]
>>> trim3.remove(idx)
>>> trim3
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
98, 99]
>>> 

This option works because the list is sequential integers and the index
matches the values in the list (.remove() removes the first MATCHING
element, so if the list can have duplicates is may not remove the one AT
the index position).



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Dennis Lee Bieber
On Wed, 27 Jul 2022 10:45:47 +0200, Cecil Westerhof 
declaimed the following:


>What do you mean with where the python version is from?

Base Python.org download, ActiveState package download, Anaconda
package download, native OS install/extra install via OS repository
download (Debian/Ubuntu: apt install xxx, where xxx is not the native OS
Python)


-- 
Wulfraed     Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Dennis Lee Bieber
On Tue, 26 Jul 2022 23:47:59 +0200, Cecil Westerhof 
declaimed the following:


>The new code:
>from random  import SystemRandom
>system_random   = SystemRandom()
>index = system_random.randint(0, len(to_try) - 1)
>
>The first two statements are executed once.
>The last statement I think about 75 * 10 ** 6.
>
>So it seems that my first idea of using randbelow was the correct one.
>But if anyone could explain why SystemRandom is so much more
>expensive, I would be interested to know it.
>(Or am I still doing something wrong?)

What happens with

system_randint = SystemRandom().randint #no parens

index = system_randint(...)

which may remove the method lookup from the repetition.


-- 
        Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Dennis Lee Bieber
On Tue, 26 Jul 2022 16:38:38 +0200, Cecil Westerhof 
declaimed the following:

>I need to get a random integer. At first I tried it with:
>from secrets import randbelow
>index = randbelow(len(to_try))
>
>This works perfectly, but it took some time. So I thought I try:
>from random  import SystemRandom
>index = SystemRandom().randint(0, len(to_try) - 1)
>
>A first indication is that the second version would take about two
>times as much time as the first. Is there a reason for this, or should
>this not be happening?

Well, off the top of my head...

For one generation of "index" you are first creating an instance of
SystemRandom(), using it to generate your random integer, and then
disposing of the instance.

If you only need ONE random integer, the time difference probably
doesn't matter. OTOH, if you need many during the run, using

sr = SystemRandom()
#stuff in some loop that generates multiple ints
index = sr.randint(...)

Hmmm, wonder if there is a speed difference between
.randint(0, len(to_try) - 1)
and
.randint(1, len(to_try)) - 1


-- 
    Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: My first attempt at a package.

2022-07-25 Thread Dennis Lee Bieber
On Mon, 25 Jul 2022 10:39:46 +0200, Antoon Pardon 
declaimed the following:

>Yes it is, but it doesn't answer my question: How do I create a package 
>in which a file is built at install time.
>I just want to build a configuration file that will among some other 
>info contain the date the package
>was installed. The idea is that you can execute python3 -m 
>.release to know what version
>of the package you installed and when you installed it. But seem unable 
>to find a way to do this.

Does
https://stackoverflow.com/questions/72320778/autostart-installed-package-with-python
provide any hints?


-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: spyder v5: invalid file name when selecting interpreter in preferences

2022-07-25 Thread Dennis Lee Bieber
On Sat, 23 Jul 2022 22:51:17 +0100, MRAB 
declaimed the following:

>On 23/07/2022 18:30, Leif Svalgaard wrote:
>> error message: invalid file path: C:/Users/leifs/anaconda3/python3105.exe
>> what is wrong with that?
>> 
>Is there a file called python3105.exe in the folder 
>C:/Users/leifs/anaconda3?
>
>That filename looks wrong to me because the file is usually called 
>python.exe.

PS C:\Users\Wulfraed> Get-ChildItem -Path 'C:\Python38\' -Name -Filter
"python*.exe"

python.exe
python3.8.exe
python3.exe
pythonservice.exe
pythonw.exe
PS C:\Users\Wulfraed>

That's from a stale ActiveState build... Anaconda may drop the "." in
the version (I'd expect it is python3.10.5)


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: spyder v5: invalid file name when selecting interpreter in preferences

2022-07-25 Thread Dennis Lee Bieber
On Sat, 23 Jul 2022 10:30:09 -0700, Leif Svalgaard 
declaimed the following:

>error message: invalid file path: C:/Users/leifs/anaconda3/python3105.exe
>what is wrong with that?

Please cut and paste the ENTIRE error message (not a screen image,
select the TEXT) including context. If that is something being passed to a
Windows command shell, the shell does not handle / (that's a command
OPTION), only \ for paths.

Have you navigated and proved you have such a file?



-- 
Wulfraed     Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Information about updating my python notebook

2022-07-25 Thread Dennis Lee Bieber
On Sat, 23 Jul 2022 18:16:20 +0200, nhlanhlah198506
 declaimed the following:

>Can I update my python account Sent from my Galaxy

WHAT Python account? 


-- 
Wulfraed     Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Object in List : how?

2022-07-25 Thread Dennis Lee Bieber
On Fri, 22 Jul 2022 23:28:11 -0500, Khairil Sitanggang 
declaimed the following:


>class Node:
>def __init__(self):
>self.NO = 0
>self.A = 20
>
>NODE = Node()
>NODELIST = []
>

Comment...

The convention is that ALL CAPS is used to indicate something that is
to be treated as a CONSTANT. Classes get capitalized initial letters. Names
of variable data is traditionally all lower case, lower case with _ between
"words" (eg: lower_case), or camel case (eg: camelCase).

>NODE.NO = 10
>NODELIST.append(NODE)
>
>NODE.NO = 20
>NODELIST.append(NODE)
>
>NODE.NO = 30
>NODELIST.append(NODE)
>
>
>NO1 = 20
>if NO1 not in NODELIST[:].NO  ???

The [:], in this statement, just says "make a copy of nodelist". The
/list/ does not have an attribute named "NO". You have to ask for each
element IN the list.

One convoluted way (I've not tested it) is:

if len([node for node in nodelist if node.no == no1]):
print("Found at least one occurence")

This is a list comprehension; it loops over each element in nodelist,
making a new list if the element attribute matches the criteria. Python
treats 0 as "false" and if no element matched, the list created is empty,
so len() is 0. Anything else implies a match was found.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Neuroimaging] what's the problem??????

2022-07-15 Thread Dennis Lee Bieber
On Thu, 14 Jul 2022 17:20:55 -0400,  declaimed the
following:

>Dennis,
>
>I see Nati sent some more code without explaining again what he wants. Yes, 
>somewhere in this stack of messages he may have said things (that we generally 
>failed to understand) but it would be helpful to summarize WHY he sent us what 
>he did or which lines to look at.
>

And that code seems to be doing a lot of repetitive/unneeded
operations... Nothing from 

from nilearn import ...
to
masker = ...

appears to depend upon the file name "nii" in the loop and should be
refactored to the top-level. The try/except block for sklearn looks like
another candidate to be pulled out of the file loop.

> If your suggestion is right, he may not understand dictionaries as a hashed 
> data structure where you can access a.items() or a.keys() or a.values() if 
> you want a list of sorts of the parts, or a[key] if you want a particular 
> part.
>

So far as I can tell, the OP only references ONE key in the dictionary,
but apparently expects that key to have multiple values. Yet there doesn't
seem to be a structure /holding/ multiple values -- unless

a["Difumo_names"]

is, itself, returning a dictionary on which .values() can be applied. In
that case, the list() call is likely redundant as .values() already
returned a list (hmmm, is list(some_list) a no-op, or does it wrap
some_list into another list -- in the latter case, the indexing will fail
as there is only one element to access)

>for i in estimator.covariance_:
>r=list(a["Difumo_names"].values())[jsa]
>jsa=jsa+1
>a=dict()

And there is the biggest fault... The OP is completely obliterating the
"a" dictionary, so subsequent passes in that loop have nothing to look up.

"aas" gets initialized as a dictionary using {}, and never gets any
key:value pairs assigned to it, yet there is a print(aas) in the code.


And that is as far as I can guess -- given the lack of example input
data, example /desired/ output... etc. There are too many apparent errors
in that code sample to even attempt to think what a result could be.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Neuroimaging] what's the problem??????

2022-07-14 Thread Dennis Lee Bieber
On Thu, 14 Jul 2022 08:49:39 +0300, ???   declaimed
the following:

>Instead of numbers, I want to enter as indexes the names of the Index as
>being in b variable:
> labels = pd.read_csv(
>"C:/Users/Administrator/Desktop/64/64/labels_64_dictionary.csv")
>a=labels.to_dict()
>b=a["Difumo_names"]
>
Dicts don't have "indexes", they have "keys" (index implies a
positional look-up: first, second, ..., tenth item).

Show us an example of your actual data, what it looks like in Python,
and (hand-edited) what your really want the data to look like.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Job vacancies

2022-07-14 Thread Dennis Lee Bieber
On Sun, 10 Jul 2022 18:46:26 +0300, Walid AlMasri 
declaimed the following:

>
>I  would like to ask if there are any openings that suit my background?
>I want to work on python either remotely or at job site

Most of the regulars here are just users asking for help with the
language, or providing said help. Some may be developers of the Python
language itself.

Pretty much none that I've seen have any inputs with the hiring
departments of any firms.

Very few firms look explicitly for Python, in my experience. They want
software engineers with experience in multiple languages and operating
systems, and skill in developing software independent of language -- the
language used comes down to implementation (give the design to some
new-hire to hack into working code  ) and may be constrained by the
application domain requirements (you won't find Python in real-time
avionics, for example -- but it might be used to analyze debug logs during
development of said avionics).

Your background appears to be research-biased, and Python (with
numpy/scipy/pandas) would just be a tool for analysis... as would R,
Octave, Matlab, Mathematica. Again, I wouldn't expect any such research
facility to mandate Python -- they'd be more interested in the "theoretical
physics" side and data collection. Analysis would come down to whatever
tool is best suited (likely by a team consensus).

>
>I attach my CV
>

NO binary attachments on this forum. Plain text may make it through
(since you could just include it as the message itself).

But... since no hiring manager is reading here, there is no reason to
include it. You need to investigate sites that manage job postings.


-- 
    Wulfraed     Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python installation

2022-07-04 Thread Dennis Lee Bieber
On Mon, 04 Jul 2022 13:29:00 +0100, Mark Pawelek 
declaimed the following:

>
>ISSUE:  I cannot select a folder to install Python in. I want to put
>it under Program Files. The 'installer' only wants to put it in
>C:\users\Lenovo\AppData\local\Programs\Python\Python310
>
That indicates two things: One, you are logged in as "Lenovo" and Two,
you are not running the installer with Admin privileges (or installed using
the "current user" option).

>What do I do to alter the path to something like:
>C:\Programs\Python310  or  C:\Program Files\Python310 ?
>

Install using admin privileges and select the "All Users" option.
Though I'd recommend installing to a simple C:\Python310. If you install in
the system default "Program Files" directory any updates (which may be PIP
module installs) will need to be done under admin privileges.


>RELEVANT INFO:  It is a new Win10 PC, with i5-6500 CPU, and I added
>the user less than a week ago the first time I used the PC since I
>bought it on ebay (sold by a charity). Microsoft forced me to create a
>user. I had to enter an email address and (local) password. I have an
>online Microsoft account associated with that email address, so MS
>validated me by texting a code to my mobile which I entered at the PC.
>I didn't create the UserName: Lenovo. MS did [BTW: the PC 'Host Name'
>is something else, but the 'System Manufacturer' = Lenovo]. This
>Administrator user is the ONLY login user. The account details are:
>
Someone chose that name. If M$ were choosing user names based on
manufacturer there would be thousands of "Lenovo" user names out there, and
that would not be possible for a "M$ login" (it would be possible for
"local machine" logins).

Furthermore, one CAN set up Windows 10 WITHOUT creating a Microsoft
Domain Login. Local login accounts can be created. The only reason I have a
M$ login on my machine is that they may want it for their "app store" and
things like Visual Studio -- my machine, however, is not logged in using
the M$ account, just my local username.



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: why function throws an error?

2022-06-28 Thread Dennis Lee Bieber
On Tue, 28 Jun 2022 10:57:59 +0300, ???   declaimed
the following:

>def add_route(self, route):
>#""" Add a route object, but do not change the :data:`Route.app`
>#attribute."""
>self.routes.append(route)
>self.router.add(route.rule, route.method, route, name=route.name
>)
>#if DEBUG: route.prepare()

From your subject "why function throws an error?".

How would we know? You never show us the error traceback, you never
provide a minimal code listing that someone could attempt to run to perform
debugging.



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Dennis Lee Bieber
On Fri, 24 Jun 2022 18:27:33 +0300, ???   declaimed
the following:

>I copied  most of the libraries from cython

I doubt that... cython is a specialized Python COMPILER system.
"CPython" is the common interpreted Python language (implemented in C), and
is the most likely source of the packages you are mongrelizing..

https://cython.org/
"""
Cython is an optimising static compiler for both the Python programming
language and the extended Cython programming language (based on Pyrex). It
makes writing C extensions for Python as easy as Python itself. 
"""
"""
The Cython language is a superset of the Python language that additionally
supports calling C functions and declaring C types on variables and class
attributes. This allows the compiler to generate very efficient C code from
Cython code. The C code is generated once and then compiles with all major
C/C++ compilers in CPython 2.6, 2.7 (2.4+ with Cython 0.20.x) as well as
3.3 and all later versions.
"""


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: sre_constants MODIFIED CLASS - ERROR

2022-06-24 Thread Dennis Lee Bieber
On Fri, 24 Jun 2022 15:14:50 +0300, ???   declaimed
the following:

>My TARGET  is to bind many code libraries to one Huge code file that works
>optimally and do optimizations if needed.
>In this file have code of huge part of falconpy, ALL code of re, argparse,
>are and many other code libraries
>
>This code file is contained 10k lines of python code
>

Which means any program that just uses regular expressions has to
import, parse, and byte-code compile all 10K lines.

There is a reason Python doesn't make super all-in-one libraries.


-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: argparse modify

2022-06-24 Thread Dennis Lee Bieber
On Thu, 23 Jun 2022 17:01:42 -0600, Mats Wichmann 
declaimed the following:

>Assuming: that the "value" in your init method signature was supposed to
>be 'name' since that's what you use later - and would explain your
>exception!
>

Since it is a "named int", I'd expect value to the integer value of
this "constant" (and there should probably be a generic setter that... bars
changing value or name later). If a "name" keyword argument is not
supplied, using the str() of the value for the name might be valid.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: argparse modify

2022-06-23 Thread Dennis Lee Bieber
On Thu, 23 Jun 2022 18:57:31 +0200, "Dieter Maurer" 
declaimed the following:

>???  wrote at 2022-6-23 15:31 +0300:
>>how to solve this (argparse)

>>MAXREPEAT = _NamedIntConstant(32,name=str(32))
>>TypeError: 'name' is an invalid keyword argument for int()
>
>This does not look like an `argparse` problem:
>the traceback comes from `oracle/RTR.py`.

And the listed code looks quite suspicious to me...

>> class _NamedIntConstant(int):
>> def __init__(cls, value):
>> self = super(_NamedIntConstant, cls).__init__(cls, value)
>> self.name = name
>> return self

There does not appear to be any provision for keyword arguments at all.
The only use of "name" is to an undefined object.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python installation

2022-06-21 Thread Dennis Lee Bieber
On Tue, 21 Jun 2022 14:22:29 +0300, Brian Karinga 
declaimed the following:

>I have been trying to download and install the latest version of python on
>my windows device. However, when I run the program, three options arise.
>These are:
>
>Modify
>Repair
>Uninstall
>

You are (re-)running the INSTALLER. Once you've run it, hide it away
someplace and only look at it if you need to -- well -- repair or modify
the installation.

Python is not an IDE (it is not something like Visual Studio where one
opens a massive suite of editing/debugging tools which will eventually
invoke Visual C/C++/C#/BASIC compilers). It is a command line interpreter
which might (depending on install setting) configure the system to use it
to run files with .py (or .pyw for GUI applications where a console window
is not desired... note that running a .py by clicking on it will open a
console window, and that window will close when the program exits -- so
that option is often useless).


-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: "CPython"

2022-06-21 Thread Dennis Lee Bieber
On Tue, 21 Jun 2022 19:53:51 +1200, Greg Ewing
 declaimed the following:

>Although if it were called RPython, no doubt a new debate would
>flare up over whether the "R" stands for "Rust" or "Reference"...

Or does RPython refer to a Python integrated into the R statistics
system? 

Actually -- RPython is already taken...
https://rpython.readthedocs.io/en/latest/

"""
RPython is a translation and support framework for producing
implementations of dynamic languages, emphasizing a clean separation
between language specification and implementation aspects.

By separating concerns in this way, our implementation of Python - and
other dynamic languages - is able to automatically generate a Just-in-Time
compiler for any dynamic language. It also allows a mix-and-match approach
to implementation decisions, including many that have historically been
outside of a user’s control, such as target platform, memory and threading
models, garbage collection strategies, and optimizations applied, including
whether or not to have a JIT in the first place.
"""


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: "CPython"

2022-06-21 Thread Dennis Lee Bieber
On Tue, 21 Jun 2022 01:53:38 +0100, Paulo da Silva
 declaimed the following:


>I still find very strange, to not say weird, that a compiler or 
>interpreter has a name based in the language it was written. But, again, 
>is just my opinion and nothing more.
>

The whole purpose for that was to differentiate from Python /language/
implemented in OTHER languages. IronPython is a M$ .NET/C# implementation,
Jython is a JVM/Java implementation.

When you just say "Python" you are referring to ALL of those
implementations.


-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: "CPython"

2022-06-21 Thread Dennis Lee Bieber
tOn Tue, 21 Jun 2022 02:52:28 + (UTC), Avi Gross 
declaimed the following:

>
>I don't even want to think fo what sound a C# Python would make.

A musical hiss on a frequency of 277.183Hz (for the C# above middle-C)


-- 
Wulfraed     Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tkinter - cannot import tklib

2022-06-20 Thread Dennis Lee Bieber
On Mon, 20 Jun 2022 15:43:26 -0700 (PDT), Wolfgang Grafen
 declaimed the following:

>
>There are numerous examples using "from tklib import *" so I assume it works 
>for most. In the tk-tutorial below tklib is used without special explanation, 
>so I assume it should be installed by default with every python installation 
>which has Tkinter integrated. 
>
>https://tk-tutorial.readthedocs.io/en/latest/intro/intro.html?highlight=app#
>
>First time that I cannot help myself. Please help, what do I do wrong?
>

From what I can see, you haven't /written/ a tklib module.

That tutorial assumes you will create a module containing a number of
simplified interfaces to tk widgets. cf:
https://tk-tutorial.readthedocs.io/en/latest/radio/radio.html#a-better-radiobutton-class
tklib.py will contain the definition of the Radiobutton class. The same
probably applies everywhere that you see tklib imported -- whatever classes
are used to create widgets need to be defined in that file.

https://tk-tutorial.readthedocs.io/en/latest/intro/intro.html?highlight=app#
"""
In the following section we are going to redefine the tk and ttk objects.
To make it easier to use them, we follow these design principles:

we keep the excact same class names
the parent object is chosen automatically
all keyword arguments are forwarded

The first widget to consider is the Label which just places static text.
Where it makes sense, a label will be combined with a button or entry
widget.
"""

https://tk-tutorial.readthedocs.io/en/latest/check/check.html#a-better-checkbutton-class
etc.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: "CPython"

2022-06-20 Thread Dennis Lee Bieber
On Mon, 20 Jun 2022 20:01:51 +0100, Paulo da Silva
 declaimed the following:


>Not so "unconfirmed"!
>Look at this article, I recently read:
>https://www.analyticsinsight.net/cpython-to-step-over-javascript-in-developing-web-applications/
>
>There is a sentence in ther that begins with "CPython, short for Core 
>Python, a reference implementation that other Python distributions are 
>derived from, ...".
>
>Anyway, I wrote "IMHO".
>
>Do you have any credible reference to your assertion "The "C" in 
>"CPython" stands for C."?
>

Well, let's start at the top...

https://www.python.org/download/alternatives/ ("traditional" implying
implemented in C).
https://en.wikipedia.org/wiki/CPython

https://stackoverflow.com/questions/17130975/python-vs-cpython
https://www.c-sharpcorner.com/article/why-learn-python-an-introduction-to-python/
https://www.geeksforgeeks.org/difference-various-implementations-python/

There is some plagiarism between a number of web-sites, but they all
emphasize the "CPython" is a reference implementation and that it is
written in C vs Java (Jython), C# (IronPython -- which M$ may be
deprecating these days, based on some stuff in my last Visual Studio
update), or other


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What's up with modern Python programmers rewriting everything in Rust?

2022-06-20 Thread Dennis Lee Bieber
On Mon, 20 Jun 2022 15:54:29 +0100, Paulo da Silva
 declaimed the following:

>Às 15:07 de 19/06/22, jan Anja escreveu:
>> Dude, it's called CPython for a reason.
>
>IMHO CPython means Core Python, not C Python.

It is, as I recall, a term for the reference implementation of Python,
which was written in C... In contrast to things like Jython -- Python
implemented using Java.


-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tkinter module test: widget class not inserted in application frame

2022-06-17 Thread Dennis Lee Bieber
On Fri, 17 Jun 2022 09:19:59 -0700 (PDT), Rich Shepard
 declaimed the following:

>I'm not seeing the error source in a small tkinter module I'm testing.
>
>The module code:
>---
>import tkinter as tk
>from tkinter import ttk
>
>import common_classes as cc
>
>class ConactNameInput(tk.Frame):

Presuming this is a cut of the actual code...

> ContactNameInput, 'lname',

> ContactNameInput, 'fname',


> ContactNameInput(self).grid(row = 0, column = 0, sticky=('EWNS'))

... please compare the spelling!



-- 
        Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: fill out bulletins

2022-06-15 Thread Dennis Lee Bieber
On Tue, 14 Jun 2022 11:15:47 -0400, Dennis Lee Bieber
 declaimed the following:

>On Tue, 14 Jun 2022 00:41:07 +0200, jak  declaimed the
>following:
>

>>
>>https://www.guardiacostiera.gov.it/venezia/Documents/Bollettino%20MOD.%20TD123.pdf
>


>   In either case -- they should be manageable spending some time laying
>out the "form" in any decent word processor, and developing the suitable
>mail-merge definitions and database. Or even a decent report-writer with a
>relational database.

Note: if it is the "individual/one-letter-per-box" areas that are
making it seem so difficult for mail-merge... Don't do it that way!

Use one mail-merge field for the entire data item, use a monospace
(fixed width) font (Courier, Lucida Console, etc.), and adjust the
character spacing using the word-processor formatting operation (in Word
this is under the Font pop-up dialog, "advanced" tab). Set it to "expanded"
spacing and adjust the amount of expansion until your chosen font is spaced
properly to appear as one character per form box.

https://support.microsoft.com/en-us/office/change-the-spaces-between-text-e9b96011-1c42-45c0-ad8f-e8a6e4a33462

(On LibreOffice Writer, it is under Format/Character..., Position tab on
the dialog. At least, it is on the version I have on Debian in VirtualBox.)


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: fill out bulletins

2022-06-14 Thread Dennis Lee Bieber
On Tue, 14 Jun 2022 00:41:07 +0200, jak  declaimed the
following:

>If you are interested in seeing what I called "post office bulletin"
>(English is not my language and I don't know the name, sorry), you can
>find a sample pdf (fillable) but it works badly here:
>
>https://www.guardiacostiera.gov.it/venezia/Documents/Bollettino%20MOD.%20TD123.pdf

While I can't read Italian... But that looks suspiciously like what I'd
call a Return Receipt (one side to be filled with "your" address for
returning, and the other to be filled/signed by the person accepting the
article)
https://faq.usps.com/s/article/Return-Receipt-The-Basics#Green_Card

Or an archaic Telegram form (NOT the cloud app) -- or even an ARRL
Message form https://www.ncarrl.org/nets/mes_form.html

In either case -- they should be manageable spending some time laying
out the "form" in any decent word processor, and developing the suitable
mail-merge definitions and database. Or even a decent report-writer with a
relational database.


-- 
    Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to replace characters in a string?

2022-06-08 Thread Dennis Lee Bieber
On Wed, 8 Jun 2022 11:09:05 +0200, Dave  declaimed
the following:

>Hi,
>
>Thanks for this! 
>
>So, is there a copy function/method that returns a MutableString like in 
>objective-C? I’ve solved this problems before in a number of languages like 
>Objective-C and AppleScript.

There are no mutable strings in Python. Any operation manipulating a
string RETURNS A MODIFIED NEW STRING.

>myString = 'Hello'
>myNewstring = myString.replace(myString,'e','a’)
>

Please study the library reference manual -- it should be clear what
the various string methods can perform. Hint: they are "methods", which
means whatever is before the . becomes the automatic "self" argument inside
the method)

https://docs.python.org/3/library/stdtypes.html#string-methods

"""
str.replace(old, new[, count])

Return a copy of the string with all occurrences of substring old
replaced by new. If the optional argument count is given, only the first
count occurrences are replaced.
"""

myNewstring = myString.replace("e", "a")

However... Please study
"""
static str.maketrans(x[, y[, z]])

This static method returns a translation table usable for
str.translate().

If there is only one argument, it must be a dictionary mapping Unicode
ordinals (integers) or characters (strings of length 1) to Unicode
ordinals, strings (of arbitrary lengths) or None. Character keys will then
be converted to ordinals.

If there are two arguments, they must be strings of equal length, and
in the resulting dictionary, each character in x will be mapped to the
character at the same position in y. If there is a third argument, it must
be a string, whose characters will be mapped to None in the result.
"""
"""
str.translate(table)

Return a copy of the string in which each character has been mapped
through the given translation table. The table must be an object that
implements indexing via __getitem__(), typically a mapping or sequence.
When indexed by a Unicode ordinal (an integer), the table object can do any
of the following: return a Unicode ordinal or a string, to map the
character to one or more other characters; return None, to delete the
character from the return string; or raise a LookupError exception, to map
the character to itself.

You can use str.maketrans() to create a translation map from
character-to-character mappings in different formats.

See also the codecs module for a more flexible approach to custom
character mappings.
"""

Hmmm, I'm out-of-date... I'm on v3.8 and .removeprefix() and
.removesuffix() (from v3.9) simplify my previous post... Instead of

if myString.lower().endswith(".mp3"): #lower() is a precaution for case
myString = myString[:-4]

just use
myString = myString.lower().removesuffix(".mp3")
{note, you'll have to make the compare using .lower() on the other name
since this statement returns a lowercased version}


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to test characters of a string

2022-06-08 Thread Dennis Lee Bieber
On Wed, 8 Jun 2022 01:53:26 + (UTC), Avi Gross 
declaimed the following:


>
>So is it necessary to insist on an exact pattern of two digits followed by a 
>space? 
>
>
>That would fail on "44 Minutes", "40 Oz. Dream", "50 Mission Cap", "50 Ways to 
>Say Goodbye", "99 Ways to Die" 
>
>It looks to me like you need to compare TWICE just in case. If it matches in 
>the original (perhaps with some normalization of case and whitespace, fine. If 
>not will they match if one or both have something to remove as a prefix such 
>as "02 ". And if you are comparing items where the same song is in two 
>different numeric sequences on different disks, ...

I suspect the OP really needs to extract the /track number/ from the
ID3 information, and (converting to a 2digit formatted string) see if the
file name begins with that track number... The format of the those
filenames appear to be those generated by some software when ripping CDs to
MP3s -- for example:

-=-=-
c:\Music\Roger Miller\All Time Greatest Hits>dir
 Volume in drive C is OS
 Volume Serial Number is 4ACC-3CB4

 Directory of c:\Music\Roger Miller\All Time Greatest Hits

04/11/2022  05:06 PM  .
04/11/2022  05:06 PM  ..
07/26/2018  11:20 AM 4,493,279 01 Dang Me.mp3
07/26/2018  11:20 AM 5,072,414 02 Chug-A-Lug.mp3
07/26/2018  11:20 AM 4,275,844 03 Do-Wacka-Do.mp3
07/26/2018  11:20 AM 4,284,208 04 In the Summertime.mp3
07/26/2018  11:20 AM 6,028,730 05 King of the Road.mp3
07/26/2018  11:20 AM 4,662,182 06 You Can't Roller Skate in a
Buffalo Herd.mp3
07/26/2018  11:20 AM 5,624,704 07 Engine, Engine #9.mp3
07/26/2018  11:20 AM 5,002,492 08 One Dyin' and a Buryin'.mp3
07/26/2018  11:21 AM 6,799,224 09 Last Word in Lonesome Is Me.mp3
07/26/2018  11:21 AM 5,637,230 10 Kansas City Star.mp3
07/26/2018  11:21 AM 4,656,910 11 England Swings.mp3
07/26/2018  11:21 AM 5,836,638 12 Husbands and Wives.mp3
07/26/2018  11:21 AM 5,470,216 13 I've Been a Long Time Leavin'.mp3
07/26/2018  11:21 AM 6,230,236 14 Walkin' in the Sunshine.mp3
07/26/2018  11:21 AM 6,416,060 15 Little Green Apples.mp3
07/26/2018  11:21 AM 9,794,442 16 Me and Bobby McGee.mp3
07/26/2018  11:22 AM 7,330,642 17 Where Have All the Average People
Gone.mp3
07/26/2018  11:22 AM 7,334,752 18 South.mp3
07/26/2018  11:22 AM 6,981,924 19 Tomorrow Night in Baltimore.mp3
07/26/2018  11:22 AM 9,353,872 20 River in the Rain.mp3
  20 File(s)121,285,999 bytes
   2 Dir(s)  295,427,198,976 bytes free

c:\Music\Roger Miller\All Time Greatest Hits>
-=-=-

Untested (especially the ID3 "variable" -- substitute variables as
needed to match the original code):

>>> id3Track = 2
>>> track_number = "%2.2d " % id3Track
>>> track_number
'02 '
>>> filename = "02 This is the life.mp3"
>>> if filename.startswith(track_number):
... nametitle = filename[3:]
... else:
... nametitle = filename
... 
>>> if nametitle.endswith(".mp3"):
... nametitle = nametitle[:-4]
... 
>>> nametitle
'This is the life'

Handling ASCII ' and " vs Unicode "smart" quotes is a different matter.

One may still run the risk of having a filename without a track number
BUT having a number that just manages to match the track number. To account
for that I'd suggest using the sequence:

*   Strip extension (if filename.lower().endswith(".mp3"): ...)
*   Handle any Unicode/ASCII quotes in both filename AND ID3 track title
*   Compare filename and title.
*   IF MATCHED -- done
*   IF NOT MATCHED
*   Format ID3 track number as shown above
*   Compare filename to (formatted track number + track 
title)
*   IF MATCHED -- done
*   IF NOT MATCHED
*   Log full filename and ID3 track 
title/track number to a
log for later examination.



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Filtering XArray Datasets?

2022-06-06 Thread Dennis Lee Bieber
On Mon, 6 Jun 2022 14:28:41 -0800, Israel Brewster 
declaimed the following:

>I have some large (>100GB) datasets loaded into memory in a two-dimensional (X 
>and Y) NumPy array backed

Unless you have some massive number cruncher machine, with TB RAM, you
are running with a lot of page swap -- and not just cached pages in unused
RAM; actual disk I/O.

Pretty much anything that has to scan the data is going to be slow!

>
>Currently I am doing this by creating a boolean array (data[‘latitude’]>50, 
>for example), and then applying that boolean array to the dataset using 
>.where(), with drop=True. This appears to work, but has two issues:
>

FYI: your first paragraph said "longitude", not "latitude".

>1) It’s slow. On my large datasets, applying where can take several minutes 
>(vs. just seconds to use a boolean array to index a similarly sized numpy 
>array)
>2) It uses large amounts of memory (which is REALLY a problem when the array 
>is already using 100GB+)
>

Personally, given the size of the data, and that it is going to involve
lots of page swapping... I'd try to convert the datasets into some RDBM --
maybe with indices defined for latitude/longitude columns, allowing queries
to scan the index to find matching records, and return those (perhaps for
processing one at a time "for rec in cursor:" rather than doing a
.fetchall().

Some RDBMs even have extensions for spatial data handling.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Automatic Gain Control in Python?

2022-06-06 Thread Dennis Lee Bieber
On Mon, 06 Jun 2022 10:10:37 -0700 (PDT), Grant Edwards
 declaimed the following:

>On 2022-06-06, Phil Boutros  wrote:
>
>> As pretty much everyone else has said. Insisting on real-time
>> processing of something that is itself pre-recorded is non-sensical.
>
>Downnloading a file, normalizing/compressing the volume, and then
>streaming the result is three lines in a bash script (assuming you've
>got wget, sox, and vlc installed). I assume that something similar
>could be done in PowerShell on Windows.
>
>With the right libraries, it's probably about the same in Python.

I would like to point out that "normalization" is not the same as
"AGC", which is not the same as "compression"... So what really is desired
here?

Normalization MUST have the entire file available, as it needs to know
the peak signal and adjusts the entire file to maximize the peak.

AGC in contrast is a sliding window operation which attempts to level
out the overall signal based upon previous "average". It is not "read a
chunk, normalize the chunk, repeat". Aggressive AGC will wipe out any
dynamics in an audio signal (I once had a cheap RatShack stereo cassette
deck which used a fixed AGC on record -- try to imagine the hash it made
when taping the 45rpm record of "The Night Chicago Died"... Every time the
drum hit in the opening measures the "sirens" were suppressed only to rise
in the interval before the next drum hit).

Compression operates sample-by-sample, so can be applied live -- but is
best used after the entire audio file has been normalized. Compression (at
least as used by me in the past -- Vegas 6) /reduces/ the strong parts of
the signal (anything above the specified threshold) by some defined ratio
-- then adjusts the entire signal back up to maximize the "reduced"
portion, thereby raising everything that fell below the threshold value.
There may or may not be some hint of AGC in the algorithm used (the
Audacity documents show attack/release settings acting as a limited AGC in
that it responds when transitions above and below threshold occur).


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Help with Python/Eyed3 MusicCDIdFrame method

2022-06-06 Thread Dennis Lee Bieber
On Mon, 6 Jun 2022 12:37:47 +0200, Dave  declaimed
the following:

>Hi,
>
>I’m trying to get the ID3 tags of an mp3 file. I trying to use the 
>MusicCDIdFrame
> method but I can’t seem to get it right. Here is a code snippet:
>
>
> import eyed3
>import eyed3.id3
>import eyed3.id3.frames
>import eyed3.id3.apple

As I understand the documentation, The last is Apple
specific/non-standard information...
https://eyed3.readthedocs.io/en/latest/eyed3.id3.html

"""
eyed3.id3.apple module

Here lies Apple frames, all of which are non-standard. All of these would
have been standard user text frames by anyone not being a bastard, on
purpose.
"""

{I'm not thrilled by the documentation -- it is basically a collection on
one-line doc-strings with absolutely no hints as to proper usage}

>  File "/Documents/Python/Test1/main.py", line 94, in 
>myCDID = myID3.id3.frames.MusicCDIdFrame(id=b'MCDI', toc=b'')
>AttributeError: 'Mp3AudioFile' object has no attribute 'id3'

"""
 eyed3.core.load(path, tag_version=None)[source]

Loads the file identified by path and returns a concrete type of
eyed3.core.AudioFile. If path is not a file an IOError is raised. None is
returned when the file type (i.e. mime-type) is not recognized. The
following AudioFile types are supported:

eyed3.mp3.Mp3AudioFile - For mp3 audio files.

eyed3.id3.TagFile - For raw ID3 data files.
"""

eyed3.id3. would appear to be specific to non-MP3 data files.

So... I'd try the interactive environment and check each layer...

dir(myID3)

(based upon the error, there will not be a "id3" key; so try
dir(myID3.) for each key you do find).

>
>
>Any help or suggestion greatly appreciated.
>

Given this bit of source code from the documentation...

def initTag(self, version=id3.ID3_DEFAULT_VERSION):
"""Add a id3.Tag to the file (removing any existing tag if one
exists).
"""
self.tag = id3.Tag()
self.tag.version = version
self.tag.file_info = id3.FileInfo(self.path)
return self.tag

... you probably need to be looking at 
myID3.tag.

... try
dir(myID3.tag)
and see what all may appear...

IOW: the ID3 information has already been parsed into separate "tag"
fields.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: min, max with position

2022-06-04 Thread Dennis Lee Bieber
On Sat, 4 Jun 2022 13:36:26 -0500, "Michael F. Stemper"
 declaimed the following:

>
>Are there similar functions that return not only the minimum
>or maximum value, but also its position?
>
If it isn't in the library reference manual, NO...

But it also isn't that difficult to write...

>>> def whatAt(function, data):
... what = function(data)
... at = data.index(what)
... return (at, what)
... 
>>> l = [   1.618033,   3.1415923536,   2.718282]
>>> whatAt(min, l)
(0, 1.618033)
>>> whatAt(max, l)
(1, 3.1415923536)
>>> 

(properly, I should either reverse the order of the return value, or change
the name to atWhat() )


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: help, please, with 3.10.4 install

2022-05-30 Thread Dennis Lee Bieber
On Sat, 28 May 2022 21:11:00 -0500, Jack Gilbert <00jhen...@gmail.com>
declaimed the following:

>also, the same line: Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022,
>23:13:41) [MSC v.1929 64 bit (AMD64)] on win32 in CMD prompt
>
>for the life of me I can't figure out how to launch python??
>

Well, what did you type in that command shell to get the line you
report above? (Cut and Paste the TEXT from that command shell -- don't just
transcribe by hand). That version string is only displayed when one starts
Python in interactive mode.

-=-=-
Microsoft Windows [Version 10.0.19044.1706]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Wulfraed>python
Python ActivePython 3.8.2 (ActiveState Software Inc.) based on
 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

-=-=-



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: bug in python 3.10.4

2022-05-26 Thread Dennis Lee Bieber
On Thu, 26 May 2022 19:56:16 +1200, dn 
declaimed the following:

Commentary meant for the OP, not "dn".

>Please reply to the list. Others may be able to assist (particularly if
>they use MS-Windows!).
>
>
>> Removing the  quit does not help with the problem.
>> 
>> input 10 x 10

Cut the entire text of the console window (not a screen grab)
showing the invocation and the output, if any. NOTE: This presumes you know
how to use the Windows command line. Double-clicking a .py file seldom
produces a usable stuff as the console opened is automatically closed when
the program exits. If you need to see the output, you need to put in some
code to make the program /wait/ until you signal that you are done.

>
>What was the result, or the exception report.
>
>Once again: did MS-Windows finish the job and close the window before
>you could see the result?



>>> number_1 = input("put a number\n")

This is going to wait at the console until you enter a value.

>>> if operations == "+":
>>>
>>>     print(number_1+number_2)
>>>
>>> elifoperations.lower() == "x":

Is that REALLY what the code has? I'd expect

"elifoperations"

to produce a syntax error of some sort since there is no apparent space
between the "elif" and "operations".

{stylistic note: "operations" is misleading -- it is just ONE OPERATOR}


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Convert the decimal numbers expressed in a `numpy.ndarray` into a matrix representing elements in fractional form

2022-05-18 Thread Dennis Lee Bieber
On Tue, 17 May 2022 17:20:54 +0100, MRAB 
declaimed the following:

>As it's just a simple replacement, I would've thought that the 'obvious' 
>solution would be:
> a = a.replace("'", "")

Mea culpa...

Guess it's time for me to review the library reference for basic data
types again. I'm so used to the .join(.split()) (usually for other purposes
-- like a quick TSV/CSV formatting without importing the csv module).
The only firm item is that I do not look at any regular expression module
if I can come up with something using native data type methods -- and using
the overhead of re with just simple text [ie; nothing that might be called
an "expression" designed to match /varying/ content) seems really
inefficient.


-- 
        Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Convert the decimal numbers expressed in a `numpy.ndarray` into a matrix representing elements in fractional form

2022-05-16 Thread Dennis Lee Bieber
On Mon, 16 May 2022 02:03:26 -0700 (PDT), "hongy...@gmail.com"
 declaimed the following:


>print(lst)

Printing higher level structures uses the repr() of the structure and
its contents -- theoretically a form that could be used within code as a
literal. If you want human-readable str() you will need to write your own
output loop to do the formatting of the structure, and explicitly print
each item of the structure.


-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Convert the decimal numbers expressed in a `numpy.ndarray` into a matrix representing elements in fractional form

2022-05-16 Thread Dennis Lee Bieber
On Mon, 16 May 2022 17:22:17 -0700 (PDT), "hongy...@gmail.com"
 declaimed the following:


>
>I tried with  the repr() method as follows, but it doesn't give any output:


I have no idea what 50% of those libraries are supposed to do, and am
not going to install them just to try out your posted code. If you really
want such help, post the MINIMUM example code the produces your problem.

>a=str(strmat(lst))
>a=re.sub(r"'","",a)

Explain what you believe this operation is doing, show us the input and
the output.

The best I can make out of that is that it is looking for single quote
characters within whatever "a" is, and replacing them with nothing.
Something much more understandable, without invoking a regular expression
library (especially when neither the search nor the replacement terms are
regular expressions) with simple string operations...

stripped = "".join(quoted.split("'"))

You also don't need to specify RAW format for the "'" -- Python is quite
happy mixing single and double quotes (that is: single quotes inside a
string using double quotes, double quotes inside a string using single
quotes, either inside strings using triply quoted delimiters)

>>> "'"
"'"
>>> '"'
'"'
>>> """'"'"""
'\'"\''
>>> '''"'"'''
'"\'"'
>>> 

(Note that the interactive console displays results using repr(), and hence
escapes ' that are internal to avoid conflict with the ones wrapping the
output)

>>> repr('''"'"''')
'\'"\\\'"\''
>>> str('''"'"''')
'"\'"'
>>> print('''"'"''')
"'"
>>> 

The print() operation does not wrap the output with extraneous quotes.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


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         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: tail

2022-05-11 Thread Dennis Lee Bieber
On Thu, 12 May 2022 06:07:18 +1000, Chris Angelico 
declaimed the following:

>I don't understand why this wants to be in the standard library.
>
Especially as any Linux distribution probably includes the compiled
"tail" command, so this would only be of use on Windows.

Under recent Windows, one has an equivalent to "tail" IFF using
PowerShell rather than the "DOS" shell.

https://www.middlewareinventory.com/blog/powershell-tail-file-windows-tail-command/

or install a Windows binary equivalent http://tailforwin32.sourceforge.net/


-- 
        Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: tail

2022-05-09 Thread Dennis Lee Bieber
On Mon, 9 May 2022 21:11:23 +0200, Marco Sulla
 declaimed the following:

>Nevertheless, tail is a fundamental tool in *nix. It's fast and
>reliable. Also the tail command can't handle different encodings?

Based upon
https://github.com/coreutils/coreutils/blob/master/src/tail.c the ONLY
thing tail looks at is single byte "\n". It does not handle other line
endings, and appears to performs BINARY I/O, not text I/O. It does nothing
for bytes that are not "\n". Split multi-byte encodings are irrelevant
since, if it does not find enough "\n" bytes in the buffer (chunk) it reads
another binary chunk and seeks for additional "\n" bytes. Once it finds the
desired amount, it is synchronized on the byte following the "\n" (which,
for multi-byte encodings might be a NUL, but in any event, should be a safe
location for subsequent I/O).

Interpretation of encoding appears to fall to the console driver
configuration when displaying the bytes output by tail.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: usb tv stick and python

2022-05-09 Thread Dennis Lee Bieber
On Mon, 9 May 2022 17:56:32 +0200, jak  declaimed the
following:

>First of all, thank you for your reply. Actually I already have a handy
>work around to use w_scan because I have a VM with linux (ubuntu)
>installed. I was just looking for a python package/library that would
>allow me to write a wrapper around. I would also be satisfied with
>finding documentation that describes the protocol to communicate with
>the dvb interface and be able to write an app that produces the list of
>available channels. Any advice, suggestion or pointing is welcome.

For the protocol... You might need to locate the source code for
w_scan. Perhaps https://github.com/tbsdtv/w_scan



-- 
Wulfraed         Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: usb tv stick and python

2022-05-09 Thread Dennis Lee Bieber
On Mon, 9 May 2022 08:47:50 +0200, jak  declaimed the
following:

>Hello everybody,
>I usually use vlc to watch tv and I use the w_scan program on linux to
>create a file (.m3u) with the list of available channels. Unfortunately
>I can't find an alternative to w_scan for Windows and I was wondering if
>you could tell me some python library that allows me, easily, to
>interface with the device and get the channel list.
>

UNTESTED... But if it works means no change to your procedures...

Presuming you are using W10 or later... 

Activate the Windows Subsystem for Linux ([old style] Control Panel /
Programs / Programs and Features... Turn Windows Features On or Off...
Scroll down, it's the third from the bottom)

Windows "Microsoft Store"; Search "Debian"; Download/Install (set a
log-in account/password). (Unfortunately, it's not the most recent version
-- still on Buster...)

Open Debian instance console (to my knowledge, no graphical
applications are supported); do normal stuff to bring apt up-to-date.

-=-=-
wulfraed@ElusiveUnicorn:~$ apt search w_scan
Sorting... Done
Full Text Search... Done
w-scan/oldstable 20170107-2 amd64
  Channel scanning tool for DVB and ATSC channels

wulfraed@ElusiveUnicorn:~$
-=-=-

Install and test. Windows partitions are accessible as
/mnt/



-- 
    Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: tail

2022-05-09 Thread Dennis Lee Bieber
On Sun, 8 May 2022 22:48:32 +0200, Marco Sulla
 declaimed the following:

>
>Emh. I re-quote
>
>seek(offset, whence=SEEK_SET)
>Change the stream position to the given byte offset.
>
>And so on. No mention of differences between text and binary mode.

You ignore that, underneath, Python is just wrapping the C API... And
the documentation for C explicitly specifies that other then SEEK_END with
offset 0, and SEEK_SET with offset of 0, for a text file one can only rely
upon SEEK_SET using an offset previously obtained with (C) ftell() /
(Python) .tell() .

https://docs.python.org/3/library/io.html
"""
class io.IOBase

The abstract base class for all I/O classes.
"""
 seek(offset, whence=SEEK_SET)

Change the stream position to the given byte offset. offset is
interpreted relative to the position indicated by whence. The default value
for whence is SEEK_SET. Values for whence are:
"""

Applicable to BINARY MODE I/O: For UTF-8 and any other multibyte
encoding, this means you could end up positioning into the middle of a
"character" and subsequently read garbage. It is on you to handle
synchronizing on a valid character position, and also to handle different
line ending conventions.

"""
class io.TextIOBase

Base class for text streams. This class provides a character and line
based interface to stream I/O. It inherits IOBase.
"""
 seek(offset, whence=SEEK_SET)

Change the stream position to the given offset. Behaviour depends on
the whence parameter. The default value for whence is SEEK_SET.

SEEK_SET or 0: seek from the start of the stream (the default);
offset must either be a number returned by TextIOBase.tell(), or zero. Any
other offset value produces undefined behaviour.

SEEK_CUR or 1: “seek” to the current position; offset must be zero,
which is a no-operation (all other values are unsupported).

SEEK_END or 2: seek to the end of the stream; offset must be zero
(all other values are unsupported).
"""

EMPHASIS: "offset must either be a number returned by TextIOBase.tell(), or
zero." 

TEXT I/O, with a specified encoding, will return Unicode data points,
and will handle converting line ending to the internal ( represents
new-line) format.

Since your code does not specify BINARY mode in the open statement,
Python should be using TEXT mode.



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: tail

2022-05-07 Thread Dennis Lee Bieber
On Sat, 7 May 2022 20:35:34 +0200, Marco Sulla
 declaimed the following:

>Well, ok, but I need a generic method to get LF and CR for any
>encoding an user can input.

Other than EBCDIC,  and  AS BYTES should appear as x0A and x0D
in any of the 8-bit encodings (ASCII, ISO-8859-x, CP, UTF-8). I believe
those bytes also appear in UTF-16 -- BUT, they will have a null (x00) byte
associated with them as padding; as a result, you can not search for just
x0Dx0A (Windows line end convention -- they may be x00x0Dx00x0A or
x0Dx00x0Ax00 depending on endianness cf:
https://docs.microsoft.com/en-us/cpp/text/support-for-unicode?view=msvc-170
)

For EBCDIC  is still x0D, but  is x25 (and there is a separate
 [new line] at x15)


-- 
Wulfraed     Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: tail

2022-05-06 Thread Dennis Lee Bieber
On Fri, 6 May 2022 21:19:48 +0100, MRAB 
declaimed the following:

>Is the file UTF-8? That's a variable-width encoding, so are any of the 
>characters > U+007F?
>
>Which OS? On Windows, it's common/normal for UTF-8 files to start with a 
>BOM/signature, which is 3 bytes/1 codepoint.

Windows also uses  for the EOL marker, but Python's I/O system
condenses that to just  internally (for TEXT mode) -- so using the
length of a string so read to compute a file position may be off-by-one for
each EOL in the string.

https://docs.python.org/3/tutorial/inputoutput.html#reading-and-writing-files
"""
In text mode, the default when reading is to convert platform-specific line
endings (\n on Unix, \r\n on Windows) to just \n. When writing in text
mode, the default is to convert occurrences of \n back to platform-specific
line endings. This behind-the-scenes modification to file data is fine for
text files, but will corrupt binary data like that in JPEG or EXE files. Be
very careful to use binary mode when reading and writing such files.
"""



-- 
    Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fwd: Python Question re Executing a Script (dn)

2022-05-02 Thread Dennis Lee Bieber
ory -- Note that if you put it in the all-users
startup, you have to make sure that the script and shortcut themselves are
not in protected (single user) locations.

Using the task scheduler, you'd have similar constraints on
directories, but shouldn't need to create a shortcut file. Instead, you'd
specify the path to the interpreter and the path to the script as the task
ACTION, with the applicable start option as the TRIGGER.



-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Question re Executing a Script

2022-04-30 Thread Dennis Lee Bieber
On Sat, 30 Apr 2022 22:37:35 +, Brent Hunter 
declaimed the following:

>Hello,
>
>I just purchased a new Windows 11 computer and installed Python 3.10.4 (64 
>bit).  I can't figure out from your documentation, how do I:
>
>
>  1.  Run a python script that is located in the same directory ( 
> C:\Users\Brent\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 
> 3.10 )
>

ONE: that path indicates that you installed Python "for current user
only".

TWO: that is the path for the short cut entry that shows up on the
Windows "Start Menu" (whatever that looks like on Win11). It is NOT a
location for user scripts.

Python, at heart, is a language interpreter that is invoked from a
command line shell. (Use  to exit the interpreter if you are trying
the below examples -- otherwise you'd add the path/name of the script file
to the command line)

-=-=-
Microsoft Windows [Version 10.0.19044.1645]
(c) Microsoft Corporation. All rights reserved.

C:\Users\Wulfraed>python
Python ActivePython 3.8.2 (ActiveState Software Inc.) based on
 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

C:\Users\Wulfraed>py
Python ActivePython 3.8.2 (ActiveState Software Inc.) based on
 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

C:\Users\Wulfraed>
-=-=-

It can run from scripts invoked by double-clicking on the file in the
"file explorer" but often the results are not as desired (it will pop up a
console window -- but that window closes as soon as the script exits!).
Scripts written using one of the graphical libraries (Tkinter, wxPython,
etc.) are typically given a .pyw extension -- .pyw is normally associated
with an alternate start-up module which suppresses the console window.

Editing of scripts can be done with one's favorite programming text
editor. If one can't live without having some sort of IDE, look for
something called IDLE to be on your start menu (IDLE is actually a Python
script using Tkinter).

>
>  1.  How do I automatically run a python app at Windows startup?

Short answer: the same way you would run ANY application at start-up. 

Longer answer: this is a feature of the OS, not Python. You will need
to learn how to use the OS. Maybe start with
https://www.google.com/search?q=run+application+at+startup+windows+11=hp=t1htYpm0K5OtqtsPiMKMwAc=AJiK0e8AYm1mx0aL7YbWlEj0j-yPiL8J4H8HFoxo=0ahUKEwjZ6-T3j7z3AhWTlmoFHQghA3gQ4dUDCAk=5=run+application+at+startup+windows+11_lcp=Cgdnd3Mtd2l6EAMyBQghEKsCMgUIIRCrAjIFCCEQqwIyCAghEBYQHRAeOgUIABCABDoOCC4QgAQQsQMQgwEQ1AI6CAgAEIAEELEDOhEILhCABBCxAxCDARDHARDRAzoICC4QgAQQsQM6CwgAEIAEELEDEIMBOggILhCxAxCDAToFCC4QgAQ6EQguEIAEELEDEIMBEMcBEKMCOgsILhCABBDHARCjAjoICC4QgAQQ1AI6CwguEIAEELEDEIMBOgsILhCABBCxAxDUAjoOCC4QsQMQgwEQxwEQowI6DgguEIAEELEDEMcBENEDOg4ILhCABBCxAxCDARDJAzoICAAQsQMQgwE6BwgAEIAEEAo6CAgAEIAEEMkDOgYIABAWEB46BQgAEIYDUL0NWNRZYO9caAFwAHgBgAHYAYgBpx6SAQcyNC4xMi4xmAEAoAEBsAEA=gws-wiz

>
>Thank you!
>
>Brent Hunter


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   3   >