小编Kri*_*in 的帖子

Python入门:属性错误

我是python的新手,今天就下载了它.我正在使用它来处理网络蜘蛛,所以为了测试它并确保一切正常,我下载了示例代码.不幸的是,它不起作用,并给我错误:

"AttributeError:'MyShell'对象没有'已加载'属性"

我不确定代码本身是否有错误,或者我在安装python时未能正确执行某些操作.安装python时是否需要做任何事情,比如添加环境变量等?那个错误通常意味着什么?

以下是我用于导入蜘蛛类的示例代码:

import chilkat
spider = chilkat.CkSpider()
spider.Initialize("www.chilkatsoft.com")
spider.AddUnspidered("http://www.chilkatsoft.com/")
for i in range(0,10):
    success = spider.CrawlNext()
    if (success == True):
        print spider.lastUrl()
    else:
        if (spider.get_NumUnspidered() == 0):
            print "No more URLs to spider"
        else:
            print spider.lastErrorText()

    #  Sleep 1 second before spidering the next URL.
    spider.SleepMs(1000)
Run Code Online (Sandbox Code Playgroud)

python web-crawler attributeerror chilkat

2
推荐指数
1
解决办法
6001
查看次数

标签 统计

attributeerror ×1

chilkat ×1

python ×1

web-crawler ×1