bastibe / transplant

Transplant is an easy way of calling Matlab from Python
https://transplant.readthedocs.io
Other
110 stars 26 forks source link

Problem with from transplant_master import Matlab #20

Closed vl13666 closed 7 years ago

vl13666 commented 7 years ago

Hello, i'm facing problem with importing Matlab class. I'm using python 2.7 and Matlab R2015b.

transplant_master.py, line 446 def call(_self, *args, nargout=-1):
^ SyntaxError: invalid syntax

also had problem with line 133 from the same file print(line.decode(), end='') that i fixed by adding : from future import print_function in the beggining of the file.

May be you have some suggestions about first problem? Thanks in advance.

bastibe commented 7 years ago

Please try running Transplant in Python 3 and see if that fixes your problem.

vl13666 commented 7 years ago

It works on python 3.4, but do you have any ideas how to fix it less radically and still use on python 2.7?

bastibe commented 7 years ago

Apparently, you can't mix *args and keyword arguments in Python 2. You can fix it by replacing the keyword argument with **kwargs, and pulling nargout out later.

bastibe commented 7 years ago

On further thought, the above change would complicate that function significantly. I would recommend using Python 3.