0
votes

I'm teaching myself a little bit of programming in python and also matlab. And I need to run a couple of functions I wrote in python with matlab.

I've followed the basic install instructions for pymatlab and python(x,y). When I try to create a MATLAB session with the following code:

import pymatlab
session = pymatlab.session_factory()

I get the following error:

Exception AttributeError: "'MatlabSession' object has no attribute 'engine'" in <bound method MatlabSession.__del__ of <pymatlab.matlab.MatlabSession object at 0x03654AF0>> ignored

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    session = pymatlab.session_factory()
  File "C:\Python27\lib\site-packages\pymatlab\sessionfactory.py", line 51, in session_factory
    session = MatlabSession(path=basedir,bufsize=output_buffer_size)
TypeError: __init__() got an unexpected keyword argument 'path'

Help please!

1
This seems to be a compatibility issue. Which ML-Version, which python version and which OS? - Daniel
Daniel, thanks for the quick response - I somehow missed it! I'm running a 64bit version of windows, but 32bit versions of MATLAB, Python, numpy, and pymatlab unfortunately. I believe the officially supported versions of numpy are 32bit.. - user3050521

1 Answers

2
votes

It's a bug need fixed in windows platform. you can open the file "C:\Python27\lib\site-packages\pymatlab\sessionfactory.py" and locate the line 51, remove argument prefix "path="

MatlabSession(path=basedir,bufsize=output_buffer_size) 

Change into

MatlabSession(basedir,bufsize=output_buffer_size) 

Then you can enjoy your pymatlab.