Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AttributeError handling when stopping. #3452

Closed
wants to merge 1 commit into from
Closed

Add AttributeError handling when stopping. #3452

wants to merge 1 commit into from

Conversation

seanpianka
Copy link

@seanpianka seanpianka commented Feb 3, 2017

Add AttributeError handling when calling Service.stop. I noticed that this issue occurs after attempting to initialize a webdriver.Chrome instance while 'chromedriver' is not in PATH.

Here is the aforementioned error:

Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

And here is the aforementioned stacktrace:

Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.chrome.service.Service object at 0x7fae11780a20>>
Traceback (most recent call last):
  File "/home/sean/.../lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 176, in __del__
    self.stop()
  File "/home/sean/.../lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 146, in stop
    if self.process is None:
AttributeError: 'Service' object has no attribute 'process'

The proposed changes should not introduce any adverse effects as it will handle similarly to a situation where self.process does exist.

Add AttributeError handling when calling Service.stop. I noticed that this issue occurs after attempting to initialize a webdriver.Chrome instance while 'chromedriver' is not in PATH.

Here is the aforementioned error:

`Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home`

And here is the aforementioned stacktrace:

```
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.chrome.service.Service object at 0x7fae11780a20>>
Traceback (most recent call last):
  File "/home/sean/.../lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 176, in __del__
    self.stop()
  File "/home/sean/.../lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 146, in stop
    if self.process is None:
AttributeError: 'Service' object has no attribute 'process'
```

The proposed changes should not introduce any adverse effects as it will handle similarly to a situation where `self.process` does exist.
@cgoldberg
Copy link
Contributor

+1

@seanpianka
Copy link
Author

seanpianka commented Feb 3, 2017

Why did handling an AttributeError cause normally-passing tests to fail? Is some functionality and/or testcases relying on this behavior to build/pass?

@seanpianka
Copy link
Author

seanpianka commented Feb 3, 2017

Further errors, described in the following stacktrace, likely bear similar root causes (chromedriver executable_path being supplied while it is not in PATH).

Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.chrome.service.Service object at 0x7f5144f8da20>>
Traceback (most recent call last):
  File "/home/sean/.../lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 173, in __del__
  File "/home/sean/.../lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 149, in stop
  File "/home/sean/.../lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 120, in send_remote_shutdown_command
ImportError: sys.meta_path is None, Python is likely shutting down

@seanpianka seanpianka closed this Feb 5, 2017
@seanpianka seanpianka deleted the patch-1 branch February 23, 2017 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants