0

The future does not get called in the following snippet:

def main():
    if not amiadmin(): 
        print ("You are not superuser")
        raise PermissionError
    dumpfile = open('filename', mode='w')
    fileiolock = threading.RLock()
    (ip,) = struct.unpack ("!L", socket.inet_aton("""some ip address"""))
    # sorry, this hack requires Internet addresses be integers
    ips = genlistofipaddrs(ip, 8)
    ips_converted = [ socket.inet_ntoa(struct.pack ("!L", ip)) for ip in ips ]
    ping = icmp(0)
    # reverse conversion from integers
    executor = concurrent.futures.ThreadPoolExecutor(max_workers=ThreadLimit)
    with executor:
         futs = [ executor.submit(IPScanner, ping, ip, dumpfile, fileiolock) 
                  for ip in ips_converted]
    concurrent.futures.wait(futs,return_when=ALL_COMPLETED)
    print ("Good job")

There is a real B-class IPv4 address in my real code instead of some ip address. Why does the future not get called? No exceptions raised, program quits successfully.

Erkin Alp Güney
  • 218
  • 6
  • 15

1 Answers1

0

Replaced executor.submit(IPScanner, (ping, ip, dumpfile, fileiolock)) by executor.submit(IPScanner, ping, ip, dumpfile, fileiolock) according to @dano's comment and it works now.

Erkin Alp Güney
  • 218
  • 6
  • 15