Spaces:
Runtime error
Runtime error
File size: 698 Bytes
4c404f5 aca6818 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import os
import tarfile
import requests
def init_env():
# download geckodriver
print("Downloading geckodriver...")
r = requests.get('https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz')
with open('geckodriver-v0.34.0-linux64.tar.gz', 'wb') as f:
f.write(r.content)
# extract geckodriver
tar = tarfile.open('geckodriver-v0.34.0-linux64.tar.gz')
tar.extractall()
tar.close()
# add geckodriver to PATH variable
os.environ["PATH"] += ":" + os.getcwd()
print(os.environ["PATH"])
# print directory
print(os.listdir())
# output geckodriver version
os.system("geckodriver --version") |