2011-04-07 39 views
0

我正在處理其他人的代碼,並且它拋出了一個錯誤,'InputStreamError'未定義。我是python的新手,不確定如何知道InputStreamError的定義以及如何從代碼中引用它。python - inputstreamerror未定義

這是我在此刻得到了:

from hachoir_core.error import HachoirError 
from hachoir_core.cmd_line import unicodeFilename 
from hachoir_parser import createParser 
from hachoir_core.tools import makePrintable 
from metadata import extractMetadata 
from hachoir_core.i18n import getTerminalCharset 
from sys import argv, stderr, exit 

def getMetadata(inputFilename): 
    filename, realname = unicodeFilename(inputFilename), inputFilename 

    try: 
     parser = createParser(filename, realname) 
    except InputStreamError: 
     print "File cannot be found." 
     return 
    ... 

人有我怎麼能排序了這一點任何想法?

回答

2

嘗試添加

from hachoir_core.stream.input import InputStreamError 
+0

完美。我想我只是想念一個參考.. – tiswas 2011-04-07 11:49:43