diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/imghdr.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Lib/imghdr.py b/Lib/imghdr.py index c320594..422471f 100644 --- a/Lib/imghdr.py +++ b/Lib/imghdr.py @@ -2,13 +2,19 @@ #-------------------------# -# Recognize sound headers # +# Recognize image headers # #-------------------------# -def what(filename, h=None): +def what(file, h=None): if h is None: - f = open(filename, 'r') - h = f.read(32) + if type(file) == type(''): + f = open(file, 'rb') + h = f.read(32) + else: + location = file.tell() + h = file.read(32) + file.seek(location) + f = None else: f = None try: |