2

I have been working on some a web scanning app including Selenium and Python 2.7 running on a Raspberry Pi. The app was working perfectly and then a stepped away for a few minutes and now it is not.

The problem seems to do with the Selenium imports and I have made no changes to those files. Here is what I am seeing:

Basic Python imports:

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select

That code consistently results in the following:

2016-04-29 17:01:23.428942
Traceback (most recent call last):
  File "./testing.py", line 1, in <module>
    from selenium import webdriver
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/__init__.py", line 18, in <module>
    from .firefox.webdriver import WebDriver as Firefox
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 34, in <module>
    from .remote_connection import FirefoxRemoteConnection
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/remote_connection.py", line 18, in <module>
    from selenium.webdriver.remote.remote_connection import RemoteConnection
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/remote_connection.py", line 34, in <module>
    from . import utils
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/utils.py", line 26, in <module>
    LOGGER = logging.getLogger(__name__)
AttributeError: 'module' object has no attribute 'getLogger'

Again, to be clear these imports were working perfectly before and I have made no changes. It feels like there is something bigger going on and I would love any perspectives or troubleshooting tips.

Thank you!

5
  • Ran your code, looks good on my end. Im guessing you have another file .. other code? I placed your five lines into test.py and pip installed selenium runs like a charm. Commented Apr 29, 2016 at 21:17
  • dumb question: do you have import logging for LOGGER = logging.getLogger(__name__)? Commented Apr 29, 2016 at 21:19
  • This is where it gets weird. My file test.py only has the those 5 imports in it -- nothing more, and yet it throws the error. It ran ran perfectly just a couple of hours ago.... Commented Apr 29, 2016 at 21:21
  • I am wondering if some local service may have crashed and that is causing the error? Some logging daemon? I have no idea really. Commented Apr 29, 2016 at 21:23
  • usually logging.getLogger(__name__) refers to Python's logging facility (docs.python.org/2/howto/logging.html), and I always thought you have to import it to use. So error itself is about missing import in utils.py (I think), but the reason you are getting it might be that selenium wants to report some actual error. In which case your theory may be right Commented Apr 29, 2016 at 21:51

1 Answer 1

1

I figured this out. The problem was that I had a file named "logging.py" in the same directory. Selenium was trying to load the logging module and it was loading my file instead of the actual module. This is what caused the errors.

I solved the problem by renaming logging.py to something else.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.