1

On Windows 10 (PyCharm IDE), i tried import the pythone-nmap module to get PortScenner. The code i wrote:

import nmap
ns = nmap.PortScanner()
a = ns.nmap_version()
print(a)

Afterward, i got the following error:

C:\Users\Mind1\AppData\Local\Programs\Python\Python36-32\python.exe C:/Users/Mind1/PycharmProjects/testNmap/main.py

Traceback (most recent call last):

File "C:/Users/Mind1/PycharmProjects/testNmap/main.py", line 2, in

ns = nmap.PortScanner()

File "C:\Users\Mind1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\nmap\nmap.py", line 131, in init

os.getenv('PATH')

nmap.nmap.PortScannerError: 'nmap program was not found in path.

PATH is : C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;C:\Users\Mind1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\nmap\nmap.py;C:\tizen-studio\tools\ide\bin;C:\Users\Mind1\AppData\Local\Programs\Python\Python36-32\Scripts\;C:\Users\Mind1\AppData\Local\Programs\Python\Python36-32\;C:\Users\Mind1\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Programing\SQLite3;C:\Users\Mind1\AppData\Local\Microsoft\WindowsApps;C:\Program Files\JetBrains\PyCharm Community Edition 2019.2.3\bin;;C:\Users\Mind1\AppData\Local\Programs\Python\Python36-32\lib\site-packages\nmap\nmap.py;'

My questions are: Why isn't it found in the path, when it is there at the end of the path? Why are there 2 semi-colon before the last part of the path?

ps: I tried to add the path within the () of the PortScanner(), but that hasn't worked neither. (Not even when I used the double \ signs.

  • Do you have `nmap` (the program) installed? –  Oct 15 '19 at 15:06
  • Do you mean a standalone program, or the nmap(without the python-) module? When both the nmap and python-nmap module were installed it gave another different error. Standalone program i haven't tried Edit: the error: AttributeError: module 'nmap' has no attribute 'PortScanner' – VeloxTheFox Oct 15 '19 at 15:14
  • All possible issues with `nmap` have been described [here](https://stackoverflow.com/questions/71652574/getting-error-attributeerror-module-nmap-has-no-attribute-portscanner/71660197) in details. – gremur Mar 30 '22 at 11:10

0 Answers0