【发布时间】:2011-11-15 18:23:17
【问题描述】:
我正在尝试执行我的 Python 脚本:
python series.py supernatural 4 6
超自然:电视剧名称
4:季号
6:集数
现在在我的脚本中,我使用上述三个参数来获取剧集的标题:
import tvrage.api
import sys
a = sys.argv[1]
b = sys.argv[2]
c = sys.argv[3]
temp = tvrage.api.Show(a)
name = temp.season(b).episode(c) # Line:19
print ( name.title)
但我收到此错误:
File "series.py", line 19, in <module>:
name = super.season(b).episode(c)
File "C:\Python26\Lib\site-packages\tvrage\api.py", line 212, in season
return self.episodes[n] KeyError: '4'
我使用的是 Python 2.6。
【问题讨论】:
-
实际上错误指向我正在使用的 api,但如果你想要错误是`文件“series.py”,第 19 行,在
name = super.season(b).episode( c) 文件“C:\Python26\Lib\site-packages\tvrage\api.py”,第 212 行,in season` return self.episodes[n] KeyError: '4'
标签: python arguments command-line-arguments