Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'argument': 0.05; 'subject:Python': 0.06; 'debugging': 0.07; 'dev': 0.07; 'finally:': 0.07; 'indexing': 0.07; 'processing.': 0.07; 'string': 0.09; 'f.close()': 0.09; 'indicates': 0.09; 'latter': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'skip:# 30': 0.09; 'specific.': 0.09; 'subject:2.7': 0.09; 'try:': 0.09; 'python': 0.11; 'def': 0.12; 'jan': 0.12; "wouldn't": 0.14; '"":': 0.16; 'attempted': 0.16; 'cli': 0.16; 'closed")': 0.16; 'dep': 0.16; 'exc_type,': 0.16; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'relevant,': 0.16; 'res': 0.16; 'semicolon': 0.16; 'specific,': 0.16; 'statement;': 0.16; 'subject:bit': 0.16; 'subject:issue': 0.16; 'url:windows': 0.16; '{0}': 0.16; 'exception': 0.16; 'files.': 0.16; 'index': 0.16; 'skip:# 20': 0.16; 'bit': 0.19; "hasn't": 0.19; 'skip:p 40': 0.19; 'split': 0.19; 'unlike': 0.19; 'command': 0.22; 'skip:l 30': 0.24; 'skip:{ 20': 0.24; 'sorry,': 0.24; 'url:home': 0.24; 'versions': 0.24; "haven't": 0.24; 'mention': 0.26; 'query': 0.26; 'pass': 0.26; 'header:X -Complaints-To:1': 0.27; 'function': 0.29; 'google,': 0.29; 'errors': 0.30; 'see,': 0.30; 'statement': 0.30; "i'm": 0.30; 'code': 0.31; 'too.': 0.31; 'directly,': 0.31; 'pickle': 0.31; 'subject:development': 0.31; 'probably': 0.32; 'figure': 0.32; 'stuff': 0.32; 'interface': 0.32; 'maybe': 0.34; 'could': 0.34; 'problem': 0.35; 'except': 0.35; 'skip:s 30': 0.35; 'skip:u 20': 0.35; 'something': 0.35; 'operations': 0.35; 'but': 0.35; 'there': 0.35; '+0200,': 0.36; 'executing': 0.36; 'doing': 0.36; 'charset :us-ascii': 0.36; 'similar': 0.36; 'url:org': 0.36; 'operating': 0.37; 'turn': 0.37; 'url:microsoft': 0.37; 'skip:o 20': 0.38; 'confirmed': 0.38; 'machines': 0.38; 'needed': 0.38; 'to:addr :python-list': 0.38; 'issue': 0.38; 'fact': 0.38; 'that,': 0.38; 'anything': 0.39; 'structure': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'even': 0.60; 'skip:u 10': 0.60; 'tell': 0.60; 'completed': 0.61; 'first': 0.61; 'complete': 0.62; "you've": 0.63; 'connecting': 0.64; 'accounts': 0.64; 'total': 0.65; 'different': 0.65; 'number:': 0.66; 'here': 0.66; 'past.': 0.68; 'url:en-us': 0.68; 'results': 0.69; 'potentially': 0.81; '2015': 0.84; 'confusing': 0.84; 'here...': 0.84; 'pickled': 0.84; 'preventing': 0.84; 'url:forums': 0.84; 'affair': 0.91; 'mistakes': 0.93; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Python 2.7, on windows7 64 bit development machine, inconsistent issue on similar machines Date: Tue, 13 Jan 2015 09:23:33 -0500 Organization: IISS Elusive Unicorn References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-79-221-234.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 151 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1421159023 news.xs4all.nl 2881 [2001:888:2000:d::a6]:44748 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:83692 On Tue, 13 Jan 2015 11:43:24 +0200, "Jacob Kruger" declaimed the following: > > >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. > The very first hit /I/ get is: https://social.technet.microsoft.com/Forums/windows/en-US/3932e3eb-c034-4eb7-aa06-4a0a8e6ea493/fault-module-namestackhash0a9e > >#---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 ONE: Have you confirmed all of these are coming in correctly > cn = MySQLdb.connect(s_host, s_user, s_pass, s_db) > if cn: > cn.autocommit = True TWO-A: you've turned on autocommit here, yet... > 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(";") THREE-A: here you split some string on semicolons, just to... > 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)): Very UN-Pythonic... for a_struct in l_struct: # do stuff with a_struct directly, no indexing into l_struct > try: > i_struct = I > if str(l_struct[I]).strip() != "": res = cur.execute(l_struct[I] + ";") THREE-B: ... reappend the semicolon here... which probably isn't needed -- cur.execute() assumes, as I recall, that the provided argument is a complete statement; unlike a command line interface where the semicolon is needed to tell the CLI that the statement is complete and can be sent to the DBMS for processing. And very confusing names... l_struct and i_struct, where the latter is an index into the former (and I don't see it used anywhere). > 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() TWO-B: ... here you attempt to force a 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() TWO-C: ... and here too. > 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--- > What is this affair with pickling everything? Mistakes in a pickle could lead to anything happening I'm not even going to try to figure out what your attempted SQL operations turn into. Only that, from what I can see, there is no attempt at preventing SQL injection attacks -- other than the use of pickled data (and I still wouldn't trust that the pickle hasn't been tampered with). > > >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...? > Yes, it is OS specific. Either the accounts have different privileges of the different machines (presuming a DEP problem, and something you are doing is executing data), or http://winwiki.org/stackhash_0a9e-fix/ indicates potentially corrupted system files. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/