Re: [Tutor] how to move an executable into path

2016-11-27 Thread Steven D'Aprano
On Tue, Nov 22, 2016 at 06:33:35PM -0600, Benjamin Fishbein wrote:

> Everything was going fine with my selenium webdriver programs, but 
> then today I updated to Firefox 50. Everything stopped working.

That's what happens when you upgrade Firefox -- you get something 
which does more of the things you don't want, less of the things you do 
want, may or may not fix some security vulnerabilities, but absolutely 
will introduce new ones.

That's called "progress".

> So I updated to selenium 3, hoping this would work. But apparently I 
> need something called geckodriver.

"Something"? Care to give a hint what it is? I'm assuming it isn't a 
Python library.


> I managed to download this, but it’s in the wrong place: in my downloads 
> folder.
[...]
> WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

That's not talking about the PYTHONPATH, which is the set of folders 
that Python looks for modules and libraries, but in your operating 
system's PATH, which is where the OS looks for executable programs, 
system libraries, and other goodies.

Does Mac offer some sort of officially supported package management? If 
so, you should use that. On Linux, I would firstly try:

sudo yum install geckodriver

or 

sudo apt-get install geckodriver

which (hopefully) would install the officially supported version. 
(Which, of course, might not be the version that Selenium and Firefox 50 
require. There's that progress again.)

But I fear that being on a Mac, any official package management is going 
to support Apple software and very little else.

You might try googling for "Homebrew", I think that's some sort of 
third-party package manager for OS X. See if you can use that to install 
geckodriver.

If not, well, things will start getting complicated fast. It depends on 
whether you have downloaded a binary library or the source code for 
geckodriver. You could try right-clicking on the file and seeing what 
sort of file the Finder thinks it is.

Wait, Mac's don't support right-click by default. Control-click perhaps?

*If* you have downloaded the source code, it will probably be in a 
tarball or zip file. You'll need to expand the zip file. Hopefully there 
will be a READ ME file in the zip file with decent instructions. If it 
is anything like Linux, you'll probably be told to open a shell window, 
cd into the directory containing the geckodriver source code, then run a 
series of commands like:

./configure
make
sudo make install

Those three commands will prepare the source code, compile it, and 
(hopefully) place it somewhere in the PATH.

If its not like Linux, well, it could be anything. (Sorry, I haven't 
seriously used a Mac since System 7.)

On the other hand, if you have downloaded the binary library, then no 
compilation is required. All you need to do is insert the file in one of 
the system directories that is on the PATH. I have no idea how to do 
that on OS X.

> So I’m not sure where the geckodriver file needs to go. Can it be 
> anywhere on the path? could I just put it in the site-packages folder 
> for example?

No, not site-packages, because that's for Python modules, not system 
libraries.


> And here’s the big problem: all of these folders are hidden, and I 
> have no idea how to get into them.

Start with this: open a terminal or shell window. You will see a prompt, 
probably a $ sign or maybe a % sign. If you see a >>> prompt, you're in 
the Python interpreter. You don't want that.

Type this command, and press the ENTER key:

echo $PATH

This will(?) print the current value of the system PATH. (At least 
it will on Linux -- on Mac, who knows?) Copy and paste the results here.


-- 
Steve
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] how to move an executable into path

2016-11-27 Thread Alan Gauld via Tutor
On 23/11/16 00:33, Benjamin Fishbein wrote:

> I should probably learn how to handle paths and file systems, etc., 

You definitely should if you intend doing any serious programming
on MacOS. Learn to drive the Terminal tool and the basic Unix
command line tools and you will have much more control over
your Mac.

Read Steve's reply because, despite its mild(?!) snarkiness
about Macs (and firefox), it is full of good advice.

But as a quick fix if you drag the Gecko-thingummy binary
into your Applications folder it should be on your path.
But that's probably not the optimal place to keep it,
but it might just get you running quickly...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] how to move an executable into path

2016-11-27 Thread Steven D'Aprano
On Sun, Nov 27, 2016 at 06:28:09PM +, Alan Gauld via Tutor wrote:
> On 23/11/16 00:33, Benjamin Fishbein wrote:
> 
> > I should probably learn how to handle paths and file systems, etc., 
> 
> You definitely should if you intend doing any serious programming
> on MacOS. Learn to drive the Terminal tool and the basic Unix
> command line tools and you will have much more control over
> your Mac.
> 
> Read Steve's reply because, despite its mild(?!) snarkiness
> about Macs (and firefox), it is full of good advice.

I fully admit some snark about Firefox. Any snarkiness about Macs were 
completely unintentional. I used to really like Macs, and as far as OS X 
goes, I don't know enough about it to justify any snarkiness.


-- 
Steve
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] how to move an executable into path

2016-11-27 Thread Alex Kleider

On 2016-11-27 16:26, Steven D'Aprano wrote:

snip..


I fully admit some snark about Firefox.


snip..

I've been using Firefox on Ubuntu for years and haven't recognized any 
difficulties although I don't use it for much other than email, 
searching, and occasionally shopping.


I would be interested in knowing your browser of choice- obviously not 
Safari!


Alex
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] how to move an executable into path

2016-11-27 Thread Steven D'Aprano
On Sun, Nov 27, 2016 at 05:49:20PM -0800, Alex Kleider wrote:
> On 2016-11-27 16:26, Steven D'Aprano wrote:
> 
> snip..
> 
> >I fully admit some snark about Firefox.
> 
> snip..
> 
> I've been using Firefox on Ubuntu for years and haven't recognized any 
> difficulties although I don't use it for much other than email, 
> searching, and occasionally shopping.
> 
> I would be interested in knowing your browser of choice- obviously not 
> Safari!

Firefox is like democracy: its the worst browser in the world, except 
for all the others. I keep coming back to it because every time I change 
to another browser, its worse.

I hate the rapid pace of upgrades that change basic functionality. 
A rapid pace for security upgrades is necessary. Changing the look and 
feel of the browser and the features, not so much. I hate that every 
time I upgrade Firefox, something breaks.

I hate how slow and memory hungry it is, at the way that it eats memory 
and CPU cycles even when quitely sitting in the background, and how a 
single rogue website can kill the entire application. In theory, Chrome 
is better, since each tab exists in its own process that can be killed 
independently of the rest, but in practice I find that to be false 
advertising: I've still had the entire Chrome application crash and die.

But, really, its not so much Firefox as the entire web ecosystem. I'm 
unhappy that people want to do everything in the browser, often poorly. 
I'm sad that web applications' user-interfaces are so poor. I'm angry at 
the large number of sites which are completely unviewable without 
enabling Javascript and allowing random websites to track your move. I'm 
sick of web adverts and tracking cookies and more nefarious tricks done 
by advertisers and the way that we're all supposed to just implicitly 
trust code downloaded from random people on the internet into our 
browser.

I think that any web site that serves up malware disguised as 
advertising should be held 100% liable, plus punitive damages, and if 
that destroys the Internet advertising industry, good. I'd rather a tiny 
Internet that loses money and is trustworthy than a huge Internet that 
makes buckets of money for people who cannot be trusted as far as you 
can throw them.

I'm frustrated that even though I have an Internet connection that is 
hundreds of times faster than I had in the 1990s, browsing is actually 
*slower* now because pages are hundreds of times bigger, and nearly all 
of that size is junk: Javascript to load trackers that load other 
trackers that load other trackers that load more Javascript that loads 
more trackers.

NoScript makes this somewhat more bearable, but it is frustrating 
whenever I come across a page that will not load without disabling 
NoScript or enabling a dozen or more foreign trackers.

At least Flash is on the way out.



-- 
Steve
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor