ioquatix / script-runner

This package will run various script files inside of Atom. It currently supports JavaScript, CoffeeScript, Ruby, and Python. You can add more.
http://atom.io/packages/script-runner
Other
62 stars 23 forks source link

running python with selenium #98

Closed darkrift-opt closed 6 years ago

darkrift-opt commented 6 years ago

The problem I am facing is that when the script executed from top to the bottom, the third party selenium driver just stop. everything is working I can launch firefox with selenium but after it launch, 2 second it's close firefox without giving error

# !/usr/bin/env python

from selenium import webdriver

driver = webdriver.Firefox()

driver.get('https://duckduckgo.com/')

I could delay firefox from closing by import time but that's not the solution

I have tired with script {rgbrk} it works fine! so the problem has to be in scipt-runner

ioquatix commented 6 years ago

Don't put a space on the first line between # and !.

#!/usr/bin/env python

from selenium import webdriver

driver = webdriver.Firefox()

driver.get('https://duckduckgo.com/')

input()

Does that work as expected?

darkrift-opt commented 6 years ago

Thanks mate that's a awesome trick and it works, I didn't even thought about input :) The extra space was a copy and paste error

ioquatix commented 6 years ago

The reason why script-runner "fails" in your original observation is because it's strict about killing all sub-processes. So it also kills the Firefox process. It looks like, at least based on what you said, that script doesn't do this this, and so you have the potential to leak processes over time.