Skip to content

Commit 543ffbd

Browse files
committed
Change tostring to tobytes (closes #136)
1 parent 9fea1bf commit 543ffbd

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

spectral/graphics/rasterwindow.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import wx
99
from spectral.graphics.graphics import SpyWindow
1010

11+
from ..utilities.python23 import tobytes
12+
1113
logger = logging.getLogger('spectral')
1214

1315
class RasterWindow(wx.Frame, SpyWindow):
@@ -26,7 +28,7 @@ def __init__(self, parent, index, rgb, **kwargs):
2628

2729
img = wx.EmptyImage(rgb.shape[0], rgb.shape[1])
2830
img = wx.EmptyImage(rgb.shape[1], rgb.shape[0])
29-
img.SetData(rgb.tostring())
31+
img.SetData(tobytes(rgb))
3032
self.bmp = img.ConvertToBitmap()
3133
self.kwargs = kwargs
3234
wx.Frame.__init__(self, parent, index, title,

spectral/io/envi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
import spectral as spy
2525
from ..spectral import BandInfo
26-
from ..utilities.python23 import IS_PYTHON3, is_string
26+
from ..utilities.python23 import IS_PYTHON3, is_string, tobytes
2727
from ..utilities.errors import SpyException
2828
from .bilfile import BilFile
2929
from .bipfile import BipFile
@@ -681,7 +681,7 @@ def _write_image(hdr_file, data, header, **kwargs):
681681
# bufsize = data.shape[0] * data.shape[1] * np.dtype(dtype).itemsize
682682
bufsize = data.shape[0] * data.shape[1] * data.dtype.itemsize
683683
fout = builtins.open(img_file, 'wb', bufsize)
684-
fout.write(data.tostring())
684+
fout.write(tobytes(data))
685685
fout.close()
686686

687687

0 commit comments

Comments
 (0)