1

I'm using Windows 10 and trying to run

python setup.py

on cmd, it is able to run the pip commands but not sudo and apt-get saying it doesn't recognize the command and internal or external and ends the message with

Traceback (most recent call last):
File "setup.py", line 17, in <module>
a,b,c = version.split(".")                     # a is the var with the aa
ValueError: need more than 2 values to unpack

I tried running it through bash since bash does recognize apt-get and sudo but it doesn't recognize the python command.

It also said it didn't recognize firefox command so I added it to the Path and ran it again. The second time no message on firefox appeared but noting else happened, I was expecting firefox to open.

I opened setup.py with vim

import os, math, sys

OS_bit = (round(math.log(sys.maxint,2)+1))  # get the bit

os.system("sudo apt-get install python-pip && sudo apt-get install tor")   # 
installing dependencies
os.system("pip install -U selenium")
os.system("pip install Pysocks")
os.system("pip install pyvirtualdisplay && apt-get install xvfb")

print("\n \n {} \n \n".format(OS_bit))


os.system('firefox -v > tmp')                  # store result of firefox -v 
in tmp
result   =  open('tmp', 'r').read()            # result var reads the output
marker   = result.find('Firefox') + 8          # marker marks the 8th letter 
from the word "Firefox"
version  = result[marker:].splitlines()[0]     # spliting the output, the 
version is something like aa.bb.cc
a,b,c = version.split(".")                     # a is the var with the aa
os.remove('tmp')                               # removing the temporary file

FirefoxVersion = int(a)
second = 0

if FirefoxVersion  < 53:

first = 16
second = 1
OS_bit = 64

elif FirefoxVersion == 53 or FirefoxVersion == 54:

first = 18

elif FirefoxVersion > 54:

first = 19

os.system("wget https://github.com/mozilla/geckodriver/releases/download/v0. 
{}.{}/geckodriver-v0.{}.{}- 
linux{}.tar.gz".format(first,second,first,second,OS_bit))
os.system("tar -xvzf geckodriver-v0.{}.{}- 
linux{}.tar.gz".format(first,second,OS_bit))
os.system("rm geckodriver-v0.{}.{}- 
linux{}.tar.gz".format(first,second,OS_bit))
os.system("chmod +x geckodriver")
os.system("mv geckodriver /usr/local/bin/")
  • 1
    Maybe I'm missing something, but what is `setup.py`? Did you write it, or did you get it from somewhere? – divibisan Mar 30 '18 at 18:35
  • 2
    `apt-get` and `sudo` are Linux commands. They will not work on native Windows. Also, the Traceback you included is not related to trying to run one of those commands (it just means that splitting version resulted in fewer than three substrings). You should probably post your `setup.py` code. – FamousJameous Mar 30 '18 at 18:42
  • @FamousJameous I have update the post to show the code – Sebastián Soto Mar 30 '18 at 19:12
  • You will have to find a different way to install pip and tor. I don't work on Windows enough to help you there. The actual issue causing the exception you posted is that apparently firefox's version is not of the form `aa.bb.cc` so you need to figure out what the version is (just print out `version`) and then how to parse it. – FamousJameous Mar 30 '18 at 22:04

0 Answers0