On Oct 22, 9:47 pm, Ohmster <[EMAIL PROTECTED]> 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.pyhttp://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 > > 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.
I think you're executing it as a shell script. Run "python image- harvester.py", or add "#!/usr/bin/env python" to the top of the file. -- http://mail.python.org/mailman/listinfo/python-list