Python 2.7, on windows7 64 bit development machine, inconsistent issue on similar machines

Jacob Kruger jacob at blindza.co.za
Tue Jan 13 04:43:24 EST 2015


Trying to run through all steps in data conversion app, and, up to last point, it's fine, but, if I try to handle direct execution of data structure, and data insertion scripts against a mySQL database, hosted locally here on same machine, running under wamp, then after code has completely finished executing everything, the command line just stops, and then I get the windows error dialogue pop up, telling me python.exe has stopped working.

If I run the same code on my other dev machine, which might just have a slightly simpler/cleaner combination of software, etc. installed on it, then it just runs straight through, and exits python interpreter instance, with no issues, and am just not sure how to try track down actual cause of this issue.

Here's part of the error dialogue's detailed information:
Problem signature:

Problem Event Name: APPCRASH

Application Name: python.exe

Application Version: 0.0.0.0

Application Timestamp: 4c303241

Fault Module Name: StackHash_0a9e

Fault Module Version: 0.0.0.0

Fault Module Timestamp: 00000000

Exception Code: c0000005

Exception Offset: 028e1289

OS Version: 6.1.7601.2.1.0.256.1

Locale ID: 2057

Additional Information 1: 0a9e

Additional Information 2: 0a9e372d3b4ad19135b953a78882e789

Additional Information 3: 0a9e

Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

#---end of error info---



If I look for something similar via google, etc., I come across some mention of 32-64 bit incompatibility, or something, but, not sure if relevant, although am working with 32 bit versions of python 2.7, and both of my dev machines are in fact 64 bit windows7 machines, but haven't had issues like this in past.



Also, if I exclude last part of code, which handles directly working with MySQL database, then all cooperates fine, but, am pretty sure am closing all relevant connections, cursors, etc. - here's the last function that am calling/executing, in case relevant - there is still some testing/manual debugging stuff in here, but anyway:

#---start code---

  def convertExport(self):
    try:
      f_mysql = open("mysql.set", "rb")
      d_mysql = pickle.load(f_mysql)
      f_mysql.close()
      cn = None
      s_host = str(d_mysql["host"])
      s_user = str(d_mysql["user"])
      s_pass = str(d_mysql["password"])
      s_db = self.s_target_value
      cn = MySQLdb.connect(s_host, s_user, s_pass, s_db)
      if cn:
        cn.autocommit = True
        cur = cn.cursor()
        i_struct = 0
        i_data = 0
        f = open(self.s_sql_struct_file, "rb")
        s = f.read()
        f.close()
        l_struct = s.split(";")
        f = open(self.s_sql_data_file, "rb")
        s = f.read()
        f.close()
        l_data = unidecode(s).split(";")
        l_struct_errors = []
        l_data_errors = []
        i_start_time = int(time.time())
        s_status = "/{0} structs".format(str(len(l_struct)))
        for I in range(len(l_struct)):
          try:
            i_struct = I
            if str(l_struct[I]).strip() != "": res = cur.execute(l_struct[I] + ";")
            print(l_struct[I])
          #except Warning as wrn:
          #  print("warning: " + str(wrn.args))
          except Exception as exc:
            l_struct_errors.append([l_struct[I], copy.copy(exc)])
          finally:
            pass
        cn.commit()
        time.sleep(2.0)
        sNada = raw_input("hit enter to continue with data")
        s_status = "/{0} data".format(str(len(l_data)))
        for I in range(len(l_data)):
          try:
            #self.SetStatusText(str(I) + s_status)
            i_data = I
            if str(l_data[I]).strip() != "": res = cur.execute(l_data[I][l_data[I].index("INSERT"):] + ";")
            print(l_data[I][l_data[I].index("INSERT"):] + ";")
          except Exception as exc:
            l_data_errors.append([l_data[I], copy.copy(exc)])
          finally:
            pass
        i_end_time = int(time.time())
        s_time_taken = sTimeDiffFormat(i_start_time, i_end_time)
        cn.commit()
        cur.close()
        cn.close()
        print("cn and cur closed")
        fPickle = open("testDataErrors.pickle", "wb")
        pickle.dump(l_struct_errors, fPickle, 2)
        pickle.dump(l_data_errors, fPickle, 2)
        fPickle.close()
        print("pickled")
        print("MySQL Results - {0} structure queries, and {1} data queries completed - total of {2}".format(str(i_struct), str(i_data), s_time_taken))
        print("MySQL Errors - {0} structure query errors, and {1} data query errors".format(str(len(l_struct_errors)), str(len(l_data_errors))))
        print("Done!")
        sys.exit()
      else:
        print("Connection issue - There was a problem connecting to MySQL server")
        sys.exit()
    except Exception as exc:
      s_exc = str(exc.args)
      #lbc.DialogShow(title="errorMessage", message=s_exc)
      print(s_exc)
      exc_type, exc_obj, tb = sys.exc_info()
      print(str(exc_obj))
      print("line number: " + str(tb.tb_lineno))
  #end of convertExport function

#---end code---



If this is operating system specific, sorry, and will maybe also try debugging code via VS.Net 2013 shortly, but, thought someone might have an off-hand thought regarding something could try use to figure out this issue in meantime...?



TIA


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/20150113/b3a4eb11/attachment.html>


More information about the Python-list mailing list