[Tutor] automate add-to-cart with python

Prasad, Ramit ramit.prasad at jpmorgan.com
Tue Jan 29 20:49:50 CET 2013


Benjamin Fishbein wrote:
> >>
> >
> > A direct approach would probably use the webdriver API to automate the
> > browser.  Selenium has one:
> >
> I decided to use Selenium. It may be overkill for this particular problem, but I'll want to use it for other
> things.
> This is my first time trying to install a new module to Python. I've been working on it all morning with no
> success.
> I'm on Mac OSX and I downloaded :
> selenium-2.29.0.tar.gz
> and then opened it to get:
> selenium-2.29.0
> 
> In the README file,  it said for installing to Python, to type:
> pip install -U selenium
> 
> So in terminal, I went to:
> 
> cd /Users/bfishbein/Downloads/selenium-2.29.0

Looks like you are on OS X. You can (probably) install pip from 
MacPorts or HomeBrew (which can also properly install alternative 
versions of Python without messing up the system installed version). 
Not that these are necessary, but they are helpful. Keep them
in mind for the future, especially if you test with multiple
versions of Python on the same machine.

> 
> and typed:
> pip install -U selenium
> 
> I got:
> -bash: pip: command not found
> so I tried downloading pip
> 
> After downloading pip, I tried to install it:
> cd /Applications/pip-1.2.1
> install pip
> 
> I got this strange message:
> usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
>                [-o owner] file1 file2
>        install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
>                [-o owner] file1 ... fileN directory
>        install -d [-v] [-g group] [-m mode] [-o owner] directory ...
> Benjamins-MacBook-Air:pip-1.2.1 bfishbein$
> 
> Apparently it didn't install.
> Do you know what I'm doing wrong?
> Any help would be appreciated.
> I didn't expect it to be so tough to install a python module.

Normally you want to do `python setup.py install`
when manually installing (or similar). I think you 
should follow the pip install directions 
here: http://www.pip-installer.org/en/latest/installing.html
You need to install distribute or setuptools 
(use the "source installation" directions for manually
installing), but I believe the install script for pip
(not get-pip.py) will install the dependencies for you.

All of this will install to the global python install which is not
always desireable or even recommended. I would highly recommend
installing virtual env ( http://www.virtualenv.org/en/latest/ ).
This will let you install and try modules without contaminating
your global install.


~Ramit


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  


More information about the Tutor mailing list