我是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)