Bug #91315 examples bugs
Submitted: 19 Jun 2018 11:49 Modified: 5 Jul 2018 7:19
Reporter: david pay Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / Python Severity:S3 (Non-critical)
Version:8.0.11 OS:Any
Assigned to: CPU Architecture:Any

[19 Jun 2018 11:49] david pay
Description:
In https://dev.mysql.com/doc/connector-python/en/connector-python-example-ddl.html,
there is 
"
try:
    cnx.database = DB_NAME  
except mysql.connector.Error as err:
    ...
" 
to handle exception.
But if you don't set use_pure=True, you can't catch the exception .
As i see, it's c extension, and used 
"from _mysql_connector import MySQLInterfaceError"
they are different Errors,  so the example won't work correctly.
 

How to repeat:
just copy the code, then it won't work.

Suggested fix:
combine them together or add comment not to confusing reader.
[5 Jul 2018 7:19] Chiranjeevi Battula
Hello david,

Thank you for the bug report.
Verified this behavior on Python 3.6 & MySQL Connector/Python 8.0.11.

Thanks,
Chiranjeevi.
[5 Jul 2018 18:32] Philip Olson
Posted by developer:
 
use_pure=true|false should have the same behavior, so changing this to a development bug