pythonwindowsnmap

AttributeError: partially initialized module 'nmap' has no attribute 'PortScanner' (most likely due to a circular import)


I'm using Windows 11 and VSCode to create a script which will scan the entire network and check the status for every address.

However, when I run the program, I get this error :

Traceback (most recent call last):
  File "C:\Users\theog\Desktop\Integration-continue-app-flsak\nmap.py", line 1, in <module>
    import nmap
  File "C:\Users\theog\Desktop\Integration-continue-app-flsak\nmap.py", line 2, in <module>
    nm = nmap.PortScanner()
         ^^^^^^^^^^^^^^^^
AttributeError: partially initialized module 'nmap' has no attribute 'PortScanner' (most likely due to a circular import)

I've installed the python-nmap module and not the nmap module. I also have the nmap software installed on my computer and included in the system PATH.

Any help would be greatly appreciated, Thanks!


Solution

  • Fixed it by renaming the file with anything other than nmap.py