Re: AttributeError: 'module' object has no attribute 'insort' - Python + Webdriver - Mac OSX

628 views
Skip to first unread message

Alexandr Savchuk

unread,
Sep 3, 2012, 10:55:02 AM9/3/12
to webd...@googlegroups.com
Hi,

I have no such issue, but
imho, looks like your python is corrupted. Error like "AttributeError: 'module' object has no attribute 'insort'" usually means that there is no such method in module.

But at my installation i can see in the beginning of urllib2.py the line as:
-------------------------
import bisect
------------------------- 
and in bisect.py (at the same location as urllib2.py) i can see:
-------------------------  
insort = insort_right   # backward compatibility
-------------------------

Could you check these files for lines above ?

But I can be wrong due i use windows and do not use chromedriver.



On Tuesday, August 28, 2012 2:34:38 PM UTC-7, Y B wrote:
Hello,
          I get this error when running python + webdriver sample test.

browser = webdriver.Chrome(executable_path='/Users/<name>/Downloads/chromedriver')
  File "/Library/Python/2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 64, in __init__
    self.quit()
  File "/Library/Python/2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 78, in quit
    self.service.stop()
  File "/Library/Python/2.7/site-packages/selenium/webdriver/chrome/service.py", line 83, in stop
    urllib2.urlopen("http://127.0.0.1:%d/shutdown" % self.port)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 125, in urlopen
    _opener = build_opener()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 475, in build_opener
    opener.add_handler(klass())
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 357, in add_handler
    bisect.insort(self.handlers, handler)
AttributeError: 'module' object has no attribute 'insort'

Any idea how to fix this?

Thanks

Y B

unread,
Sep 3, 2012, 7:17:42 PM9/3/12
to webd...@googlegroups.com
Hi
I have both files urllib2.py and bisect.py.
bisect contains insort as well.

Thanks

Y B

unread,
Sep 4, 2012, 1:39:50 PM9/4/12
to webd...@googlegroups.com
Same issue with Firefox driver as well.
Reply all
Reply to author
Forward
0 new messages