[Python-announce] txtorcon 23.5.0

2023-05-18 Thread meejah


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

I'm happy to announce txtorcon 23.5.0 with the following changes:

  * twisted.web.client.Agent instances now use the same HTTPS policy
by default as twisted.web.client.Agent.  It is possible to
override this policy with the tls_context_factory= argument, the
equivalent to Agent's contextFactory=
(Thanks to Itamar Turner-Trauring)
  * Added support + testing for Python 3.11.
  * No more ipaddress dependency

You can download the release from PyPI or GitHub (or of
course "pip install txtorcon"):

  https://pypi.python.org/pypi/txtorcon/23.5.0
  https://github.com/meejah/txtorcon/releases/tag/v23.5.0

Releases are also available from the hidden service:

  
http://fjblvrw2jrxnhtg67qpbzi45r7ofojaoo3orzykesly2j3c2m3htapid.onion/txtorcon-23.5.0.tar.gz
  
http://fjblvrw2jrxnhtg67qpbzi45r7ofojaoo3orzykesly2j3c2m3htapid.onion/txtorcon-23.5.0.tar.gz.asc

You can verify the sha256sum of both by running the following 4 lines
in a shell wherever you have the files downloaded:

cat 

txtorcon 23.5.0

2023-05-18 Thread meejah


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

I'm happy to announce txtorcon 23.5.0 with the following changes:

  * twisted.web.client.Agent instances now use the same HTTPS policy
by default as twisted.web.client.Agent.  It is possible to
override this policy with the tls_context_factory= argument, the
equivalent to Agent's contextFactory=
(Thanks to Itamar Turner-Trauring)
  * Added support + testing for Python 3.11.
  * No more ipaddress dependency

You can download the release from PyPI or GitHub (or of
course "pip install txtorcon"):

  https://pypi.python.org/pypi/txtorcon/23.5.0
  https://github.com/meejah/txtorcon/releases/tag/v23.5.0

Releases are also available from the hidden service:

  
http://fjblvrw2jrxnhtg67qpbzi45r7ofojaoo3orzykesly2j3c2m3htapid.onion/txtorcon-23.5.0.tar.gz
  
http://fjblvrw2jrxnhtg67qpbzi45r7ofojaoo3orzykesly2j3c2m3htapid.onion/txtorcon-23.5.0.tar.gz.asc

You can verify the sha256sum of both by running the following 4 lines
in a shell wherever you have the files downloaded:

cat 

Re: Tkinter (related)~

2023-05-18 Thread Grant Edwards
On 2023-05-19, Cameron Simpson  wrote:
> On 18May2023 12:06, Jack Dangler  wrote:
>>I thought the OP of the tkinter thread currently running may have 
>>needed to install the tkinter package (since I had the same missing 
>>component error message), so I tried to install the package on to my 
>>Ubu laptop -
>>
>>pip install tkinter
>>Defaulting to user installation because normal site-packages is not 
>>writeable
>>ERROR: Could not find a version that satisfies the requirement tkinter 
>>(from versions: none)
>>ERROR: No matching distribution found for tkinter
>>
>>Is there an alternate path to installing this?
>
> Usually tkinter ships with Python because it is part of the stdlib.
>
> On some platforms eg Ubuntu Linux the stdlib doesn't come in completely 
> unless you ask - a lot of stdlib packages are apt things you need to ask 
> for. On my Ubunut here tkinter comes from python3-tk. So:
>
>  $ sudo apt-get install python3-tk

And in general, on Linux systems, you'll be better off in the long run
if you use the distro's package manager to install Python packages
instead of using pip. If there is no distro package, you're usually
also better off using 'pip install --user' so that pip isn't messing
about with directories that are normally managed by the distro's
package manager.

When I do have to resort to using pip in install something, I always
do a --dry-run first and make a note of any dependancies that pip is
going to try to install -- so I can install those using the package
manager if possible.

--
Grant

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


Re: Tkinter (related)~

2023-05-18 Thread Cameron Simpson

On 18May2023 12:06, Jack Dangler  wrote:
I thought the OP of the tkinter thread currently running may have 
needed to install the tkinter package (since I had the same missing 
component error message), so I tried to install the package on to my 
Ubu laptop -


pip install tkinter
Defaulting to user installation because normal site-packages is not 
writeable
ERROR: Could not find a version that satisfies the requirement tkinter 
(from versions: none)

ERROR: No matching distribution found for tkinter

Is there an alternate path to installing this?


Usually tkinter ships with Python because it is part of the stdlib.

On some platforms eg Ubuntu Linux the stdlib doesn't come in completely 
unless you ask - a lot of stdlib packages are apt things you need to ask 
for. On my Ubunut here tkinter comes from python3-tk. So:


$ sudo apt-get install python3-tk

Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Re: Learning tkinter

2023-05-18 Thread MRAB

On 2023-05-12 09:55, Rob Cliffe via Python-list wrote:

I am trying to learn tkinter.
Several examples on the internet refer to a messagebox class
(tkinter.messagebox).
But:

Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
  >>> import tkinter
  >>> tkinter.messagebox
Traceback (most recent call last):
    File "", line 1, in 
AttributeError: module 'tkinter' has no attribute 'messagebox'
  >>>

Why is this?


It's a submodule of tkinter:

>>> import tkinter.messagebox as mb
>>> mb.showinfo


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


Re: Tkinter (related)~

2023-05-18 Thread Jack Dangler



On 5/18/23 12:33, Mats Wichmann wrote:

On 5/18/23 10:06, Jack Dangler wrote:

I didn't want to hijack another thread...

I thought the OP of the tkinter thread currently running may have 
needed to install the tkinter package (since I had the same missing 
component error message), so I tried to install the package on to my 
Ubu laptop -


install python3-tk to get the distro package.


Thanks, Mats! apt worked... I'll have another run at the original thread 
and see where that takes me.

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


Re: Learning tkinter

2023-05-18 Thread Mats Wichmann

On 5/18/23 08:50, Jim Schwartz wrote:

This works for me.  Hope it helps.

from tkinter import messagebox

messagebox.showerror("Hi", f"Hello World")


It's probably instructive that IDLE always brings it in this way.

Lib/idlelib/config_key.py:from tkinter import messagebox
Lib/idlelib/configdialog.py:from tkinter import messagebox
Lib/idlelib/editor.py:from tkinter import messagebox
... etc


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


Re: Tkinter (related)~

2023-05-18 Thread Mats Wichmann

On 5/18/23 10:06, Jack Dangler wrote:

I didn't want to hijack another thread...

I thought the OP of the tkinter thread currently running may have needed 
to install the tkinter package (since I had the same missing component 
error message), so I tried to install the package on to my Ubu laptop -


install python3-tk to get the distro package.


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


Tkinter (related)~

2023-05-18 Thread Jack Dangler

I didn't want to hijack another thread...

I thought the OP of the tkinter thread currently running may have needed 
to install the tkinter package (since I had the same missing component 
error message), so I tried to install the package on to my Ubu laptop -


pip install tkinter
Defaulting to user installation because normal site-packages is not 
writeable
ERROR: Could not find a version that satisfies the requirement tkinter 
(from versions: none)

ERROR: No matching distribution found for tkinter

Is there an alternate path to installing this?

Thanks for any help you can provide...

Jack

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


Re: Learning tkinter

2023-05-18 Thread Thomas Passin

On 5/18/2023 9:13 AM, Grant Edwards wrote:

On 2023-05-12, Rob Cliffe via Python-list  wrote:


Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import tkinter
tkinter.messagebox

Traceback (most recent call last):
    File "", line 1, in 
AttributeError: module 'tkinter' has no attribute 'messagebox'




$ python
Python 3.11.3 (main, May  8 2023, 09:00:54) [GCC 12.2.1 20230428] on linux
Type "help", "copyright", "credits" or "license" for more information.

import tkinter
from tkinter import messagebox
messagebox








Why is this?


Dunno.


tkinter is a package, messagebox is a module within the tkinter package. 
the messagebox module has some functions, such as showinfo(). You *can* 
import those functions using "dot" expressions:


>>> from tkinter.messagebox import showinfo


You can also import the entire module using the "dot" syntax:

>>> import tkinter.messagebox
>>> messagebox.showinfo


Whether you can directly ask for tkinter.messagebox depends on whether 
it's been defined or imported in tkinter/__init__.py.




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


Error installing packages or upgrading pip

2023-05-18 Thread Test Only
Hi there, I hope you are in a great health

I am having a problem with python even though I uninstall and reinstall it
again multiple times

the error I get when I try to upgrade or install a package for example

pip install requests

I get this error which I could not find a solution for



pip install requests
Requirement already satisfied: requests in
c:\users\uly\appdata\local\programs\python\python310\lib\site-packages\requests-2.30.0-py3.10.egg
(2.30.0)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProtocolError('Connection
aborted.', FileNotFoundError(2, 'No such file or directory'))':
/simple/charset-normalizer/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProtocolError('Connection
aborted.', FileNotFoundError(2, 'No such file or directory'))':
/simple/charset-normalizer/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProtocolError('Connection
aborted.', FileNotFoundError(2, 'No such file or directory'))':
/simple/charset-normalizer/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProtocolError('Connection
aborted.', FileNotFoundError(2, 'No such file or directory'))':
/simple/charset-normalizer/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProtocolError('Connection
aborted.', FileNotFoundError(2, 'No such file or directory'))':
/simple/charset-normalizer/
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProtocolError('Connection
aborted.', FileNotFoundError(2, 'No such file or directory'))':
/simple/requests/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProtocolError('Connection
aborted.', FileNotFoundError(2, 'No such file or directory'))':
/simple/requests/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProtocolError('Connection
aborted.', FileNotFoundError(2, 'No such file or directory'))':
/simple/requests/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProtocolError('Connection
aborted.', FileNotFoundError(2, 'No such file or directory'))':
/simple/requests/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None,
status=None)) after connection broken by 'ProtocolError('Connection
aborted.', FileNotFoundError(2, 'No such file or directory'))':
/simple/requests/
ERROR: Could not find a version that satisfies the requirement
charset_normalizer<4,>=2 (from requests) (from versions: none)
ERROR: No matching distribution found for charset_normalizer<4,>=2
WARNING: There was an error checking the latest version of pip.
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Learning tkinter

2023-05-18 Thread Jim Schwartz
This works for me.  Hope it helps.

from tkinter import messagebox

messagebox.showerror("Hi", f"Hello World")

-Original Message-
From: Python-list  On 
Behalf Of Rob Cliffe via Python-list
Sent: Friday, May 12, 2023 3:55 AM
To: Python 
Subject: Learning tkinter

I am trying to learn tkinter.
Several examples on the internet refer to a messagebox class 
(tkinter.messagebox).
But:

Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit 
(Intel)] on win32 Type "help", "copyright", "credits" or "license" for more 
information.
 >>> import tkinter
 >>> tkinter.messagebox
Traceback (most recent call last):
   File "", line 1, in 
AttributeError: module 'tkinter' has no attribute 'messagebox'
 >>>

Why is this?
TIA
Rob Cliffe
--
https://mail.python.org/mailman/listinfo/python-list

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


Re: Help on ImportError('Error: Reinit is forbidden')

2023-05-18 Thread Barry
 On 18 May 2023, at 13:56, Jason Qian  wrote:

 
 Hi Barry,
 void handleError(const char* msg)
 {
 ...
 PyErr_Fetch(, , );
 PyErr_NormalizeException(, , );

 PyObject* str_value = PyObject_Repr(pyExcValue);
 PyObject* pyExcValueStr = PyUnicode_AsEncodedString(str_value, "utf-8",
 "Error ~");
 const char *strErrValue = PyBytes_AS_STRING(pyExcValueStr);
 //where   strErrValue   = "ImportError('Error: Reinit is forbidden')"
 ...
 }
 What we imported is a Python file which import some pyd libraries.

   Please do not top post replies.
   Ok so assume the error is correct and hunt for the code that does the
   reimport.
   You may need to set break points in you C code to find tnw caller.
   Barry

 Thanks 
 Jason 
 On Thu, May 18, 2023 at 3:53 AM Barry <[1]ba...@barrys-emacs.org> wrote:

   > On 17 May 2023, at 20:35, Jason Qian via Python-list
   <[2]python-list@python.org> wrote:
   >
   >  Hi,
   >
   >   I Need some of your help.
   >
   > I have the following C code to import *Import python.*   It works
   99% of
   > the time, but sometimes  receives  "*ImportError('Error: Reinit is
   > forbidden')*". error.
   > **We run multiple instances of the app parallelly.
   >
   > *** Python version(3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51)
   [MSC
   > v.1914 64 bit (AMD64)]
   >
   > PyObject * importPythonModule(const char* pmodName)
   > {
   >    const char* errors = NULL;
   >     int nlen = strlen(pmodName);
   >     PyObject *pName = PyUnicode_DecodeUTF8(pmodName, nlen, errors);
   >     PyObject *pModule = *PyImport_Import*(pName);
   >     Py_DECREF(pName);
   >     if (pModule == NULL) {
   >     if (*PyErr_Occurred*()) {
   >            handleError("PyImport_Import()");
   >      }
   >   }
   > }
   > void handleError(const char* msg)
   > {
   >  ...
   >  "PyImport_Import() - ImportError('Error: Reinit is forbidden')"
   > }

   You do not seem to printing out msg, you have assumed it means reinit
   it seems.
   What does msg contain when it fails?

   Barry
   >
   >
   > Thanks
   > Jason
   > --
   > [3]https://mail.python.org/mailman/listinfo/python-list
   >

References

   Visible links
   1. mailto:ba...@barrys-emacs.org
   2. mailto:python-list@python.org
   3. https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Learning tkinter

2023-05-18 Thread Chris Angelico
On Thu, 18 May 2023 at 19:15, Rob Cliffe via Python-list
 wrote:
>
> I am trying to learn tkinter.
> Several examples on the internet refer to a messagebox class
> (tkinter.messagebox).
> But:
>
> Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import tkinter
>  >>> tkinter.messagebox
> Traceback (most recent call last):
>File "", line 1, in 
> AttributeError: module 'tkinter' has no attribute 'messagebox'
>  >>>
>
> Why is this?

Is it possible that you've created a tkinter.py for your own tinkering?

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


Re: Learning tkinter

2023-05-18 Thread Oscar Benjamin
On Thu, 18 May 2023 at 10:16, Rob Cliffe via Python-list
 wrote:
>
> I am trying to learn tkinter.
> Several examples on the internet refer to a messagebox class
> (tkinter.messagebox).
> But:
>
> Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import tkinter
>  >>> tkinter.messagebox
> Traceback (most recent call last):
>File "", line 1, in 
> AttributeError: module 'tkinter' has no attribute 'messagebox'
>  >>>
>
> Why is this?

Do you have a file called tkinter.py in the current directory?

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


Re: Learning tkinter

2023-05-18 Thread Grant Edwards
On 2023-05-12, Rob Cliffe via Python-list  wrote:
>
> Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import tkinter
> >>> tkinter.messagebox
> Traceback (most recent call last):
>    File "", line 1, in 
> AttributeError: module 'tkinter' has no attribute 'messagebox'
> >>>

$ python
Python 3.11.3 (main, May  8 2023, 09:00:54) [GCC 12.2.1 20230428] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> from tkinter import messagebox
>>> messagebox

>>> 


> Why is this?

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


Re: Help on ImportError('Error: Reinit is forbidden')

2023-05-18 Thread Jason Qian via Python-list
Hi Barry,

void handleError(const char* msg)
{
...
PyErr_Fetch(, , );
PyErr_NormalizeException(, , );

PyObject* str_value = PyObject_Repr(pyExcValue);
PyObject* pyExcValueStr = PyUnicode_AsEncodedString(str_value, "utf-8",
"Error ~");
const char **strErrValue* = PyBytes_AS_STRING(pyExcValueStr);

//where   *strErrValue*   = "ImportError('Error: Reinit is forbidden')"
...
}

What we imported is a Python file which import some pyd libraries.


Thanks
Jason


On Thu, May 18, 2023 at 3:53 AM Barry  wrote:

>
>
> > On 17 May 2023, at 20:35, Jason Qian via Python-list <
> python-list@python.org> wrote:
> >
> >  Hi,
> >
> >   I Need some of your help.
> >
> > I have the following C code to import *Import python.*   It works 99% of
> > the time, but sometimes  receives  "*ImportError('Error: Reinit is
> > forbidden')*". error.
> > **We run multiple instances of the app parallelly.
> >
> > *** Python version(3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC
> > v.1914 64 bit (AMD64)]
> >
> > PyObject * importPythonModule(const char* pmodName)
> > {
> >const char* errors = NULL;
> > int nlen = strlen(pmodName);
> > PyObject *pName = PyUnicode_DecodeUTF8(pmodName, nlen, errors);
> > PyObject *pModule = *PyImport_Import*(pName);
> > Py_DECREF(pName);
> > if (pModule == NULL) {
> > if (*PyErr_Occurred*()) {
> >handleError("PyImport_Import()");
> >  }
> >   }
> > }
> > void handleError(const char* msg)
> > {
> >  ...
> >  "PyImport_Import() - ImportError('Error: Reinit is forbidden')"
> > }
>
> You do not seem to printing out msg, you have assumed it means reinit it
> seems.
> What does msg contain when it fails?
>
> Barry
> >
> >
> > Thanks
> > Jason
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Learning tkinter

2023-05-18 Thread Rob Cliffe via Python-list

I am trying to learn tkinter.
Several examples on the internet refer to a messagebox class 
(tkinter.messagebox).

But:

Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 
bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> tkinter.messagebox
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: module 'tkinter' has no attribute 'messagebox'
>>>

Why is this?
TIA
Rob Cliffe
--
https://mail.python.org/mailman/listinfo/python-list


[Python-announce] JumpTheGun 0.0.9

2023-05-18 Thread Tal Einat
Make Python CLI tools win the speed race, by cheating!

JumpTheGun makes Python CLI tools start up much faster. For example, it can 
make the AWS CLI start up nearly 3x faster, making it near-instant.

# In any Python (>= 3.7) environment:
pip install jumpthegun
# or
pipx install jumpthegun

# For any CLI tool written in Python (>= 3.7):
jumpthegun run  [...]

# Examples:
jumpthegun run black --check .
jumpthegun run aws --version

# More details:
jumpthegun --help

https://github.com/taleinat/jumpthegun

Enjoy snappier tools!
- Tal Einat
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


Re: Help on ImportError('Error: Reinit is forbidden')

2023-05-18 Thread Barry


> On 17 May 2023, at 20:35, Jason Qian via Python-list  
> wrote:
> 
>  Hi,
> 
>   I Need some of your help.
> 
> I have the following C code to import *Import python.*   It works 99% of
> the time, but sometimes  receives  "*ImportError('Error: Reinit is
> forbidden')*". error.
> **We run multiple instances of the app parallelly.
> 
> *** Python version(3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC
> v.1914 64 bit (AMD64)]
> 
> PyObject * importPythonModule(const char* pmodName)
> {
>const char* errors = NULL;
> int nlen = strlen(pmodName);
> PyObject *pName = PyUnicode_DecodeUTF8(pmodName, nlen, errors);
> PyObject *pModule = *PyImport_Import*(pName);
> Py_DECREF(pName);
> if (pModule == NULL) {
> if (*PyErr_Occurred*()) {
>handleError("PyImport_Import()");
>  }
>   }
> }
> void handleError(const char* msg)
> {
>  ...
>  "PyImport_Import() - ImportError('Error: Reinit is forbidden')"
> }

You do not seem to printing out msg, you have assumed it means reinit it seems.
What does msg contain when it fails?

Barry
> 
> 
> Thanks
> Jason
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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