Troubleshooting errors when using a MATLAB® external interface is a challenge. Is the error in the Python® application or in your MATLAB code? Common errors include errors reported by Python and errors from attempting to convert Python data to MATLAB and conversely.
MATLAB displays an error message in the following format:
Python Error: Python class: message
message only if there is a Python error message.
This error comes from Python and for information you must refer to your version of Python documentation at
www.python.org/doc or the product
documentation from third-party vendors. For example:
p = py.os.path.split(pwd); py.operator.setitem(p,int32(1),py.str('temp'));
Python Error: TypeError: 'tuple' object does not support item assignment
Search for the term “tuple” on the Python documentation site for your version of Python. Tuple is a built-in function described here:
MATLAB reports some Python errors as a MATLAB error loading a module. For more information, see Unable to resolve the name py.myfunc.
If you write your own Python modules or modify the source code from an existing module, test your MATLAB commands by writing the equivalent Python command in your Python interpreter. This workflow is beyond the scope of MATLAB documentation and product support.
When the data is compatible, MATLAB automatically converts Python data to MATLAB data. For the list of data types you must explicitly convert, see Explicitly Convert Python Types to MATLAB Types.