Tag Archives: ‘gnutls_handshake() failed: An unexpected TLS packet was received.’)

[Solved] pycurl.error: (35, ‘gnutls_handshake() failed: An unexpected TLS packet was received.’)

Today, after using pycurl with a proxy, the following error occurred.

Traceback (most recent call last):
File “xici.py”, line 19, in <module>
c.perform()
pycurl.error: (35, ‘gnutls_handshake() failed: An unexpected TLS packet was received.’)

Solution:

Start by identifying the types of packages that your installation of pycurl depends on.

Visit to download the version you want to compile next, and download all three files inside

Place the three files in the pycurl_make file and start compiling and installing.

1. sudo apt-get install build-essential fakeroot dpkg-dev

2. mkdir ~/pycurl_make

3. cd ~/pycurl_make

4. sudo apt-get source python-pycurl

5. sudo apt-get build-dep python-pycurl

6. sudo apt-get install libcurl4-openssl-dev

7.sudo dpkg-source -x pycurl_7.43.0.1-0.2build2.dsc
8. cdpycurl-7.43.0.1

9. sed -i ‘s/libcurl4-gnutls-dev/libcurl4-openssl-dev/g’ debian/control

10. sudo dpkg-buildpackage -rfakeroot -b

11.sudo dpkg -i python3-pycurl_7.43.0.1-0.2build2_amd64.deb

Later in the view version.