python nmap can t find PortScanner attribute

+1 vote

PortScanner is not working on my system:

Traceback (most recent call last):
  File "nmap.py", line 1, in <module>
    import nmap as pnmap
  File "/home/user/python-nmap/nmap.py", line 2, in <module>
    nm = pnmap.PortScanner()
AttributeError: 'module' object has no attribute 'PortScanner'

Please help

Jan 30, 2019 in Python by Kishore
8,831 views
Try deleting the directory .../nmap/ with contained files, and install the new the packages nmap or bypython setup.py install at new packages directory.

This should do!

2 answers to this question.

+1 vote

As I can see in the error log that the name of your python file is nmap.py. There's a chance that this name is conflicting with the python module. Try changing the name and see if it works.

answered Jan 30, 2019 by Omkar
• 69,220 points
Wow thanks so much Omkar!! It seems like that was really the problem
+2 votes
you want install

       1.pip uninstall nmap

       2.pip install python-nmap

in commands
answered Jan 25, 2020 by Rangertech_hacker234
Thanks, @Rangertech_hacker234 for your contribution.

Please register at Edureka Community and earn credits for every contribution. A contribution could be asking a question, answering, commenting or even upvoting/downvoting an answer or question.

These credits can be used to get a discount on the course. Also, you could become the admin at Edureka Community with certain points.

Thanks!

Related Questions In Python

0 votes
1 answer

Python error saying "AttributeError: can't set attribute"

change your code to the following: @x.setter def x(self, ...READ MORE

answered May 30, 2019 in Python by Imran
19,015 views
0 votes
1 answer

Python Error: Can't find '_main_' module in 'C:/Users/DELL/Pythonprojects/Aks'

I can see there no Python file ...READ MORE

answered Jun 25, 2020 in Python by Karan
• 19,610 points
3,661 views
0 votes
0 answers

Python Key Error=0 - Can't find Dict error in code

basically I have been racking my brains ...READ MORE

Dec 22, 2022 in Python by erzan
• 630 points
473 views
0 votes
1 answer

How can I find out the index of an element from row and column in Python?

You probably want to use np.ravel_multi_index: [code] import numpy ...READ MORE

answered Apr 16, 2018 in Python by charlie_brown
• 7,720 points
2,338 views
–1 vote
2 answers

How to find the size of a string in Python?

following way to find length of string  x ...READ MORE

answered Mar 29, 2019 in Python by rajesh
• 1,270 points
2,107 views
0 votes
1 answer

Examples for string find in Python

you can use str.index too: >>> 'sdfasdf'.index('cc') Traceback ...READ MORE

answered Aug 29, 2018 in Python by Priyaj
• 58,020 points
795 views
+1 vote
1 answer

Not able to use nmap in python.

nmap module doesn’t have PortScanner attribute. The ...READ MORE

answered Jan 28, 2019 in Cyber Security & Ethical Hacking by Omkar
• 69,220 points
3,404 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,434 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP