Details
-
Bug
-
Status: Open (View Workflow)
-
Trivial
-
Resolution: Unresolved
-
1.1.13
-
None
-
mysql-connector-python 9.5.0 in python 3.13.7 and 10.4.32-MariaDB on Windows 11
-
3.13.7
Description
When using the mariadb python connector, you may attempt to establish a connection with code such as:
connj = mariadb.connect(
user=jusername,
password=jpasswd,
host=jhost,
port=int(jport),
database=jdbnam)
If you fail to present the "port" argument as an integer, but instead use a string, you may encounter a series of error messages similar to the following:
Traceback (most recent call last):
File "C:\Users\User\Documents\python\demo.py", line 70, in <module>
connj = mariadb.connect(
File "C:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\mariadb_init_.py", line 147, in connect
connection = connectionclass(*args, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python313\Lib\site-packages\mariadb\connections.py", line 85, in _init_
super()._init_(*args, **kwargs)
TypeError: 'str' object cannot be interpreted as an integer
In my humble opinion, it would be better if the software simply returned an error code "invalid port" or similar if the object supplied as the port argument could not be cast as an integer in the appropriate range.