Threading issue?

826 views
Skip to first unread message

Dave Pawson

unread,
Feb 5, 2017, 7:17:00 AM2/5/17
to python-gnupg
Using python-gnupg on Python3.

Hangs, only cleared with ^c

 File "/usr/lib/python3.5/site-packages/gnupg.py", line 1254, in search_keys
    self._collect_output(p, result, stdin=p.stdin)
  File "/usr/lib/python3.5/site-packages/gnupg.py", line 898, in _collect_output
    dr.join()
  File "/usr/lib64/python3.5/threading.py", line 1054, in join
    self._wait_for_tstate_lock()
  File "/usr/lib64/python3.5/threading.py", line 1070, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
KeyboardInterrupt


Seems to relate?

Related code is

encrypted_ascii_data = gpg.encrypt(data,
                                   symmetric=True,
                                   passphrase=secret,
                                   sign=True,
                                   recipients=None) 

data is  a simple string
passphrase obtained from console.

Having locked up, it seems to remain locked. 

Suggestions please. 

Vinay Sajip

unread,
Feb 5, 2017, 7:48:31 AM2/5/17
to python-gnupg
Dear Dave,

Does it work if you don't pass sign=True? Also, what OS (looks like Linux), what version of GnuPG, what version of python-gnupg, which exact version of Python 3.5?

Regards,

Vinay Sajip

Dave Pawson

unread,
Feb 5, 2017, 8:06:28 AM2/5/17
to python-gnupg
No - still hangs with sign=False.
on Linux, Fedora 25, 64 bit.

Vinay Sajip

unread,
Feb 5, 2017, 11:14:44 AM2/5/17
to python-gnupg
Dear Dave,

Sorry, which version of GnuPG and python-gnupg? Can you try the test_gnupg.py which comes with the source distribution and see if that runs OK on your system?

Regards,

Vinay Sajip

Dave Pawson

unread,
Feb 5, 2017, 3:09:23 PM2/5/17
to python...@googlegroups.com
gpg --version
gpg (GnuPG) 1.4.21
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

On 5 February 2017 at 16:14, 'Vinay Sajip' via python-gnupg
<python...@googlegroups.com> wrote:
> Dear Dave,
>
> Sorry, which version of GnuPG and python-gnupg? Can you try the
> test_gnupg.py which comes with the source distribution and see if that runs
> OK on your system?


How to run the test?

# updatedb
[root@localhost ~]# locate test_gnupg.py
[root@localhost ~]#


Where is test_gnupg.py please?

Dave
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "python-gnupg" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/python-gnupg/oAWsH77zoAg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> python-gnupg...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk

Dave Pawson

unread,
Feb 5, 2017, 3:18:12 PM2/5/17
to python...@googlegroups.com
No such file?

# pip install python-gnupg
Requirement already satisfied: python-gnupg in /usr/lib/python3.5/site-packages
[root@localhost ~]# find /usr/lib/python3.5 -name test_gnupg.py
[root@localhost ~]#

so it is not with the installation.

/usr/lib/python3.5/site-packages/python_gnupg-0.4.0.dist-info/

shows

Metadata-Version: 1.1
Name: python-gnupg
Version: 0.4.0
Summary: A wrapper for the Gnu Privacy Guard (GPG or GnuPG)

# pip show python-gnupg
Name: python-gnupg
Version: 0.4.0
Summary: A wrapper for the Gnu Privacy Guard (GPG or GnuPG)
Home-page: None
Author: None
Author-email: None
License: None
Location: /usr/lib/python3.5/site-packages
Requires:


regards

On 5 February 2017 at 16:14, 'Vinay Sajip' via python-gnupg
<python...@googlegroups.com> wrote:

Vinay Sajip

unread,
Feb 5, 2017, 5:09:47 PM2/5/17
to python...@googlegroups.com
Dear Dave,

Download the source archive from PyPI and unpack it. You can get it, along with md5 hash and GPG signature, from

https://pypi.python.org/pypi/python-gnupg

Regards,

Vinay Sajip

N.B. You appear to be logged in as root and are installing packages into system Python locations. This is generally regarded as bad practice. You should be using a venv (virtual environment), unless you have a good reason for doing otherwise.
You received this message because you are subscribed to the Google Groups "python-gnupg" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-gnupg...@googlegroups.com.

Dave Pawson

unread,
Feb 6, 2017, 2:33:58 AM2/6/17
to python...@googlegroups.com
On 5 February 2017 at 22:09, 'Vinay Sajip' via python-gnupg
<python...@googlegroups.com> wrote:
> Dear Dave,
>
> Download the source archive from PyPI and unpack it. You can get it, along with md5 hash and GPG signature, from
>
> https://pypi.python.org/pypi/python-gnupg

Why? Is it a newer version?
When do you let Fedora know?



> N.B. You appear to be logged in as root and are installing packages into system Python locations. This is generally regarded as bad practice. You should be using a venv (virtual environment), unless you have a good reason for doing otherwise.

So for every app I set up a new environment? Sounds crazy to me, is there
any good reason to use venv?
I want all my apps available to all users, hence I install as root.
Again, is there any reason not to?

Confused with the reasoning?

regards

Dave Pawson

unread,
Feb 6, 2017, 2:46:21 AM2/6/17
to python...@googlegroups.com
On 5 February 2017 at 22:09, 'Vinay Sajip' via python-gnupg
<python...@googlegroups.com> wrote:
> Dear Dave,
>
> Download the source archive from PyPI and unpack it. You can get it, along with md5 hash and GPG signature, from
>
> https://pypi.python.org/pypi/python-gnupg

Downloaded.

> pip install python_gnupg-0.4.0-py2.py3-none-any.wl
Requirement already satisfied: python-gnupg==0.4.0 from
file:///apps/py/python_gnupg-0.4.0-py2.py3-none-any.whl in
/usr/lib/python3.5/site-packages


So it seems I have the same version as that on pypi

Vinay Sajip

unread,
Feb 6, 2017, 7:23:56 AM2/6/17
to python...@googlegroups.com
Dear Dave,

Please Google for why you should use venvs and not install packages from PyPI into your system site-packages. There should be a distro version of python-gnupg you can use, and can use dnf to install that.

I am unable to reproduce the problem on a fresh Fedora 25 64-bit machine with PyPI's python-gnupg installed into a venv.

I have updated the BitBucket issue.

Regards,

Vinay Sajip
Reply all
Reply to author
Forward
0 new messages