fooof_mat icon indicating copy to clipboard operation
fooof_mat copied to clipboard

Python Error: AttributeError: 'array.array' object has no attribute 'fromstring'

Open AMMDR opened this issue 3 years ago • 7 comments

Hi There, I'm new to MatLab and Python..

Thanks for this foof code!

I'm using MatLabR2020a and have Pythern version 3.9.2 installed.

I'm receiving the following error:

fooof_results = fooof(freqs, power_spectrum, f_range, settings, return_model); Python Error: AttributeError: 'array.array' object has no attribute 'fromstring'

Does anyone have any advice as to what this means/how I can fix this?

AMMDR avatar Apr 01 '21 15:04 AMMDR

Hey, I got the same error. I solved it downgrading to Python 3.6.

JuliusWelzel avatar Apr 12 '21 09:04 JuliusWelzel

Thanks for the update @JuliusWelzel! Sorry for not getting back to the original post @AMMDR - Matlab / Python errors can be difficult to debug, and I didn't initially know what was going on here. I would recommend downgrading Python and seeing if that helps. If anyone figures out any more details on which details worked, or what changed to create this issue, please let us know, and we can try and add some notes about it.

Also, as a general reminder, once you have Python installed, the https://github.com/fooof-tools/mat_py_mat approach can also be used to integrate spectral parameterization into a Matlab workflow.

TomDonoghue avatar Apr 12 '21 15:04 TomDonoghue

Hi @JuliusWelzel and @TomDonoghue thanks so much for the help. Downgrading to Python 3.6 did the job! What a weird one!

AMMDR avatar Apr 13 '21 10:04 AMMDR

Just got the same and found this related info: https://www.mathworks.com/matlabcentral/answers/638735-matlab-numpy-array-attributeerror-array-array-object-has-no-attribute-fromstring

@TomDonoghue I recommend mentioning in the install that 3.6 should be used. Sidenote: I also needed to follow this to make MATLAB recognize the Anaconda install (Win 10): https://www.mathworks.com/matlabcentral/answers/502458-why-can-py-numpy-array-not-be-resolved, maybe worth mentioning, too :)

MariusKlug avatar Dec 16 '21 11:12 MariusKlug

same error here! Anyone has a tip for me how I can downgrade my python 3.10 to 3.6?

KarlHerold avatar Apr 29 '22 12:04 KarlHerold

I got this error from as unrelated project, not sure if it is related: https://discourse.panda3d.org/t/attributeerror-array-array-object-has-no-attribute-fromstring-when-using-setup-py/26759

It looks like Python 3.9 removed fromstring(). You could manually fix the file in question or try Python 3.8. We need to fix this in the next version of Panda3D.

This is inline with what @MariusKlug said. so probably downgradeing would work. I am looking for alternatives

mnumanuyar avatar Aug 10 '22 05:08 mnumanuyar

Hi Tom,

Since python version 3.6 is not supported anymore. Do you have any updated m file to solve this problem? I am using the Matlab-Python approach. Thanks.

michaelhello007 avatar Sep 11 '23 17:09 michaelhello007