little precaution

This commit is contained in:
Miroslav Stampar 2010-11-23 15:31:23 +00:00
parent 4af000e699
commit 78024eafe0

View File

@ -1343,6 +1343,11 @@ def getFileItems(filename, commentPrefix='#', unicode_=True):
if line.find(commentPrefix) != -1:
line = line[:line.find(commentPrefix)]
line = line.strip()
if not unicode_:
try:
str.encode(line)
except UnicodeDecodeError:
continue
if line:
retVal.append(line)