Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109188

Re: How can I debug silent failure - print no output

From Jason Friedman <jsf80238@gmail.com>
Newsgroups comp.lang.python
Subject Re: How can I debug silent failure - print no output
Date 2016-05-27 22:02 -0600
Message-ID <mailman.4.1464408152.1839.python-list@python.org> (permalink)
References <ef399830-bfc1-40ce-9a5d-403040aa8e78@googlegroups.com> <CANy1k1jxjhBPxs6yWw-T54a+m054nyfeXrvBrj+D0she93XkCA@mail.gmail.com>

Show all headers | View raw


>
> 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.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

How can I debug silent failure - print no output Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-27 19:41 -0700
  Re: How can I debug silent failure - print no output Michael Torrie <torriem@gmail.com> - 2016-05-27 21:06 -0600
    Re: How can I debug silent failure - print no output Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-27 21:02 -0700
      Re: How can I debug silent failure - print no output cs@zip.com.au - 2016-05-28 14:35 +1000
        Re: How can I debug silent failure - print no output Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-27 23:35 -0700
          Re: How can I debug silent failure - print no output Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-28 00:14 -0700
            Re: How can I debug silent failure - print no output Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-28 01:01 -0700
              Re: How can I debug silent failure - print no output Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-28 02:44 -0700
                Re: How can I debug silent failure - print no output Sayth Renshaw <flebber.crue@gmail.com> - 2016-05-28 03:32 -0700
                Re: How can I debug silent failure - print no output cs@zip.com.au - 2016-05-29 08:43 +1000
          Re: How can I debug silent failure - print no output Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-05-28 12:52 -0400
  Re: How can I debug silent failure - print no output Jason Friedman <jsf80238@gmail.com> - 2016-05-27 22:02 -0600

csiph-web