Ohmster wrote: > I am trying to use this cool script that some MIT guy wrote and it just > does not work, I get a stream of errors when I try to run it. It is > supposed to visit a URL and snag all of the pictures on the site. Here is > the script: > http://web.mit.edu/pgbovine/www/image-harvester/image-harvester.py > > Here is my output when I try to run it on my Fedora 6 machine: > > [EMAIL PROTECTED] bench]$ image-harvester.py > http://public.fotki.com/DaGennelman/ > /home/ohmster/scripts/image-harvester.py: line 59: from: command not found > [EMAIL PROTECTED] bench]$ > > The script is to be folowed up with another one to weed out the small > thumbnails and banner images, here is the base URL: > http://web.mit.edu/pgbovine/www/image-harvester/ > > Line 59 in image-harvester.py reads as follows: > > 59: from sgmllib import SGMLParser > 60: import urllib > 70: from urlparse import urlparse, urljoin > 71: import re > 72: import os# Usage: python image-harvester.py <url-to-harvest> > > > Can anyone tell me what is wrong with this script and why it will not run? > It does not like the command "from", is there such a command in python? > Does this mean that python has the "import" command but not the "from" > command or do we not know this yet as it hangs right away when it hits the > very first word of the script, "from"? Maybe this is not a Linux script or > something? I wonder why it needs the x-server anyway, I tried running it > from an ssh term window and it had a fit about no x-server so now I am > doing this in a gnome term window. This looked so cool too. :( > > Please be patient with me, I do not know python at all, I just want for > this script to work and if I see enough working examples of python, I may > just take up study on it, but for right now, I do not know the language. > Total newbie. > > Thanks. > >
Your linux shell thinks it is running a shell script (from is not a valid command in bash). To execute this script with the python interpreter type (from a shell prompt): python image-harvester.py http://some.url.whatever/images_page Read the comments at the beginning of the script and you will discover all sorts of important usage information. Regards, John -- http://mail.python.org/mailman/listinfo/python-list