summaryrefslogtreecommitdiff
path: root/numpy/lib/io.py
diff options
context:
space:
mode:
authorStefan van der Walt <stefan@sun.ac.za>2008-07-30 21:12:48 +0000
committerStefan van der Walt <stefan@sun.ac.za>2008-07-30 21:12:48 +0000
commit0d04757c1e9255e920395106d9c176af45ff0b4d (patch)
tree7caa8e2a7bcd0edc764566f66c44f77eba06f2c0 /numpy/lib/io.py
parenta80dbfe6e36a1c4cc455c3ce9b6e563588c7524c (diff)
downloadnumpy-0d04757c1e9255e920395106d9c176af45ff0b4d.tar.gz
Fix string type comparisons.
Diffstat (limited to 'numpy/lib/io.py')
-rw-r--r--numpy/lib/io.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/lib/io.py b/numpy/lib/io.py
index 424df21a6..cc9cf65e0 100644
--- a/numpy/lib/io.py
+++ b/numpy/lib/io.py
@@ -8,7 +8,6 @@ __all__ = ['savetxt', 'loadtxt',
import numpy as np
import format
import cStringIO
-import tempfile
import os
import itertools
@@ -109,7 +108,7 @@ def load(file, memmap=False):
------
IOError
"""
- if isinstance(file, type("")):
+ if isinstance(file, basestring):
fid = _file(file,"rb")
else:
fid = file
@@ -148,7 +147,7 @@ def save(file, arr):
np.save('myfile', a)
a = np.load('myfile.npy')
"""
- if isinstance(file, str):
+ if isinstance(file, basestring):
if not file.endswith('.npy'):
file = file + '.npy'
fid = open(file, "wb")
@@ -171,7 +170,7 @@ def savez(file, *args, **kwds):
# component of the so-called standard library.
import zipfile
- if isinstance(file, str):
+ if isinstance(file, basestring):
if not file.endswith('.npz'):
file = file + '.npz'
@@ -186,6 +185,7 @@ def savez(file, *args, **kwds):
# Place to write temporary .npy files
# before storing them in the zip
+ import tempfile
direc = tempfile.gettempdir()
todel = []