Reputation: 602
I'm having an issue with some code I'm writing. I'm getting this pwntools error about too many files being open. My code looks like.
for a in range(0,2**3360):
try:
with open("output.txt", "a") as f:
p =process(os.getcwd()+ "/flag",stdout=f)
f.write(f'L:{a}\na')
sleep(0.05)
p.wait_for_close()
while(p.poll()!=0):
continue
f.close()
This unfortunately this code causes a too many files open error. How can I make sure the io files and such are closed so its safe to continue starting processes? The sleep and p.wait_for_close() and p.poll in while loop were attempts.
Upvotes: 0
Views: 21