Python - 为什么这个脚本不起作用? [英] Python - why don't this script work?

查看:81
本文介绍了Python - 为什么这个脚本不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用这个很酷的脚本,一些麻省理工学院的人写的只是

不起作用,当我尝试运行它时,我得到了一些错误。这是

应该访问一个URL并抓住网站上的所有图片。这是脚本:

脚本:
http://web.mit.edu/pgbovine/www/imag...e-harvester.py


这是我的输出当我尝试在我的Fedora 6机​​器上运行时:


[ohmster @ ohmster bench] $ image-harvester.py
http://public.fotki.com/DaGennelman/

/ home / ohmster / scripts / image-harvester.py:line 59:from:command not found

[ohmster @ ohmster bench] $


脚本将与另一个一起完成一个用于清除小的

缩略图和横幅图片,这里是基本网址:
http://web.mit.edu/pgbovine/www/image-harvester/

59行在image-harvester.py中如下:


59:来自sgmllib import SGMLParser

60:import urllib

70:来自urlparse import urlparse,urljoin

71:import re

72 :import os

谁能告诉我这个脚本有什么问题以及它为什么不能运行?

它不喜欢命令from,是否有这样的python中的命令?

这是否意味着python具有import命令,但不是来自

命令,或者我们不知道这一点,因为当它击中脚本的第一个单词时,它会立即挂起,从" ;?也许这不是Linux脚本或

的东西?我想知道为什么它还需要x-server,我试过从一个ssh术语窗口运行它

它没有x-server,所以现在我是

在gnome术语窗口中执行此操作。这看起来也很酷。 :(


请耐心等待我,我根本不懂python,我只想要

这个脚本可以工作,如果我看到足够的工作python的例子,我可能只需要对它进行研究,但就目前来说,我不懂语言。

总新手。


谢谢。

-

~Ohmster | ohmster / a / t / ohmster dot com

Put" messageforohmster" ;在邮件正文中

(即邮件正文,而非主题!)

通过我的垃圾邮件过滤器。

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/imag...e-harvester.py

Here is my output when I try to run it on my Fedora 6 machine:

[ohmster@ohmster bench]$ image-harvester.py
http://public.fotki.com/DaGennelman/
/home/ohmster/scripts/image-harvester.py: line 59: from: command not found
[ohmster@ohmster 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.
--
~Ohmster | ohmster /a/t/ ohmster dot com
Put "messageforohmster" in message body
(That is Message Body, not Subject!)
to pass my spam filter.

推荐答案

image-harvester.py
http:// public .fotki.com / DaGennelman /

/home/ohmster/scripts/image-harvester.py:line 59:from:command not found

[ohmster @ohmster bench]
image-harvester.py
http://public.fotki.com/DaGennelman/
/home/ohmster/scripts/image-harvester.py: line 59: from: command not found
[ohmster@ohmster bench]





脚本将与另一个脚本一起用来清除小的

缩略图和横幅图像es,这是基本网址:
http:/ /web.mit.edu/pgbovine/www/image-harvester/


image-harvester.py中的第59行内容如下:

59:来自sgmllib import SGMLParser

60:import urllib

70:来自urlparse import urlparse,urljoin

71:import回复

72:导入os

谁能告诉我这个脚本有什么问题以及它为什么不运行?

它不喜欢命令from,在python中是否有这样的命令?

这是否意味着python具有import;命令,但不是来自

命令,或者我们不知道这一点,因为当它击中脚本的第一个单词时,它会立即挂起,从" ;?也许这不是Linux脚本或

的东西?我想知道为什么它还需要x-server,我试过从一个ssh术语窗口运行它

它没有x-server,所以现在我是

在gnome术语窗口中执行此操作。这看起来也很酷。 :(


请耐心等待我,我根本不懂python,我只想要

这个脚本可以工作,如果我看到足够的工作python的例子,我可能只需要对它进行研究,但就目前来说,我不懂语言。

总新手。


谢谢。

-

~Ohmster | ohmster / a / t / ohmster dot com

Put" messageforohmster" ;在邮件正文中

(即邮件正文,而不是主题!)

通过我的垃圾邮件过滤器。


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.
--
~Ohmster | ohmster /a/t/ ohmster dot com
Put "messageforohmster" in message body
(That is Message Body, not Subject!)
to pass my spam filter.


10月22日晚上9点47分,Ohmster< r ... @ dev.nul.invalidwrote:
On Oct 22, 9:47 pm, Ohmster <r...@dev.nul.invalidwrote:

我正在尝试使用这个很酷的脚本麻省理工学院的家伙写道,它只是

不起作用,当我尝试运行它时,我得到了一些错误。这是

应该访问一个URL并阻止所有网站上的图片。这是

剧本: http://web.mit.edu/pgbovine/www/imag...e-harvester.py


当我尝试在我的Fedora 6机​​器上运行它时,这是我的输出:


[ohmster @ ohmster bench]
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/imag...e-harvester.py

Here is my output when I try to run it on my Fedora 6 machine:

[ohmster@ohmster bench]


这篇关于Python - 为什么这个脚本不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆