0

This should really raise an error if file not found

This commit is contained in:
Andrew Brown
2011-11-06 20:35:11 -05:00
parent 3f54347735
commit 6e2d52ceee

View File

@@ -18,14 +18,13 @@ import struct
import StringIO
import os
import numpy
from functools import wraps
# decorator to handle filename or object as first parameter
def _file_loader(func):
@wraps(func)
def wrapper(fileobj, *args):
if isinstance(fileobj, basestring):
if not os.path.isfile(fileobj):
return None
# Is actually a filename
fileobj = open(fileobj, 'rb',4096)
return func(fileobj, *args)