Re: how to discover what values produced an exception?

2024-05-03 Thread Thomas Passin via Python-list

On 5/3/2024 9:56 AM, Johanne Fairchild via Python-list wrote:

How to discover what values produced an exception?  Or perhaps---why
doesn't the Python traceback show the values involved in the TypeError?
For instance:

--8<>8---

(0,0) < 4

Traceback (most recent call last):
   File "", line 1, in 
TypeError: '<' not supported between instances of 'tuple' and 'int'
--8<>8---

It could have said something like:

--8<>8---
TypeError: '<' not supported between instances of 'tuple' and 'int'
   in (0,0) < 4.
--8<>8---

We would know which were the values that caused the problem, which would
be very helpful.


In this example it would not help at all to know the actual values. 
Knowing that you are trying to compare incomparable types is enough.


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


Re: Issues with uninstalling python versions on windows server

2024-05-03 Thread Barry via Python-list


> On 3 May 2024, at 17:43, Tripura Seersha via Python-list 
>  wrote:
> 
> Hi Team,
> 
> I am working on an automation related to uninstalling and installing python 
> versions on different windows servers.
> 
> I have observed that uninstallation is working only with the account/login 
> using which the python version is installed. But for automation, we are not 
> aware which account is being used for installation on different machines.

I would guess that this is because you installed for the user not for all-users.
If true fix your install to do it for all-users and you should be able to 
uninstall as any user.

But this will require admin privs for both install and uninstall. As assume you 
can find out how to bet the admin priv required for your automation.

Barry

> 
> Also, with the approach of using msiexec.exe to uninstall different 
> components of python version, though all the components are uninstalled 
> successfully but still an entry for this version shows in the control panel 
> with the options: Modify, repair and uninstall. I am unable to identify which 
> component has still remained as a part of the installer.
> 
> Could you please help me resolve these issues.
> 
> Thanks,
> Tripura
> --
> https://mail.python.org/mailman/listinfo/python-list
> 

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


how to discover what values produced an exception?

2024-05-03 Thread Johanne Fairchild via Python-list
How to discover what values produced an exception?  Or perhaps---why
doesn't the Python traceback show the values involved in the TypeError?
For instance:

--8<>8---
>>> (0,0) < 4
Traceback (most recent call last):
  File "", line 1, in 
TypeError: '<' not supported between instances of 'tuple' and 'int'
--8<>8---

It could have said something like: 

--8<>8---
TypeError: '<' not supported between instances of 'tuple' and 'int'
  in (0,0) < 4.
--8<>8---

We would know which were the values that caused the problem, which would
be very helpful.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Dialogs (Posting On Python-List Prohibited)

2024-05-03 Thread Alan Bawden via Python-list
Lawrence D'Oliveiro  writes:

   > Assume you have an expression "s.replace('a','b').replace('c','d').
   > replace('e','f').replace('g','h')". Its value is a string which
   > is the value of s, but with "a" replaced by "b", "c" replaced by
   > "d", "e" replaced by "f" and "g" replaced by "h". How to modify
   > this expression, so that "a", "c", "e", and "g", respectively,
   > are replaced only if they are words (but not parts of words)?

   import re

   replacements = (("a", "b"), ("c", "d"), ("e", "f"), ("g", "h"))

   text = "this be a test g eg"

   "".join \
 (
   repl.get(s, s)
   for repl in (dict(replacements),)
   for s in
   re.split("\\b(" + "|".join(re.escape(s[0]) for s in 
replacements) + ")\\b", text)
 )

How about just:

  repl = {
  "a" : "b",
  "c" : "d",
  "e" : "f",
  "g" : "h",
  }

  "".join(repl.get(s, s) for s in re.split(r"\b", text))

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


Re: Python Dialogs

2024-05-03 Thread Loris Bennett via Python-list
r...@zedat.fu-berlin.de (Stefan Ram) writes:

>   Me (indented by 2) and the chatbot (flush left). Lines lengths > 72!

Is there a name for this kind of indentation, i.e. the stuff you are
writing not being flush left?  It is sort of contrary to
what I think of as "normal" indentation.  You seem to use it in all your
postings, too, which hurts my brain, but I guess that's my problem :-) 

[snip (40 lines)]

-- 
This signature is currently under constuction.
-- 
https://mail.python.org/mailman/listinfo/python-list


Issues with uninstalling python versions on windows server

2024-05-03 Thread Tripura Seersha via Python-list
Hi Team,

I am working on an automation related to uninstalling and installing python 
versions on different windows servers.

I have observed that uninstallation is working only with the account/login 
using which the python version is installed. But for automation, we are not 
aware which account is being used for installation on different machines.

Also, with the approach of using msiexec.exe to uninstall different components 
of python version, though all the components are uninstalled successfully but 
still an entry for this version shows in the control panel with the options: 
Modify, repair and uninstall. I am unable to identify which component has still 
remained as a part of the installer.

Could you please help me resolve these issues.

Thanks,
Tripura
-- 
https://mail.python.org/mailman/listinfo/python-list