Make iddversiontuple function find version number in string buffer
Previously this only worked with a filehandle.
@@ -31,12 +31,14 @@ def iddversiontuple(afile):
except TypeError:
fhandle = afile
line1 = fhandle.readline()
+ if line1 == '':
+ line1 = fhandle.buf.split('\n')[0]
try:
line1 = line1.decode('ISO-8859-2')
except AttributeError:
pass
line = line1.strip()
- if line1 == '':
+ if line == '':
return (0,)
vers = line.split()[-1]
return versiontuple(vers)
