Error unclear when TCP port is not an integer

Bug #526910 reported by Geert JM Vanderkelen
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Connector/Python
Confirmed
Low
Geert JM Vanderkelen

Bug Description

Hi,

I am just 1 day old with python. I use Bash for doing most of the scripting. Thought of giving python a try. I installed mysql.connector module and I used the code posted in http://geert.vanderkelen.org/2009/09/how-to-install-mysql-connectorpython.html for MySQL connection just for the start. The following the code.

#!/usr/bin/python
import mysql.connector

if __name__ == "__main__":
    db = mysql.connector.Connect(host="192.168.0.2",user="kurianmt",password="reiper",database="test",port="3307")
    cursor = db.cursor()
    cursor.execute("SHOW ENGINES")

    for row in cursor.fetchall():
       print row

    cursor.close()
    db.close()

When I run the script, its giving me error.

$ ./3.py
Traceback (most recent call last):
  File "./3.py", line 5, in <module>
    db = mysql.connector.Connect(host="192.168.0.2",user="kurianmt",password="reiper",database="test",port="3307")
  File "/usr/lib/python2.6/site-packages/mysql/connector/__init__.py", line 45, in Connect
    return MySQL(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/mysql/connector/mysql.py", line 324, in __init__
    self.connect(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/mysql/connector/mysql.py", line 425, in connect
    self._open_connection()
  File "/usr/lib/python2.6/site-packages/mysql/connector/mysql.py", line 98, in _open_connection
    self.conn.open_connection()
  File "/usr/lib/python2.6/site-packages/mysql/connector/connection.py", line 167, in open_connection
    raise errors.InterfaceError('%s' % e)
mysql.connector.errors.InterfaceError: -1: an integer is required

I am sure that I am missing something here. Would appreciate if you can point me out what I am doing wrong here. Thanks in advance.

Regards,

Kurian Thayil.

Revision history for this message
Geert JM Vanderkelen (geertjmvdk) wrote :

port="3307" must be port=3307

The error message is not clear enough. I'll see if we can handle this better.

Changed in myconnpy:
assignee: nobody → Geert JM Vanderkelen (geertjmvdk)
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Geert JM Vanderkelen (geertjmvdk) wrote :

Smaller test case:

>>> import mysql.connector as my
>>> cnx = my.connect(port="3306")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.6/site-packages/mysql/connector/__init__.py", line 45, in Connect
    return MySQL(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/mysql/connector/mysql.py", line 324, in __init__
    self.connect(*args, **kwargs)
  File "/Library/Python/2.6/site-packages/mysql/connector/mysql.py", line 425, in connect
    self._open_connection()
  File "/Library/Python/2.6/site-packages/mysql/connector/mysql.py", line 98, in _open_connection
    self.conn.open_connection()
  File "/Library/Python/2.6/site-packages/mysql/connector/connection.py", line 167, in open_connection
    raise errors.InterfaceError('%s' % e)
mysql.connector.errors.InterfaceError: -1: an integer is required

Revision history for this message
Geert JM Vanderkelen (geertjmvdk) wrote :

This bug was moved to http://bugs.mysql.com/bug.php?id= 64543

Please add comments or subscribe using the above URL.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.