SSL certificate not updating in Debian - python-2.7

I installed an SSL certificate few months ago and now it's expired. When I am trying to update it using
certbot renew
it give me a following error.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Processing /etc/letsencrypt/renewal/www.bureaubureau.dk.conf
Cert is due for renewal, auto-renewing...
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/init.py", line 859, in emit
msg = self.format(record)
File "/usr/lib/python2.7/dist-packages/certbot/coloredlogging.py", line 41, i n format
else super(StreamHandler, self).format(record))
File "/usr/lib/python2.7/logging/init.py", line 732, in format
return fmt.format(record)
File "/usr/lib/python2.7/logging/init.py", line 471, in format
record.message = record.getMessage()
File "/usr/lib/python2.7/logging/init.py", line 335, in getMessage
msg = msg % self.args
TypeError: _str__ returned non-string (type Error)
Logged from file renewal.py, line 420
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/handlers.py", line 76, in emit
if self.shouldRollover(record):
File "/usr/lib/python2.7/logging/handlers.py", line 156, in shouldRollover
msg = "%s\n" % self.format(record)
File "/usr/lib/python2.7/logging/init.py", line 732, in format
return fmt.format(record)
File "/usr/lib/python2.7/logging/init.py", line 471, in format
record.message = record.getMessage()
File "/usr/lib/python2.7/logging/init.py", line 335, in getMessage
msg = msg % self.args
TypeError: str returned non-string (type Error)
Logged from file renewal.py, line 420
Processing /etc/letsencrypt/renewal/bureaubureau.dk.conf
Cert is due for renewal, auto-renewing...
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/init.py", line 859, in emit
msg = self.format(record)
File "/usr/lib/python2.7/dist-packages/certbot/coloredlogging.py", line 41, i n format
else super(StreamHandler, self).format(record))
File "/usr/lib/python2.7/logging/init.py", line 732, in format
return fmt.format(record)
File "/usr/lib/python2.7/logging/init.py", line 471, in format
record.message = record.getMessage()
File "/usr/lib/python2.7/logging/init.py", line 335, in getMessage
msg = msg % self.args
TypeError: _str__ returned non-string (type Error)
Logged from file renewal.py, line 420
Traceback (most recent call last):
File "/usr/lib/python2.7/logging/handlers.py", line 76, in emit
if self.shouldRollover(record):
File "/usr/lib/python2.7/logging/handlers.py", line 156, in shouldRollover
msg = "%s\n" % self.format(record)
File "/usr/lib/python2.7/logging/init.py", line 732, in format
return fmt.format(record)
File "/usr/lib/python2.7/logging/init.py", line 471, in format
record.message = record.getMessage()
File "/usr/lib/python2.7/logging/init.py", line 335, in getMessage
msg = msg % self.args
TypeError: str returned non-string (type Error)
Logged from file renewal.py, line 420
All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/www.bureaubureau.dk/fullchain.pem (failure)
/etc/letsencrypt/live/bureaubureau.dk/fullchain.pem (failure)
2 renew failure(s), 0 parse failure(s)
I have gone through similar questions but nothing helped.
I also used
sudo -H pip install -U requests
I get the same response
Cleaning up...
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 290, in run
requirementset.preparefiles(finder, forcerootegginfo=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1097, in preparefiles
reqtoinstall, self.upgrade)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 194, in findrequirement
page = self.getpage(mainindexurl, req)
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 568, in _getpage
session=self.session,
File "/usr/lib/python2.7/dist-packages/pip/index.py", line 694, in getpage
req, link, "connection error: %s" % exc, url,
TypeError: _str__ returned non-string (type Error)
Storing debug log for failure in /root/.pip/pip.log

I finally solved it myself. The Debian 8 is deprecated and was not supported any more, so I upgraded my droplet to Debian 9 and upgraded all packages and certbot-auto and it fixed my problem.

Related

Python 2.6.6 When I get html Source from Website It gives Error

Python 2.6.6 When I get HTML Source from Website It gives Error but it works on 3 version
import urllib
link='https://www.bookabach.co.nz/baches-and-holiday-homes/view/38781/'
f=urllib.urlopen(link)
Error as:
Traceback (most recent call last): File "", line 1,
in
f=urllib.urlopen(link) File "E:\Python26\lib\urllib.py", line 86, in urlopen
return opener.open(url) File "E:\Python26\lib\urllib.py", line 207, in open
return getattr(self, name)(url) File "E:\Python26\lib\urllib.py", line 441, in open_https
h.endheaders() File "E:\Python26\lib\httplib.py", line 908, in endheaders
self._send_output() File "E:\Python26\lib\httplib.py", line 780, in _send_output
self.send(msg) File "E:\Python26\lib\httplib.py", line 739, in send
self.connect() File "E:\Python26\lib\httplib.py", line 1116, in connect
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file) File "E:\Python26\lib\ssl.py", line 338, in
wrap_socket
suppress_ragged_eofs=suppress_ragged_eofs) File "E:\Python26\lib\ssl.py", line 120, in init
self.do_handshake() File "E:\Python26\lib\ssl.py", line 279, in do_handshake
self._sslobj.do_handshake() IOError: [Errno socket error] [Errno 1] _ssl.c:490: error:1407742E:SSL
routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
You may just need to disable SSL verification as you're attempting to reach the site over HTTPS.
Similar issue solved here with urllib.

happybase hbase table.put command error?

I am trying to connect to hbase-1.2.6 from python code, is as:
import happybase
connection = happybase.Connection(host='localhost',port=16010)
table = connection.table('blogpost')
table.put('1', {'post:title': 'hello world1'})
I manually created the table-"blogpost" in hbase. I am using python-2.7 and happybase-1.1.0.
error log are as:
/usr/bin/python2.7 /home/spark/PycharmProjects/PySpark/hbase.py
Traceback (most recent call last):
File "/home/spark/PycharmProjects/PySpark/hbase.py", line 5, in <module>
table.put('1', {'post:title': 'hello world1'})
File "/usr/local/lib/python2.7/dist-packages/happybase/table.py", line 464, in put
batch.put(row, data)
File "/usr/local/lib/python2.7/dist-packages/happybase/batch.py", line 137, in __exit__
self.send()
File "/usr/local/lib/python2.7/dist-packages/happybase/batch.py", line 60, in send
self._table.connection.client.mutateRows(self._table.name, bms, {})
File "/usr/local/lib/python2.7/dist-packages/thriftpy/thrift.py", line 198, in _req
return self._recv(_api)
File "/usr/local/lib/python2.7/dist-packages/thriftpy/thrift.py", line 210, in _recv
fname, mtype, rseqid = self._iprot.read_message_begin()
File "thriftpy/protocol/cybin/cybin.pyx", line 439, in cybin.TCyBinaryProtocol.read_message_begin (thriftpy/protocol/cybin/cybin.c:6470)
cybin.ProtocolError: No protocol version header
thanks.
Process finished with exit code 1

Logging fail in Appengine

I'm trying to do some importing to a DB in App Store 1.9.26, in python 2.7.9, and to do so,I would like to get some logging so I can inspect some variables and have a look on whjt is happening
import logging
[...]
updateDueDate = '2016.3.15'
fmt ='%Y.%m.%d'
fechalinea = datetime.datetime.strptime(updateDueDate,fmt)
fecha_aviso = avisoDB.modificacion.due_date.strftime(fmt)
logging.error = ('Date Call= %s, Date DB= %s' %(fecha_aviso, fechalinea))
Which should be pretty straightforward, but its not working. I think I mess up my python instalation or something that has nothing to do with my code, since the output I get from the devserver is:
TypeError("'str' object is not callable",)
TypeError("'str' object is not callable",)
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 1302, in communicate
req.respond()
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 831, in respond
self.server.gateway(self).respond()
INFO 2015-11-22 16:44:48,554 module.py:809] default: "POST /admin/filemanager HTTP/1.1" 500 -
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 2115, in respond
response = self.req.server.wsgi_app(self.env, self.start_response)
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/wsgi_server.py", line 272, in __call__
return app(environ, start_response)
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/request_rewriter.py", line 314, in _rewriter_middleware
response_body = iter(application(environ, wrapped_start_response))
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/request_handler.py", line 154, in __call__
response = self.handle_normal_request(environ)
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/request_handler.py", line 184, in handle_normal_request
self._PYTHON_LIB_DIR)
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/runtime.py", line 152, in HandleRequest
error)
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 329, in HandleRequest
return WsgiRequest(environ, handler_name, url, post_data, error).Handle()
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 279, in Handle
logging.exception('')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 1609, in exception
error(msg, *args, **kwargs)
TypeError: 'str' object is not callable
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 1302, in communicate
req.respond()
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 831, in respond
self.server.gateway(self).respond()
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 2115, in respond
response = self.req.server.wsgi_app(self.env, self.start_response)
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/wsgi_server.py", line 272, in __call__
return app(environ, start_response)
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/request_rewriter.py", line 314, in _rewriter_middleware
response_body = iter(application(environ, wrapped_start_response))
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/request_handler.py", line 154, in __call__
response = self.handle_normal_request(environ)
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/python/request_handler.py", line 184, in handle_normal_request
self._PYTHON_LIB_DIR)
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/runtime.py", line 152, in HandleRequest
error)
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 329, in HandleRequest
return WsgiRequest(environ, handler_name, url, post_data, error).Handle()
File "/Applications/GoogleAppEngineLauncher 2.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 279, in Handle
logging.exception('')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.py", line 1609, in exception
error(msg, *args, **kwargs)
TypeError: 'str' object is not callable
INFO 2015-11-22 16:44:48,647 module.py:809] default: "GET /favicon.ico HTTP/1.1" 200 15086
Tried to upgrade python and GAE launcher, google for this problem, but with all the different options I get the same errors, and I'm pretty sure it has nothing to do with my code, but... any one has any idea on what is happening?
Thanks
logging.error = assigns the right-hand-side (in your case, a string) to attribute error of module logging, replacing its previous value (which was a function).
When any Python code (yours or in the SDK) later calls logging.error (which you've set to a string), of course it will produce TypeError("'str' object is not callable",)!
I think I mess up my python instalation
Yes you did, by assigning a string to logging.error.
or something that has nothing to do with my code
It has everything to do with your code -- it's your code that does the mistaken assigning!

Scrapy cannot handle bad headers properly [ScrapyHTTPPageGetter,client] Unhandled Error

Environment:
Scrapy 0.16.2
Twisted-12.2.0
python 2.7
macosx-10.6
Okey here is my problem:
I try to run
scrapy shell http://aaa.17domn.com/bt9/file.php/MERH77V.html
Error:
[ScrapyHTTPPageGetter,client] Unhandled Error
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-macosx-10.6-intel.egg/twisted/internet/selectreactor.py", line 150, in _doReadOrWrite
why = getattr(selectable, method)()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-macosx-10.6-intel.egg/twisted/internet/tcp.py", line 202, in doRead
return self._dataReceived(data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-macosx-10.6-intel.egg/twisted/internet/tcp.py", line 208, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-macosx-10.6-intel.egg/twisted/protocols/basic.py", line 564, in dataReceived
why = self.lineReceived(line)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Scrapy-0.16.2-py2.7.egg/scrapy/core/downloader/webclient.py", line 50, in lineReceived
return HTTPClient.lineReceived(self, line.rstrip())
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-macosx-10.6-intel.egg/twisted/web/http.py", line 450, in lineReceived
self.extractHeader(self._header)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-macosx-10.6-intel.egg/twisted/web/http.py", line 406, in extractHeader
key, val = header.split(':',1)
exceptions.ValueError: need more than 1 value to unpack
I found the solution from https://groups.google.com/forum/#!msg/scrapy-users/xFKo8ggzPxs/VXDl3CZ4V4cJ
They describe this is caused by twisted. Then I patched function extractHeader in /twisted/web/http.py from http://twistedmatrix.com/trac/ticket/2842. Its WORKS
BUT BUT, Hold on NOt yet!!!
I run another web
scrapy shell http://www1.wkdown.info/fs3/file.php/M994ATR.html
Error:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-macosx-10.6-intel.egg/twisted/internet/defer.py", line 551, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Scrapy-0.16.2-py2.7.egg/scrapy/core/downloader/webclient.py", line 122, in _build_response
status = int(self.status)
ValueError: invalid literal for int() with base 10: 'html'
I think something happen on response headers. Scrapy cannot handle it well.
Any idea?
Thank you!

Djangosphinx failed to read searchd response

The error is djangosphinx.models.SearchError: failed to read searchd response
(status=2613, ver=11825, len=775174445, read=75)
Does anyone know how to solve it?
root#haoran-Lenovo:~/wiscode/apps/question# python try.py
<SphinxQuerySet instance>
Traceback (most recent call last):
File "try.py", line 84, in <module>
print results[0]
File "/usr/local/lib/python2.6/dist-packages/django_sphinx-2.1.4-py2.6.egg/djangosphinx/models.py", line 266, in __getitem__
return self._get_data()[0]
File "/usr/local/lib/python2.6/dist-packages/django_sphinx-2.1.4-py2.6.egg/djangosphinx/models.py", line 400, in _get_data
self._result_cache = list(self._get_results())
File "/usr/local/lib/python2.6/dist-packages/django_sphinx-2.1.4-py2.6.egg/djangosphinx/models.py", line 526, in _get_results
results = self._get_sphinx_results()
File "/usr/local/lib/python2.6/dist-packages/django_sphinx-2.1.4-py2.6.egg/djangosphinx/models.py", line 513, in _get_sphinx_results
raise SearchError, client.GetLastError()
djangosphinx.models.SearchError: failed to read searchd response (status=2613, ver=11825, len=775174445, read=75)