Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Jason Friedman Newsgroups: comp.lang.python Subject: Re: How can I debug silent failure - print no output Date: Fri, 27 May 2016 22:02:23 -0600 Lines: 46 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de tNcvYOds8Ty5C4PTE0LnqgicbcQ+ZBbGaITf3HWJ6Vzg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'args': 0.04; 'filename': 0.07; 'matches': 0.07; 'cc:addr:python-list': 0.09; 'subject:How': 0.09; 'def': 0.13; '"*"': 0.16; 'attr': 0.16; 'executed.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'set()': 0.16; 'subject:debug': 0.16; 'tree': 0.18; 'meetings': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'extension': 0.20; 'skip:" 30': 0.20; 'parser': 0.22; 'insert': 0.23; 'xml': 0.24; 'header:In- Reply-To:1': 0.24; 'command': 0.26; 'skip:m 30': 0.27; 'message- id:@mail.gmail.com': 0.27; 'skip:f 40': 0.27; "skip:' 10": 0.28; 'values': 0.28; 'actual': 0.28; 'indentation': 0.29; 'meeting': 0.30; 'skip:[ 10': 0.31; 'definition': 0.34; 'received:google.com': 0.35; 'filter': 0.35; 'path': 0.35; 'skip:p 30': 0.35; 'received:209.85': 0.36; 'data.': 0.36; 'subject:: ': 0.37; 'skip:& 10': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'skip:p 20': 0.38; 'files': 0.38; 'your': 0.60; 'skip:n 10': 0.62; 'within': 0.64; 'race': 0.72; 'walk': 0.72; 'horse': 0.84; 'post,': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=7vBM4dmWN/bIIEMRxZyGkdo/tCsICLj2alcw+rYsmYc=; b=hsZnj+t0+d9ND70gPINfWCDGLC2mdIAzA2MKZ8DrVIYesr+uNTeAuSM5xRI2w1ycjf o3oCOTLWkmKCt7cMR45UTzX2dK8BwNqeaiw+169yHAiwMTGxxf11THoRmegcvBl/qSFK mtELIgeIbY6zn2VcjPd0g8klvuvat4qL7cDfzIYDhbrVaERXuvPMzl4DNeYLrt3YzRlI 4w5PZheUiFEfYbNBkZfVHHfiFshG2OaMo1+NrHOpXS9HaJCW54/Uq8bAuzC5XBTeBudb +EzVPOAGpbjjbxd+s+GgfwZHv5VGMJt5NgAVI40sPlOoDqAxlskU0nfPnWlNnoYb3Gjt 5wbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=7vBM4dmWN/bIIEMRxZyGkdo/tCsICLj2alcw+rYsmYc=; b=cddR+sIiEvr8UlRSHu5Fjn73u1Lj1PJowUrhJH3LXXJ6JoHUSu1W9m2guz1+qeblsy THX1dMPVw6MGzry81LXgx4X5O7nN9qNzZzE7mGebh7H9EsTaMHpEHzLBDlEWJNh65pKP 67qVYiKYS8vUC7xiqOgD7SINhQ1hIkOtBtNHQnIsWB/7PF8gbhYzc4X6QusbtMwBCyAf DmpqBoqjelzeSKB7AuvYaa1f7gXSmBildGmw9SXjrcK9SVL0AJ2YQG054sk4Hana6o7n 4ogYGAEYUGue3kBPmlHOiiVVOUmQvVpGT7n9UOQuePnwwDiHWZlZJ98lHPFdC0rzWVY5 KcCQ== X-Gm-Message-State: ALyK8tKh8KNERkYMdTEqoM5UaLgK0pq1xdI6b4i4+JoqnNaTOHEz0863uQbHCcmivNMUH0im/YlWooxWomexZw== X-Received: by 10.31.51.11 with SMTP id z11mr10247821vkz.150.1464408143320; Fri, 27 May 2016 21:02:23 -0700 (PDT) In-Reply-To: X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: Xref: csiph.com comp.lang.python:109188 > > def GetArgs(): > '''parse XML from command line''' > parser = argparse.ArgumentParser() > > parser.add_argument("path", nargs="+") > parser.add_argument('-e', '--extension', default='', > help='File extension to filter by.') > args = parser.parse_args() > > files = set() > name_pattern = "*" + args.extension > for path in args.path: > files.update(glob.glob(os.path.join(path, name_pattern))) > return files > > > > # Now walk the tree and insert data. > for filename in sorted(GetArgs()): > for meeting in pq(filename=filename): > print(filename) > print(meeting) > meetdata = [meeting.get(attr) for attr in meetattrs] > cur.execute("insert into meetings valueme in GetArgs():s (" + > ",".join(["%s"]*len(meetattrs)) + ")", meetdata) > for race in meeting.findall("race"): > race.set("meeting_id", meeting.get("id")) > racedata = [race.get(attr) for attr in raceattrs] > cur.execute("insert into races values (" + > ",".join(["%s"]*len(raceattrs)) + ")", > racedata) > for horse in race.findall("nomination"): > horse.set("race_id", race.get("id")) > horsedata = [horse.get(attr) for attr in horseattrs] > cur.execute("insert into horses values (" + > ",".join(["%s"]*len(horseattrs)) + ")", > horsedata) > > If your actual indentation matches what I see in your post, is your for filename in sorted(GetArgs()) line within the definition of GetArgs? If yes, it will not be executed.