Connection behind proxy - enthought

I have Enthought Canopy (version 1.2.0.1610) intalled on my system. I'm trying to login to the Enthought server. My system is Ubuntu 13.10 x64, and I'm behind a corporate proxy that uses NTLM authentication protocol. To access the Internet I'm using cntlm proxy server on my system. In the Enthought proxy settings I set up the proxy. And It passes test. But, when I try to login it does not login without any errors.
I run Canopy from command line to see if there is any error output, and I got following errors.
Traceback (most recent call last):
File "build/bdist.linux-x86_64/egg/canopy/package_manager/package_manager_service.py", line 667, in _locked
File "build/bdist.linux-x86_64/egg/canopy/package_manager/package_manager_service.py", line 383, in update_addon_index
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/site-packages/enstaller/enpkg.py", line 182, in reconnect
self._connect()
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/site-packages/enstaller/enpkg.py", line 187, in _connect
self.remote.connect(self.userpass)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/site-packages/enstaller/store/joined.py", line 11, in connect
repo.connect(auth)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/site-packages/enstaller/store/indexed.py", line 18, in connect
self._index = self.get_index()
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/site-packages/enstaller/store/indexed.py", line 100, in get_index
fp = self.get_data('index.json?pypi=true')
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/site-packages/enstaller/store/indexed.py", line 124, in get_data
return self.opener.open(request)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/urllib2.py", line 400, in open
response = self._open(req, data)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/urllib2.py", line 418, in _open
'_open', req)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/urllib2.py", line 378, in _call_chain
result = func(*args)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/urllib2.py", line 1215, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/urllib2.py", line 1174, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 958, in request
self._send_request(method, url, body, headers)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 992, in _send_request
self.endheaders(body)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 954, in endheaders
self._send_output(message_body)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 814, in _send_output
self.send(msg)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 776, in send
self.connect()
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 1160, in connect
self._tunnel()
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 741, in _tunnel
(version, code, message) = response._read_status()
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 371, in _read_status
raise BadStatusLine(line)
BadStatusLine: ''
''
Traceback (most recent call last):
File "build/bdist.linux-x86_64/egg/canopy/package_manager/package_manager_service.py", line 667, in _locked
File "build/bdist.linux-x86_64/egg/canopy/package_manager/package_manager_service.py", line 383, in update_addon_index
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/site-packages/enstaller/enpkg.py", line 182, in reconnect
self._connect()
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/site-packages/enstaller/enpkg.py", line 187, in _connect
self.remote.connect(self.userpass)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/site-packages/enstaller/store/joined.py", line 11, in connect
repo.connect(auth)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/site-packages/enstaller/store/indexed.py", line 18, in connect
self._index = self.get_index()
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/site-packages/enstaller/store/indexed.py", line 100, in get_index
fp = self.get_data('index.json?pypi=true')
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/site-packages/enstaller/store/indexed.py", line 124, in get_data
return self.opener.open(request)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/urllib2.py", line 400, in open
response = self._open(req, data)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/urllib2.py", line 418, in _open
'_open', req)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/urllib2.py", line 378, in _call_chain
result = func(*args)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/urllib2.py", line 1215, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/urllib2.py", line 1174, in do_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 958, in request
self._send_request(method, url, body, headers)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 992, in _send_request
self.endheaders(body)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 954, in endheaders
self._send_output(message_body)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 814, in _send_output
self.send(msg)
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 776, in send
self.connect()
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 1160, in connect
self._tunnel()
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 741, in _tunnel
(version, code, message) = response._read_status()
File "/opt/Canopy/appdata/canopy-1.2.0.1610.rh5-x86_64/lib/python2.7/httplib.py", line 371, in _read_status
raise BadStatusLine(line)
BadStatusLine: ''
I'll highly appreciate any help. Thank you...

Updated https://support.enthought.com/entries/23590213-Can-I-use-Canopy-Behind-a-Proxy-Firewall- to reflect the fact that NTLM proxy authentication is not yet supported. Apologies for the inconvenience.

Related

Error Running Apache Beam with python via Dataflow runner

Description
I am currently implementing a batch job with dataflow using apache beam, this works fine when i use direct runner. Changing this throws the below exception, not sure where the error is comming from.
Code Snippet
enter image description here
Error:
raceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/beam_mysql/connector/client.py", line 179, in enter
self.conn = mysql.connector.connect(**self._config)
File "/usr/local/lib/python3.9/site-packages/mysql/connector/pooling.py", line 286, in connect
return CMySQLConnection(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/mysql/connector/connection_cext.py", line 101, in init
self.connect(**kwargs)
File "/usr/local/lib/python3.9/site-packages/mysql/connector/abstracts.py", line 1095, in connect
self._open_connection()
File "/usr/local/lib/python3.9/site-packages/mysql/connector/connection_cext.py", line 268, in _open_connection
raise get_mysql_exception(
mysql.connector.errors.DatabaseError: 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:41849' (111)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py", line 284, in _execute
response = task()
File "/usr/local/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py", line 357, in
lambda: self.create_worker().do_instruction(request), request)
File "/usr/local/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py", line 597, in do_instruction
return getattr(self, request_type)(
File "/usr/local/lib/python3.9/site-packages/apache_beam/runners/worker/sdk_worker.py", line 635, in process_bundle
bundle_processor.process_bundle(instruction_id))
File "/usr/local/lib/python3.9/site-packages/apache_beam/runners/worker/bundle_processor.py", line 1003, in process_bundle
input_op_by_transform_id[element.transform_id].process_encoded(
File "/usr/local/lib/python3.9/site-packages/apache_beam/runners/worker/bundle_processor.py", line 227, in process_encoded
self.output(decoded_value)
File "apache_beam/runners/worker/operations.py", line 526, in apache_beam.runners.worker.operations.Operation.output
File "apache_beam/runners/worker/operations.py", line 528, in apache_beam.runners.worker.operations.Operation.output
File "apache_beam/runners/worker/operations.py", line 237, in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
File "apache_beam/runners/worker/operations.py", line 240, in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
File "apache_beam/runners/worker/operations.py", line 907, in apache_beam.runners.worker.operations.DoOperation.process
File "apache_beam/runners/worker/operations.py", line 908, in apache_beam.runners.worker.operations.DoOperation.process
File "apache_beam/runners/common.py", line 1419, in apache_beam.runners.common.DoFnRunner.process
File "apache_beam/runners/common.py", line 1491, in apache_beam.runners.common.DoFnRunner._reraise_augmented
File "apache_beam/runners/common.py", line 1417, in apache_beam.runners.common.DoFnRunner.process
File "apache_beam/runners/common.py", line 623, in apache_beam.runners.common.SimpleInvoker.invoke_process
File "apache_beam/runners/common.py", line 1581, in apache_beam.runners.common._OutputHandler.handle_process_outputs
File "apache_beam/runners/common.py", line 1694, in apache_beam.runners.common._OutputHandler._write_value_to_tag
File "apache_beam/runners/worker/operations.py", line 240, in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
File "apache_beam/runners/worker/operations.py", line 907, in apache_beam.runners.worker.operations.DoOperation.process
File "apache_beam/runners/worker/operations.py", line 908, in apache_beam.runners.worker.operations.DoOperation.process
File "apache_beam/runners/common.py", line 1419, in apache_beam.runners.common.DoFnRunner.process
File "apache_beam/runners/common.py", line 1491, in apache_beam.runners.common.DoFnRunner._reraise_augmented
File "apache_beam/runners/common.py", line 1417, in apache_beam.runners.common.DoFnRunner.process
File "apache_beam/runners/common.py", line 623, in apache_beam.runners.common.SimpleInvoker.invoke_process
File "apache_beam/runners/common.py", line 1581, in apache_beam.runners.common._OutputHandler.handle_process_outputs
File "apache_beam/runners/common.py", line 1694, in apache_beam.runners.common._OutputHandler._write_value_to_tag
File "apache_beam/runners/worker/operations.py", line 240, in apache_beam.runners.worker.operations.SingletonElementConsumerSet.receive
File "apache_beam/runners/worker/operations.py", line 907, in apache_beam.runners.worker.operations.DoOperation.process
File "apache_beam/runners/worker/operations.py", line 908, in apache_beam.runners.worker.operations.DoOperation.process
File "apache_beam/runners/common.py", line 1419, in apache_beam.runners.common.DoFnRunner.process
File "apache_beam/runners/common.py", line 1507, in apache_beam.runners.common.DoFnRunner._reraise_augmented
File "apache_beam/runners/common.py", line 1417, in apache_beam.runners.common.DoFnRunner.process
File "apache_beam/runners/common.py", line 623, in apache_beam.runners.common.SimpleInvoker.invoke_process
File "apache_beam/runners/common.py", line 1571, in apache_beam.runners.common._OutputHandler.handle_process_outputs
File "/usr/local/lib/python3.9/site-packages/apache_beam/runners/worker/bundle_processor.py", line 1454, in process
for part, size in self.restriction_provider.split_and_size(
File "/usr/local/lib/python3.9/site-packages/apache_beam/transforms/core.py", line 331, in split_and_size
for part in self.split(element, restriction):
File "/usr/local/lib/python3.9/site-packages/apache_beam/io/iobase.py", line 1641, in split
estimated_size = restriction.source().estimate_size()
File "/usr/local/lib/python3.9/site-packages/beam_mysql/connector/source.py", line 49, in estimate_size
return self._splitter.estimate_size()
File "/usr/local/lib/python3.9/site-packages/beam_mysql/connector/splitters.py", line 48, in estimate_size
return self.source.client.rough_counts_estimator(self.source.query)
File "/usr/local/lib/python3.9/site-packages/beam_mysql/connector/client.py", line 104, in rough_counts_estimator
with _MySQLConnection(self._config) as conn:
File "/usr/local/lib/python3.9/site-packages/beam_mysql/connector/client.py", line 182, in enter
raise MySQLClientError(f"Failed to connect mysql, Raise exception: {e}")
beam_mysql.connector.errors.MySQLClientError: Failed to connect mysql, Raise exception: 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:36247' (111) [while running 'ref_AppliedPTransform_Read-From-Mysql-Read-SDFBoundedSourceReader-ParDo-SDFBoundedSourceDoFn-_7/SplitWithSizing-ptransform-38']
You have a connection problem to MySql :
Your traceback indicates :
mysql.connector.errors.DatabaseError: 2003 (HY000): Can't connect to MySQL server on '127.0.0.1:41849'
https://dev.mysql.com/doc/refman/8.0/en/can-not-connect-to-server.html#:~:text=The%20error%20(2003)%20Can',one%20configured%20on%20the%20server.
Check your connection to your MySql server please and also the parameters passed by your Beam job.

yum update return ssl error on centos 5.8

I want to install a package by doing yum install on my centos 5.8 64, but it returns SSLError: unknow protocol.
I know centos 5.8 is ancient but at the state upgrading is not my option, yet.
This is the error:
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in ?
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 309, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 178, in main
result, resultmsgs = base.doCommands()
File "/usr/share/yum-cli/cli.py", line 345, in doCommands
self._getTs(needTsRemove)
File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 101, in _getTs
self._getTsInfo(remove_only)
File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 112, in _getTsInfo
pkgSack = self.pkgSack
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 662, in <lambda>
pkgSack = property(fget=lambda self: self._getSacks(),
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 502, in _getSacks
self.repos.populateSack(which=repos)
File "/usr/lib/python2.4/site-packages/yum/repos.py", line 260, in populateSack
sack.populate(repo, mdtype, callback, cacheonly)
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 168, in populate
if self._check_db_version(repo, mydbtype):
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 226, in _check_db_version
return repo._check_db_version(mdtype)
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1226, in _check_db_version
repoXML = self.repoXML
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1399, in <lambda>
repoXML = property(fget=lambda self: self._getRepoXML(),
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1391, in _getRepoXML
self._loadRepoXML(text=self)
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1381, in _loadRepoXML
return self._groupLoadRepoXML(text, ["primary"])
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1365, in _groupLoadRepoXML
if self._commonLoadRepoXML(text):
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1201, in _commonLoadRepoXML
result = self._getFileRepoXML(local, text)
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 974, in _getFileRepoXML
cache=self.http_caching == 'all')
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 811, in _getFile
http_headers=headers,
File "/usr/lib/python2.4/site-packages/urlgrabber/mirror.py", line 412, in urlgrab
return self._mirror_try(func, url, kw)
File "/usr/lib/python2.4/site-packages/urlgrabber/mirror.py", line 398, in _mirror_try
return func_ref( *(fullurl,), **kwargs )
File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 936, in urlgrab
return self._retry(opts, retryfunc, url, filename)
File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 854, in _retry
r = apply(func, (opts,) + args, {})
File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 922, in retryfunc
fo = URLGrabberFileObject(url, filename, opts)
File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 1010, in __init__
self._do_open()
File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 1093, in _do_open
fo, hdr = self._make_request(req, opener)
File "/usr/lib/python2.4/site-packages/urlgrabber/grabber.py", line 1202, in _make_request
fo = opener.open(req)
File "/usr/lib64/python2.4/urllib2.py", line 364, in open
response = meth(req, response)
File "/usr/lib64/python2.4/urllib2.py", line 471, in http_response
response = self.parent.error(
File "/usr/lib64/python2.4/urllib2.py", line 396, in error
result = self._call_chain(*args)
File "/usr/lib64/python2.4/urllib2.py", line 337, in _call_chain
result = func(*args)
File "/usr/lib64/python2.4/urllib2.py", line 565, in http_error_302
return self.parent.open(new)
File "/usr/lib64/python2.4/urllib2.py", line 358, in open
response = self._open(req, data)
File "/usr/lib64/python2.4/urllib2.py", line 376, in _open
'_open', req)
File "/usr/lib64/python2.4/urllib2.py", line 337, in _call_chain
result = func(*args)
File "/usr/lib64/python2.4/site-packages/M2Crypto/m2urllib2.py", line 82, in https_open
h.request(req.get_method(), req.get_selector(), req.data, headers)
File "/usr/lib64/python2.4/httplib.py", line 810, in request
self._send_request(method, url, body, headers)
File "/usr/lib64/python2.4/httplib.py", line 833, in _send_request
self.endheaders()
File "/usr/lib64/python2.4/httplib.py", line 804, in endheaders
self._send_output()
File "/usr/lib64/python2.4/httplib.py", line 685, in _send_output
self.send(msg)
File "/usr/lib64/python2.4/httplib.py", line 652, in send
self.connect()
File "/usr/lib64/python2.4/site-packages/M2Crypto/httpslib.py", line 47, in connect
self.sock.connect((self.host, self.port))
File "/usr/lib64/python2.4/site-packages/M2Crypto/SSL/Connection.py", line 174, in connect
ret = self.connect_ssl()
File "/usr/lib64/python2.4/site-packages/M2Crypto/SSL/Connection.py", line 167, in connect_ssl
return m2.ssl_connect(self.ssl, self._timeout)
M2Crypto.SSL.SSLError: unknown protocol
Doing yum update resulting the same error as above.
I have done upgrading openssl to OpenSSL 1.0.2a 19 Mar 2015 but the error still the same.
What would be the fix, so I am able to use yum to install package?
Thank You.
Older OS doesn't work with default /etc/yum.repos.d/CentOS-Base.repo file.
Some links suggest to use http://vault.centos.org/, however it redirects to https link internally which makes yum commands to fail with SSL error "M2Crypto.SSL.SSLError: unknown protocol".
After some research, it worked for me with below base URL (Here I am trying with 5.11 Cent OS version).
http://archive.kernel.org/centos-vault/5.11/
Maybe you can get the package you are looking for here:
https://vault.centos.org/5.8/
There are a few .iso images there that probably have the package you need. I see openssl rpm here but it's not the same version that you posted for:
https://vault.centos.org/5.8/os/SRPMS/

CERTIFICATE_VERIFY_FAILED error when trying to use Google's Assistant SDK with RPi 3

I am trying to use Google Assistant SDK for the Raspberry Pi 3. I managed to install everything correctly, and the date is perfectly correct. However, when I try to Authorize the Google Assistant SDK sample, I get the error described in the title. It can't verify the certificate.
When I use date, the result is Thu Jun 29 17:16:42 CST 2017, which is very much correct at the time I use it. I am located in Costa Rica.
This is the complete error output.
Traceback (most recent call last):
File "/home/pi/env/lib/python3.4/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/home/pi/env/lib/python3.4/site-packages/urllib3/connectionpool.py", line 345, in _make_request
self._validate_conn(conn)
File "/home/pi/env/lib/python3.4/site-packages/urllib3/connectionpool.py", line 844, in _validate_conn
conn.connect()
File "/home/pi/env/lib/python3.4/site-packages/urllib3/connection.py", line 326, in connect
ssl_context=context)
File "/home/pi/env/lib/python3.4/site-packages/urllib3/util/ssl_.py", line 325, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib/python3.4/ssl.py", line 364, in wrap_socket
_context=self)
File "/usr/lib/python3.4/ssl.py", line 577, in __init__
self.do_handshake()
File "/usr/lib/python3.4/ssl.py", line 804, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/env/lib/python3.4/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/home/pi/env/lib/python3.4/site-packages/urllib3/connectionpool.py", line 630, in urlopen
raise SSLError(e)
urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/env/bin/google-oauthlib-tool", line 11, in <module>
sys.exit(main())
File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/pi/env/lib/python3.4/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/pi/env/lib/python3.4/site-packages/google_auth_oauthlib/tool/__main__.py", line 106, in main
creds = flow.run_console()
File "/home/pi/env/lib/python3.4/site-packages/google_auth_oauthlib/flow.py", line 358, in run_console
self.fetch_token(code=code)
File "/home/pi/env/lib/python3.4/site-packages/google_auth_oauthlib/flow.py", line 235, in fetch_token
**kwargs)
File "/home/pi/env/lib/python3.4/site-packages/requests_oauthlib/oauth2_session.py", line 221, in fetch_token
verify=verify, proxies=proxies)
File "/home/pi/env/lib/python3.4/site-packages/requests/sessions.py", line 549, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/pi/env/lib/python3.4/site-packages/requests_oauthlib/oauth2_session.py", line 360, in request
headers=headers, data=data, **kwargs)
File "/home/pi/env/lib/python3.4/site-packages/requests/sessions.py", line 502, in request
resp = self.send(prep, **send_kwargs)
File "/home/pi/env/lib/python3.4/site-packages/requests/sessions.py", line 612, in send
r = adapter.send(request, **kwargs)
File "/home/pi/env/lib/python3.4/site-packages/requests/adapters.py", line 514, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)
I had the same problem. I found a guide saying the following dependencies are required. This fixed it for me.
sudo apt-get install portaudio19-dev libffi-dev libssl-dev

Flask Mail ConnectionResetError: [Errno 54] Connection reset by peer

I am following this basic tutorial from the link exactly:
https://www.tutorialspoint.com/flask/flask_mail.htm
Anyone know what cause this problem? I think it should be a common problem?
Is there any additional setting for flask mail?
Here is the full error msg:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1997, in __call__
return self.wsgi_app(environ, start_response)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/boxia/PycharmProjects/learn_flask/test.py", line 18, in index
mail.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask_mail.py", line 491, in send
with self.connect() as connection:
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask_mail.py", line 144, in __enter__
self.host = self.configure_host()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask_mail.py", line 156, in configure_host
host = smtplib.SMTP_SSL(self.mail.server, self.mail.port)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/smtplib.py", line 1029, in __init__
source_address)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/smtplib.py", line 251, in __init__
(code, msg) = self.connect(host, port)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/smtplib.py", line 335, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/smtplib.py", line 1037, in _get_socket
server_hostname=self._host)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 401, in wrap_socket
_context=self, _session=session)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 808, in __init__
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1061, in do_handshake
self._sslobj.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 683, in do_handshake
self._sslobj.do_handshake()

Python 3 SOCKSIPY Module prints error

I downloaded the socks.py file and placed it in the python lib folder. When I run this script:
import socks
import socket
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "localhost", 9150)
socket.socket = socks.socksocket
import requests
from bs4 import BeautifulSoup
url = 'http://www.google.ca'
r = requests.get(url)
soup = BeautifulSoup(r.content)
print (soup)
it sends an error like this:
Traceback (most recent call last):
File "/Users/Raphael/Desktop/whatsmyip.py", line 8, in <module>
r = requests.get(url)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/api.py", line 68, in get
return request('get', url, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/api.py", line 50, in request
response = session.request(method=method, url=url, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/adapters.py", line 370, in send
timeout=timeout
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 544, in urlopen
body=body, headers=headers)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py", line 349, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 1088, in request
self._send_request(method, url, body, headers)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 1126, in _send_request
self.endheaders(body)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 1084, in endheaders
self._send_output(message_body)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 922, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 857, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 155, in connect
conn = self._new_conn()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/packages/urllib3/connection.py", line 134, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/requests/packages/urllib3/util/connection.py", line 78, in create_connection
sock.connect(sa)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socks.py", line 369, in connect
self.__negotiatesocks5(destpair[0],destpair[1])
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socks.py", line 176, in __negotiatesocks5
self.sendall("\x05\x01\x00")
TypeError: 'str' does not support the buffer interface
Can someone help me? I do not know how to fix this.. No where explains what I need to do in this case. Thank you very much