Ejemplo n.º 1
0
      "classifications": classifications
    })

    while True:
      # Connection errs when the database is locked.
      # Keep trying until we get the lock.
      try:
        con = lite.connect(args.directory + '.db3', timeout=15)
        with con:
          cur = con.cursor()
          cur.execute("INSERT INTO Apps VALUES(?, ?)", (fname, jsonStr))
          con.commit()
          return
      except:
        pass

con = lite.connect(args.directory + '.db3', timeout=15)
with con:
  cur = con.cursor()
  cur.execute("CREATE TABLE IF NOT EXISTS Apps(ID TEXT, CONTENTS TEXT)")
  con.commit()

for fname in os.listdir(args.directory):
  if os.path.getsize(args.directory+"/"+fname) > 32000000:
    print("Warning: " + fname + " too large.")
  else:
    jobs.append(Process(target=scan, args = [fname], kwargs = {}))

jobs.close()
jobs.start()
Ejemplo n.º 2
0
        while True:
            # Connection errs when the database is locked.
            # Keep trying until we get the lock.
            try:
                con = lite.connect(args.directory + '.db3', timeout=15)
                with con:
                    cur = con.cursor()
                    cur.execute("INSERT INTO Apps VALUES(?, ?)",
                                (fname, jsonStr))
                    con.commit()
                    return
            except:
                pass


con = lite.connect(args.directory + '.db3', timeout=15)
with con:
    cur = con.cursor()
    cur.execute("CREATE TABLE IF NOT EXISTS Apps(ID TEXT, CONTENTS TEXT)")
    con.commit()

for fname in os.listdir(args.directory):
    if os.path.getsize(args.directory + "/" + fname) > 32000000:
        print("Warning: " + fname + " too large.")
    else:
        jobs.append(Process(target=scan, args=[fname], kwargs={}))

jobs.close()
jobs.start()