Repository: certbot/certbot

Issue:
Squeeze unable to run letsencrypt; constantly stymied by dialog.UnableToRetrieveBackendVersion
I think this relates to the closed issue discussing a reduction (and/or dropping) of support for python dialog.  Either way, this problem is a bit odd -- letsencrypt certainly runs, but it drops the dialog version to stdout and dies.  It feels like a solveable bug and not an insurmountable melding of minds.

```
Using /usr/lib/python2.6/dist-packages
Finished processing dependencies for letsencrypt==0.1
root@vpn4:~/lets-encrypt-preview# letsencrypt
Version: 1.1-20100428
Traceback (most recent call last):
  File "/usr/local/bin/letsencrypt", line 9, in <module>
    load_entry_point('letsencrypt==0.1', 'console_scripts', 'letsencrypt')()
  File "/usr/local/lib/python2.6/dist-packages/letsencrypt-0.1-py2.6.egg/letsencrypt/scripts/main.py", line 117, in main
    logger.addHandler(log.DialogHandler())
  File "/usr/local/lib/python2.6/dist-packages/letsencrypt-0.1-py2.6.egg/letsencrypt/client/log.py", line 29, in __init__
    self.d = dialog.Dialog() if d is None else d
  File "/usr/local/lib/python2.6/dist-packages/python2_pythondialog-3.0.1-py2.6.egg/dialog.py", line 1366, in __init__
    self.backend_version())
  File "/usr/local/lib/python2.6/dist-packages/python2_pythondialog-3.0.1-py2.6.egg/dialog.py", line 2028, in backend_version
    "{1!r}".format(self._dialog_prg, output))
dialog.UnableToRetrieveBackendVersion
root@vpn4:~/lets-encrypt-preview# dialog
cdialog (ComeOn Dialog!) version 1.1-20100428
Copyright 2000-2007,2008 Thomas E. Dickey
```



Discussion:
Could you test it in the virtualenv rather than installing system-wide (as described in the installation instructions), please?

Does it work with Python 2.7?

My apologies, Python 2.6 is the latest for squeeze...

Ah, sorry, I should have more explicitly mentioned that I was just spinning up fresh digitalocean droplets to give these different approaches a try, but the python 2.6 dependency is what matters. :+1: 

Just to make it clear: we do support Python 2.6 (at least for now). So, I still wonder if the same "dialog problem" persists when exactly squeeze+py2.6+venv configuration is being used...

Sorry, I've got it wrong in #281, squeeze isn't working with or without virtualenv.  

Here's a quick run without the use of virtualenv (fresh debian 6.0 x64 machine):

```
root@2:~# letsencrypt -d 2.gp.gg
Version: 1.1-20100428
Traceback (most recent call last):
  File "/usr/local/bin/letsencrypt", line 9, in <module>
    load_entry_point('letsencrypt==0.1', 'console_scripts', 'letsencrypt')()
  File "/root/lets-encrypt-preview/letsencrypt/scripts/main.py", line 117, in main
    logger.addHandler(log.DialogHandler())
  File "/root/lets-encrypt-preview/letsencrypt/client/log.py", line 29, in __init__
    self.d = dialog.Dialog() if d is None else d
  File "/usr/local/lib/python2.6/dist-packages/dialog.py", line 1366, in __init__
    self.backend_version())
  File "/usr/local/lib/python2.6/dist-packages/dialog.py", line 2028, in backend_version
    "{1!r}".format(self._dialog_prg, output))
dialog.UnableToRetrieveBackendVersion
root@2:~# uname -a
Linux 2.gp.gg 2.6.32-5-amd64 #1 SMP Mon Sep 23 22:14:43 UTC 2013 x86_64 GNU/Linux
root@2:~# cat /etc/issue
Debian GNU/Linux 6.0 \n \l

root@2:~# python --version
Python 2.6.6
```

Here's a quick run using virtualenv:

```
Finished processing dependencies for letsencrypt==0.1
(venv)root@1:~/lets-encrypt-preview# letsencrypt -d 1.gp.gg
Version: 1.1-20100428
Traceback (most recent call last):
  File "/root/lets-encrypt-preview/venv/bin/letsencrypt", line 9, in <module>
    load_entry_point('letsencrypt==0.1', 'console_scripts', 'letsencrypt')()
  File "/root/lets-encrypt-preview/venv/lib/python2.6/site-packages/letsencrypt-0.1-py2.6.egg/letsencrypt/scripts/main.py", line 117, in main
    logger.addHandler(log.DialogHandler())
  File "/root/lets-encrypt-preview/venv/lib/python2.6/site-packages/letsencrypt-0.1-py2.6.egg/letsencrypt/client/log.py", line 29, in __init__
    self.d = dialog.Dialog() if d is None else d
  File "/root/lets-encrypt-preview/venv/lib/python2.6/site-packages/python2_pythondialog-3.0.1-py2.6.egg/dialog.py", line 1366, in __init__
    self.backend_version())
  File "/root/lets-encrypt-preview/venv/lib/python2.6/site-packages/python2_pythondialog-3.0.1-py2.6.egg/dialog.py", line 2028, in backend_version
    "{1!r}".format(self._dialog_prg, output))
dialog.UnableToRetrieveBackendVersion
(venv)root@1:~/lets-encrypt-preview# uname -a
Linux 1.gp.gg 2.6.32-5-amd64 #1 SMP Mon Sep 23 22:14:43 UTC 2013 x86_64 GNU/Linux
(venv)root@1:~/lets-encrypt-preview# cat /etc/issue
Debian GNU/Linux 6.0 \n \l

(venv)root@1:~/lets-encrypt-preview# python --version
Python 2.6.6
```

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

While working on the Let's Encrypt [1] client we have hit the
following python2-pythondialog bug [2] on Debian squeeze (tested on
digitalocean droplet):

  (venv)root@le-squeeze:/tmp# pip install python2-pythondialog
  Downloading/unpacking python2-pythondialog
  Downloading python2-pythondialog-3.0.1.tar.bz2 (76Kb): 76Kb downloaded
  Running setup.py egg_info for package python2-pythondialog
  No .git directory, using the 'ChangeLog' file as is.
  Installing collected packages: python2-pythondialog
  Running setup.py install for python2-pythondialog
  No .git directory, using the 'ChangeLog' file as is.
  Successfully installed python2-pythondialog
  Cleaning up...
  (venv)root@le-squeeze:/tmp# python -c 'import dialog; dialog.Dialog()'
  Version: 1.1-20100428
  Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/venv/lib/python2.6/site-packages/dialog.py", line 1366, in **init**
  self.backend_version())
  File "/tmp/venv/lib/python2.6/site-packages/dialog.py", line 2028, in backend_version
  "{1!r}".format(self._dialog_prg, output))
  dialog.UnableToRetrieveBackendVersion

Please note that the version string is printed on the terminal. I have
checked (using pdb) that "output" on line 2028 is set to empty string:
''. More debug output:

  (venv)root@le-squeeze:/tmp# dialog --print-version 2>/dev/null
  Version: 1.1-20100428

We don't have this problem on neither Debian wheezy nor Ubuntu 14.04
nor Ubuntu 14.10.

BTW I wanted to use sourceforge bug tracker [3] to report this
problem, but it says: "To create a new ticket, you must be authorized
by the project admin.".

[1] https://letsencrypt.org
[2] https://github.com/letsencrypt/lets-encrypt-preview/issues/280
[3] http://sourceforge.net/p/pythondialog/bugs/

---

Your's virtually,
Jakub Warmuz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQJ8BAEBCgBmBQJVHR90XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRGMzBGQ0QzNkIzOTBBOTMwODc1OTAzREYy
QTdCQUQzQTQ4OUI1MkVBAAoJECp7rTpIm1LqSBIP/34LRqVn0Ij9Ieml07zYvpB/
ocVVCRMF/j7ghH/u1zDARNXstmPH3zN/teQW+GJpml6LTe248r519/6AJq/PcR8v
lIdODhrISp78ULuaNU12mvVkFABB5yiVUu9d8WH5wKL/30jn5vUBnp+ej59Ywfx9
7OTk8EcFhRLNBNCJHyxEMTLYuQqzkXxhHZE03o8B7JsK1NzCHwPB9XoDaOE0Nj3q
Zs3yVfHMiPIbUJDmXREgFdg7tqf2LC6DJYC9IhvIWFllJ0zfMvBNqarG9b1NGQha
q9H8Bsp+QFKRPOZhxmPrSuUFMvGNoKAMJh98kSLO4itq6TVEQ/KIm2t+6RAdKvwb
9jPZpSgJkqlLPbifQ4XNPp/jeDBzbPYsTB7Bzw6QZTA2mmRHjQKm+YDhAHuGvqix
X26qOXd9hua7gHzihQukldHBLzW7L13rLWZJsig6lv/oBlKKfQfb7OseUboqrZt1
SfFT8z00nS6bL6Jz2KU80efcF8Roq3Rv0DqQKjjzeTJA9CMl0gXB2zryFDv258le
qTZ+kFkz7W9cn8z3GSlIipXVNwj6nxEy3Biz3Hg9Rrb+c4Ma7fabvhssDeT/C5jd
mN0JhaB3VYcrYu2tqHamf2oTnfru9fYhlaAx1gWhYtoxj9b498CMkuKP/wvJZGn2
mqtB5o/h2YOQxX2YUMOn
=EHS8
-----END PGP SIGNATURE-----

Reported upstream: mail attached above, mailing list thread available at http://sourceforge.net/p/pythondialog/mailman/message/33691498/.

a45dab3 (#302) adds appropriate notes about squeeze installation.

Hello,

Thanks for your detailed report.

Jakub Warmuz jakub.warmuz@gmail.com wrote:

> While working on the Let's Encrypt [1] client we have hit the
> following python2-pythondialog bug [2] on Debian squeeze (tested on
> digitalocean droplet):

[...]

> Please note that the version string is printed on the terminal. I have
> checked (using pdb) that "output" on line 2028 is set to empty string:
> ''. More debug output:
> 
>   (venv)root@le-squeeze:/tmp# dialog --print-version 2>/dev/null
>   Version: 1.1-20100428

Yup, this must be the root of the problem. Normally, dialog prints the
version on stderr, but it seems that old or buggy versions print it on
stdout instead. The cleanest workaround would be to manage to tell
dialog to print the version on stderr. What is the output of the
following command on the affected system?

  dialog --print-version --stderr >/dev/null

> We don't have this problem on neither Debian wheezy nor Ubuntu 14.04
> nor Ubuntu 14.10.

OK.

> BTW I wanted to use sourceforge bug tracker [3] to report this
> problem, but it says: "To create a new ticket, you must be authorized
> by the project admin.".

Ah, thank you for reporting this! Silly permission problem for the
tracker. I thought it was working since there were a few bug reports in
it when I took over in 2013. Who knows how long it has been broken?..

Regards

## 

Florent

Hello again,

I have merged all changes from the master branch into the py2 branch.
This means that the Python 2 backport should now have all improvements
that were made to the reference implementation since version 3.0.1,
including the "autowidgetsize feature".

I have uploaded version 3.2.2rc1 for both Python 3 (tested with Python
3.1 and 3.4) and Python 2 (tested with Python 2.6 and 2.7). All these
work with dialog from Debian squeeze as well as unstable. Please test on
your side and report.

Regards

## 

Florent

On Sat, Apr 04, 2015 at 10:17:55PM +0200, Florent Rougon wrote:

> I have uploaded version 3.2.2rc1 for both Python 3 (tested with Python
> 3.1 and 3.4) and Python 2 (tested with Python 2.6 and 2.7). All these
> work with dialog from Debian squeeze as well as unstable. Please test on
> your side and report.

I did a quick test run of the letsencrypt client and I can now confirm
that the problem has been fixed and everything else seems to work
OK. Thank you for a very prompt response, great job!

People working on the "dialog" part of the project will probably want
to make some more thorough testing of this new RC as soon as the time
allows it.

## 

Kuba


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -38,7 +38,7 @@ def read_file(filename, encoding='utf8'):
     'PyOpenSSL',
     'pyrfc3339',
     'python-augeas',
-    'python2-pythondialog',
+    'python2-pythondialog>=3.2.2rc1',  # Debian squeeze support, cf. #280
     'pytz',
     'requests',
     'werkzeug',


Test patch: