MATLAB Answers

error while executing py.textwrap.wrap(T)

5 views (last 30 days)
Avinash Siddaramappa
Avinash Siddaramappa on 6 Jul 2015
Commented: Robert Snoeberger on 17 Dec 2015
I am working on MATLAB 2015a, and would like to run Python script on matlab. I tried the example, unfortunately I get an error: Undefined variable "py" or class "py.textwrap.wrap".
This is the output for pyversion: version: '2.7' executable: 'C:\Python27\pythonw.exe' library: 'C:\Python27\python27.dll' home: 'C:\Python27' isloaded: 0
Shouldn't isloaded be 1 insead of 0?
I even tried the suggested troubleshoot

  1 Comment

Robert Snoeberger
Robert Snoeberger on 7 Jul 2015
You are correct, isloaded should be 1.

Sign in to comment.

Answers (2)

Robert Snoeberger
Robert Snoeberger on 6 Jul 2015
Are you using 64-bit MATLAB? If so, did you check if both MATLAB and Python are 64-bit?

  2 Comments

Robert Snoeberger
Robert Snoeberger on 7 Jul 2015
Can you provide the output of the following two MATLAB commands?
>> computer arch
>> system('C:\Python27\pythonw.exe -c "import platform; print platform.architecture()"');

Sign in to comment.


Matthew Connolly
Matthew Connolly on 16 Dec 2015
It seems like this question was never ansewered. I am running into the same problem. My output from the aforementioned commands is as follows:
>> computer arch
ans =
win64
>> system('C:\Python27\pythonw.exe -c "import platform; print platform.architecture()"');
('64bit', 'WindowsPE')
Any help on this would be appreciated.

  1 Comment

Robert Snoeberger
Robert Snoeberger on 17 Dec 2015
I recommend that you contact MathWorks technical support [1].

Sign in to comment.

Sign in to answer this question.