I have this script but It returns an error. The problem is that I omit to write
if _name_ == "__main__":
This is the script I took it from a tutorial but Im adapting it to my needs
import concurrent.futures
import time
start = time.perf_counter()
def do_something(seconds):
print(f'Sleeping {seconds} second(s)...')
time.sleep(seconds)
return f'Done Sleeping...{seconds}'
with concurrent.futures.ProcessPoolExecutor() as executor:
secs = [5, 4, 3, 2, 1]
results = executor.map(do_something, secs)
# for result in results:
# print(result)
finish = time.perf_counter()
print(f'Finished in {round(finish-start, 2)} second(s)')
the problem I have is that I'm using Windows and I don't know where I have to write: if __name__ == "__main__":