Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ same name. For example, to call the function jk in jk.m:
you would call:

res = mlab.run_func('path/to/jk.m', {'arg1': 3, 'arg2': 5})
print res['result']
print(es['result'])

This would print `8`.

Expand Down
20 changes: 10 additions & 10 deletions messenger/make.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python

from __future__ import print_function
import os
import sys
import fnmatch
Expand All @@ -8,7 +8,7 @@

# Check the system platform first
platform = sys.platform
print "This is a " + platform + " system"
print("This is a " + platform + " system")

if platform.startswith('linux'):
messenger_dir = 'mexa64'
Expand All @@ -25,30 +25,30 @@
# Open the configure file and start parsing
config = open(os.path.join(messenger_dir, 'local.cfg'), 'r')

for line in config:
for line in config.decode('utf-8'):
path = line.split('=')

if path[0] == "MATLAB_BIN":
print "Searching for Matlab bin folder in local.cfg ..."
print("Searching for Matlab bin folder in local.cfg ...")
matlab_bin = path[1].rstrip('\r\n')
if matlab_bin == "":
raise ValueError("Could not find Matlab bin folder. Please add it to local.cfg")
print "Matlab found in " + matlab_bin
print("Matlab found in " + matlab_bin)

elif path[0] == "HEADER_PATH":
print "Searching for zmq.h in local.cfg ..."
print("Searching for zmq.h in local.cfg ...")
header_path = path[1].rstrip('\r\n')
if header_path == "":
raise ValueError("Could not find zmq.h. Please add its path to local.cfg")
print "zmq.h found in " + header_path
print("zmq.h found in " + header_path)

elif path[0] == "LIB_PATH":
print "Searching for zmq library in local.cfg ..."
print("Searching for zmq library in local.cfg ...")
lib_path = path[1].rstrip('\r\n')
if lib_path == "":
raise ValueError("Could not find zmq library. Please add its path to local.cfg")

print "zmq library found in " + lib_path
print("zmq library found in " + lib_path)

config.close()

Expand All @@ -62,7 +62,7 @@
check_extension = subprocess.Popen(extcmd, stdout = subprocess.PIPE)
extension = check_extension.stdout.readline().rstrip('\r\n')

print "Building messenger." + extension + " ..."
print("Building messenger." + extension + " ...")

# Build the mex file
if platform == 'win32':
Expand Down
4 changes: 2 additions & 2 deletions pymatbridge/examples/pymatbridge.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
" display_data.append(('MatlabMagic.matlab',\n",
" {'text/plain':text_output}))\n",
"for imgf in imgfiles:\n",
" image = open(imgf[0], 'rb').read() \n",
" image = open(imgf[0], 'rb').read().decode('utf-8') \n",
" display_data.append(('MatlabMagic.matlab', {'image/png': image}))\n",
"\n",
"for tag, disp_d in display_data:\n",
Expand Down Expand Up @@ -257,4 +257,4 @@
"metadata": {}
}
]
}
}
2 changes: 1 addition & 1 deletion pymatbridge/matlab_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def matlab(self, line, cell=None, local_ns=None):
if len(imgf):
# Store the path to the directory so that you can delete it
# later on:
image = open(imgf, 'rb').read()
image = open(imgf, 'rb').read().decode('utf-8')
if ipython_version < 3:
display_data.append(('MatlabMagic.matlab',
{'image/png':image}))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def copy_bin(bin_path):

# Get version and release info, which is all stored in pymatbridge/version.py
ver_file = os.path.join('pymatbridge', 'version.py')
exec(open(ver_file).read())
exec(open(ver_file).read().decode('utf-8'))

opts = dict(name=NAME,
maintainer=MAINTAINER,
Expand Down