I have been seeking for answers of how to fix this Python problem:
AttributeError: module 'nmap' has no attribute 'PortScanner'
I wanted to learn more about port-scanning but I couldn't even install the module on Visual Studio Code, which I am using. I've tried everything that I and many people can think of:
- Uninstalled and reinstalled python-nmap as well as just nmap (since they are interconnected).
- I've tried renaming the module itself.
- I've launched my code on different IDEs
- I've created a separate folder and put modules and my project there.
No success so far..
This is my code:
import nmap
nm = nmap.PortScanner()
nm.scan('127.0.0.1', '22-443')
and the output:
/usr/local/bin/python3 /Users
/user2132/Desktop/PYTHONProjects/portscannning.py
Traceback (most recent call last):
File "/Users/user2132/Desktop/PYTHONProjects/portscannning.py", line 3, in <module>
nm = nmap.PortScanner()
AttributeError: module 'nmap' has no attribute 'PortScanner'
What can I try next?
P.S. I am using MacOS