ResourceWarning: Enable tracemalloc to get the object allocation traceback

Tell us what’s happening:

ResourceWarning: Enable tracemalloc to get the object allocation traceback
/home/runner/fcc-port-scanner/port_scanner.py:20: ResourceWarning: unclosed <socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=(‘172.18.0.36’, 33474)>
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ResourceWarning: Enable tracemalloc to get the object allocation traceback

I don’t really know what is happening, it said i’m not close the file i used, but when i code s.close() it still error

pls help me

Your code so far

s = socket.socket()
Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36.

Challenge: Port Scanner

Link to the challenge:

1 Like