MySQL connections

Jacob Kruger jacob at blindza.co.za
Thu Jan 15 03:13:14 EST 2015


Development machine is windows7 64 bit machine, now working with either/both python 2.7 or 3.4 - test purposes, trying to figure out if this was something like a version incompatibility issue, and tried using both XAMPP and WAMP MySQL server version 5.0.11 instances thus far.

Now, aside from all other issues relating to character encoding, etc., now down to, hopefully, final issue.

Side note is under python 2.7, I use pyodbc to gather data from .mdb file am using to test, but under python 3.4, I use pypyodbc for same functionality.

Now, current/actual issue is something can sort of duplicate using both MySQLdb version of mysqlclient, as well as pymysql using both python 2.7 and python 3.4, but, strange thing am trying to figure out is that even if just implement a connection object in interpreter of either version, retrieve an instance of a cursor object, and do various types of statement executions, no issues, and can then close connection, or cursor, or both, and all good/fine/well.

However, if implement similar code - down to just trying to open a connection, wait a few seconds, and then close it again, inside a function called from a prior function, in the class am implementing in a file called/executed from command line, then, the moment I try to close the connection, whether or not have done anything with it, that's when I get that python.exe has stopped working/responding error message popping up, and python bombs out.

Have no idea how to try track down actual source/cause of issue, since haven't found anything obvious in system event logs, nothing appearing in MySQL server logs that makes sense/appears relevant, and no matter if I try enclosing the connection open/close code inside try except code blocks, nothing happens there except that python just stops cooperating at all, and stops working.

Now did try making sure data execution prevention was turned on/off, and that if set to second mode then told it to ignore specific applications - added both python.exe, and the compiled version of my code to it's exemption list, but, no changes there.

This still operates fine on my other dev machine, but, would like to know why it's not operating on one specific machine.

Otherwise, will just have to tell guys that, sorry, will only be able to generate SQL script text files, and they'll have to stick to the final step of then executing those via MySQL console interface, or something, but, would really prefer to at the very least, figure/find out what's causing this mis-behaviour.

Thoughts/suggestions with regards to how to find out what is happening/what I'm doing/handling wrong/incorrectly?

The two current versions of the code - which work fine under interpreter of both versions of python are basically the following:

#pymysql version
import pymysql
cn = pymysql.connect("localhost", "root", "", "import_test")
time.sleep(5)
cn.close()

#MySQLdb version
import MySQLdb
cn = MySQLdb.connect("localhost", "root", "", "import_test")
time.sleep(5)
cn.close()
#end code

Stay well (away from this machine ;) )

Jacob Kruger
Blind Biker
Skype: BlindZA
"Roger Wilco wants to welcome you...to the space janitor's closet..."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20150115/70961bbe/attachment.html>


More information about the Python-list mailing list