MySQL Forums
Forum List  »  Connector/Python

Error: Failed parsing handshake; end byte not precent in buffer (-1)
Posted by: Beth Hartman
Date: October 10, 2012 11:42AM

Using Python 3.2 and the MYSQL Connector for Windows, I get this error attempting to connect to a specific database.

Ths code I'm using:

try:
	self.db = mysql.connector.connect(host='localhost', user='root',
	password='blah', database='env')
	self.db.autocommit = True
except mysql.connector.Error as e:
	print("\n\nError: "+e.msg+" ("+str(e.errno)+")")

Note that this exact code will connect just fine to a different dtabase, on the same server, with the same user and password.

I thought it might be because I was attempting to connect to two different databases, so I commented out the first (working) database connection entirely, and I'm still getting this error, so it seems to just have a problem with this specific database.

Also note the typo in the error message: 'precent'

In order to give you a stack trace, I took out the try/except:

 C:\Python32\lib\site-packages\mysql\connector\connection.py in connect(self=<mysql.connector.connection.MySQLConnection object>, **kwargs={'database': 'env', 'host': 'localhost', 'password': 'blah', 'user': 'root'})
    330 
    331         self.disconnect()
=>  332         self._open_connection()
    333         self._post_connection()
    334     
self = <mysql.connector.connection.MySQLConnection object>, self._open_connection = <bound method MySQLConnection._open_connection o...sql.connector.connection.MySQLConnection object>>

 C:\Python32\lib\site-packages\mysql\connector\connection.py in _open_connection(self=<mysql.connector.connection.MySQLConnection object>)
    291         self._socket = self._get_connection()
    292         self._socket.open_connection()
=>  293         self._do_handshake()
    294         if self._client_flags & ClientFlag.SSL:
    295             self._socket.set_ssl(self._ssl['ca'], self._ssl['cert'],
self = <mysql.connector.connection.MySQLConnection object>, self._do_handshake = <bound method MySQLConnection._do_handshake of <mysql.connector.connection.MySQLConnection object>>

 C:\Python32\lib\site-packages\mysql\connector\connection.py in _do_handshake(self=<mysql.connector.connection.MySQLConnection object>)
    121         except Exception as err:
    122             raise errors.InterfaceError(
=>  123                 'Failed parsing handshake; {}'.format(err))
    124 
    125         regex_ver = re.compile(b"^(\d{1,2})\.(\d{1,2})\.(\d{1,3})(.*)")
err undefined

InterfaceError: Failed parsing handshake; end byte not precent in buffer
      args = ()
      errno = -1
      msg = 'Failed parsing handshake; end byte not precent in buffer'
      sqlstate = None
      with_traceback = <built-in method with_traceback of InterfaceError object>

Options: ReplyQuote


Subject
Written By
Posted
Error: Failed parsing handshake; end byte not precent in buffer (-1)
October 10, 2012 11:42AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.