Re: [OT] Re: MySQL connections
- Original Message - > functions. When was the last time those systems had Windows Update and reboots performed? Daily basis. Think, in line with your other message, will just try rewrite code - and, issue relating to structure etc. is left over from when pulled it out of wxPython implementation - you're right that should have just redone that part of it ;) Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." -- https://mail.python.org/mailman/listinfo/python-list
Re: MySQL connections
On 15/01/2015 16:40, Jacob Kruger wrote: If you want to check it out, have attached the full code file - might be a bit messy/large - but, effectively, right at bottom, launch an instance of the class a2m, passing through arguments, and then from within __init__ call convertProcess function, which then initiates process, harvesting sort of rendition/version of structure out of MS access database file, makes call to convertSQL to generate structural SQL script, and save it to a file, which then calls convertData function to generate insert statements to populate database, and then that makes a call to convertExport, if you passed a command line argument in requesting mysql, and that's the current issue function - have stripped most of actual functionality out of it, since am just testing, so the first 16 lines of that function are what's relevant at moment - think shouldn't rely on any other self. objects/attributes as such either, unless step-through process is an issue. Can you please provide us with a piece of code based on these guidelines http://sscce.org/ as I doubt that too many people are going to wade through the now deceased attachment. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Re: MySQL connections
- Original Message - From: "Dennis Lee Bieber" To: Sent: Thursday, January 15, 2015 4:22 PM Subject: Re: [OT] Re: MySQL connections On Thu, 15 Jan 2015 13:48:34 +0200, "Jacob Kruger" declaimed the following: Agree with that, but, like said in prior e-mail, just get windows error message popping up, mentioning - no track trace, since it's python terminating: Python is fairly good about dumping a stack trace when the error is something detectable by Python. Issue is it just kills python, so no error message from python being rendered/displayed. Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." -- https://mail.python.org/mailman/listinfo/python-list
Re: MySQL connections
- Original Message - From: "Chris Angelico" Cc: Sent: Thursday, January 15, 2015 2:33 PM Subject: Re: MySQL connections On Thu, Jan 15, 2015 at 10:59 PM, Jacob Kruger wrote: Tried generating .exe with both cx_freeze, and pyInstaller, and the code itself, and both versions of executable generate errors, same as running it from command line - only difference is the source of the error mentioned in error message then varies from a2m.exe and python.exe , and even if compile it on machine where all works, and then copy .exe back to this primary machine, then get same error - think it must relate to something else on this machine, but can't track it down. Okay. Ignore the .exe versions, and just work with what happens when you run the .py files. If it fails as part of a .py file, post the failing file. If you want to check it out, have attached the full code file - might be a bit messy/large - but, effectively, right at bottom, launch an instance of the class a2m, passing through arguments, and then from within __init__ call convertProcess function, which then initiates process, harvesting sort of rendition/version of structure out of MS access database file, makes call to convertSQL to generate structural SQL script, and save it to a file, which then calls convertData function to generate insert statements to populate database, and then that makes a call to convertExport, if you passed a command line argument in requesting mysql, and that's the current issue function - have stripped most of actual functionality out of it, since am just testing, so the first 16 lines of that function are what's relevant at moment - think shouldn't rely on any other self. objects/attributes as such either, unless step-through process is an issue. And, tried cleaning it up a bit - replaced tab indentation character with double spaces, but, code might not look perfect/be perfectly clean as of yet. Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." import pypyodbc, os, sys import copy, warnings import pymysql, time, pickle from unidecode import unidecode def sTimeDiffFormat(i_time1, i_time2): i_total_time = i_time2 - i_time1 if i_time2 > i_time1 else i_time1 - i_time2 i_total_time = int(i_total_time) #time.strftime("%H:%M:%S", time.gmtime(i_total_time)) i_hours = 0 i_minutes = 0 if i_total_time >= 3600: i_hours = int(i_total_time / 3600) i_total_time = i_total_time - (i_hours * 3600) if i_total_time > 60: i_minutes = int(i_total_time/60) i_total_time = i_total_time - (i_minutes * 60) s_out = "" if i_hours > 0: s_out = "{0} hours ".format(i_hours) if i_minutes > 0: s_out = s_out + "{0} minutes ".format(i_minutes) s_out = s_out + "{0} seconds".format(i_total_time) return s_out #end of sTimeDiffFormat class a2m(): s_mdb = "" s_mdb_pass = "" s_mdb_conn = "" bl_mdb_conn = False d_db_tables = {} cn_mdb = None s_structure_sql = "" d_db_data = {} l_field_types = [] s_target = "" s_target_value = "" s_sql_struct_file = "" s_sql_data_file = "" def __init__(self, s_mdb, s_mdb_pass, s_target, s_target_value): self.s_mdb = str(s_mdb) if len(str(s_mdb)) > 0 else "" self.s_mdb_pass = str(s_mdb_pass) if len(str(s_mdb_pass)) > 0 else "" if self.s_mdb_pass == "#": self.s_mdb_pass = "" self.s_target = str(s_target) if len(str(s_target))>0 else "" self.s_target_value = str(s_target_value) if len(str(s_target_value))>0 else "" self.s_mdb_conn = "" self.bl_mdb_conn = False if self.s_mdb != "" and self.s_target != "" and self.s_target_value != "": self.convertProcess() #end of __init__ def shiftID(self, l_columns): if l_columns.count("ID")>0: l_columns.remove("ID") l_columns.insert(0, "ID") return l_columns #end of shiftID def dictDBStructure(self, cur): d_out = {} cur_tables = cur.tables(tableType="table").fetchall() s_tables = "" for l_table in cur_tables: s_tables += str(l_table[2]) + "|" l_tables = s_tables.split("|") if len(l_tables) > 1: l_tables.pop(len(l_tables)-1) for s_table in l_tables: d_out[s_table] = {} #s_columns = "" #INTEGER, SMALLINT, VARCHAR, LONGCHAR, CURRENCY, BIT, DATETIME, COUNTER? for col in cur.columns(table=s_table): s_col_name = str(col.get("column_name")) s_col_type = str(col.get("type_name")) i_col_size = int(col.get("column_size")) if list(d_out[s_table].keys()).count(s_col_name) < 1: d_out[s_table][s_col_name] = {"column_nam
Re: MySQL connections
On Thu, Jan 15, 2015 at 10:59 PM, Jacob Kruger wrote: > Tried generating .exe with both cx_freeze, and pyInstaller, and the code > itself, and both versions of executable generate errors, same as running it > from command line - only difference is the source of the error mentioned in > error message then varies from a2m.exe and python.exe , and even if compile > it on machine where all works, and then copy .exe back to this primary > machine, then get same error - think it must relate to something else on > this machine, but can't track it down. Okay. Ignore the .exe versions, and just work with what happens when you run the .py files. If it fails as part of a .py file, post the failing file. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: MySQL connections
- Original Message - From: "Chris Angelico" You've posted your working versions; can you post a non-working version? Problem is that works fine in interpreter, but, not when executing it as part of code in file. Also, I'm seeing a very small hint here that might indicate a huge factor that you haven't mentioned. You speak of "compiling" your Python code. Do you mean you're turning it into an exe file? If so, with which tool? Does the code still have problems if you run the actual Python file? Tried generating .exe with both cx_freeze, and pyInstaller, and the code itself, and both versions of executable generate errors, same as running it from command line - only difference is the source of the error mentioned in error message then varies from a2m.exe and python.exe , and even if compile it on machine where all works, and then copy .exe back to this primary machine, then get same error - think it must relate to something else on this machine, but can't track it down. Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." -- https://mail.python.org/mailman/listinfo/python-list
Re: [OT] Re: MySQL connections
- Original Message - From: "Peter Otten" <__pete...@web.de> To: Sent: Thursday, January 15, 2015 12:40 PM Subject: [OT] Re: MySQL connections Jacob Kruger wrote: 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. Jacob, your writing style is incredibly long-winded and hard to follow. Try to build shorter sentences instead of this stream of consciousness, and focus on the actual problem. Was just trying to make sure included all relevant details ;) "python bombs out" is not a meaningful problem description. A traceback might be. Agree with that, but, like said in prior e-mail, just get windows error message popping up, mentioning - no track trace, since it's python terminating: ---error details--- Problem Event Name: BEX Application Name: python.exe Fault Module Name: StackHash_0a9e ---end error details--- That term BEX equates to buffer overflow exception, but not sure why this is happening - previous suggestion was to do with data execution prevention on windows, but, bex apparently also relates to winsock, or something, and tried different types of applying DEP - think so anyway. That said, I probably cannot help with your particular problem, so feel free to ignore me... No worries - thanks for reply. Just found following bit of summary of possible combination of bex/stackhash - but, still doesn't make sense when at this test stage I'm literally just opening and closing connection - might make sense if was executing thousands of queries against database before committing them: ---quote--- Buffer overflow is a condition when some process tries to store data beyond the capacity of the fixed/available buffer so it tries to overwrite some other memory locations, too. And in Windows we have some security feature called Data Execution Prevention that is intended to prevent similar processes to prevent buffer overflow attacks (that can introduce some malicious codes). But in some cases DEP can prevent some legitimate software from executing, too. And then you can get a BEX error. ---end quote--- Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." -- https://mail.python.org/mailman/listinfo/python-list
Re: MySQL connections
On Thu, Jan 15, 2015 at 7:13 PM, Jacob Kruger wrote: > 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. You've posted your working versions; can you post a non-working version? Also, I'm seeing a very small hint here that might indicate a huge factor that you haven't mentioned. You speak of "compiling" your Python code. Do you mean you're turning it into an exe file? If so, with which tool? Does the code still have problems if you run the actual Python file? ChrisA -- https://mail.python.org/mailman/listinfo/python-list
[OT] Re: MySQL connections
Jacob Kruger wrote: > 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. Jacob, your writing style is incredibly long-winded and hard to follow. Try to build shorter sentences instead of this stream of consciousness, and focus on the actual problem. "python bombs out" is not a meaningful problem description. A traceback might be. That said, I probably cannot help with your particular problem, so feel free to ignore me... -- https://mail.python.org/mailman/listinfo/python-list
Re: MySQL connections
And, FWIW, if I compile the 2.7 version on the other machine where it works, in both code and compiled forms, and then copy .exe back to the main machine, same error message pops up, so must be something to do with machine's configuration, etc. Stay well Jacob Kruger Blind Biker Skype: BlindZA "Roger Wilco wants to welcome you...to the space janitor's closet..." - Original Message - From: Jacob Kruger To: python-list@python.org Sent: Thursday, January 15, 2015 10:13 AM Subject: MySQL connections 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..." -- -- https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list