| Reference | Downloads | Github

Error when running sounds from pycharm


I am trying to use .py file generated from coder shell. I am trying to run it from terminal and pyCharm, but it ended with error:

python(14181,0x7fff767b1300) malloc: *** error for object 0x7ff14fa15050: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

I tried it line by line in terminal. The same malloc error occured in line

sound_1 = sound.Sound(‘sounds/applause.wav’, secs=-1)

which doesn’t seem to have any problem. Can I use py file generated from psychopy in python environment? Thanks a lot

I just deleted that line. works perfectly without it

I’m afraid I don’t test/debug psychopy on other editors. The standalone distribution with the built-in editor is designed so that I only have to handle a single known editor. My guess here is that the sound output requires a new thread or process and that pycharm doesn’t allow that. But it’s hard to know.

Does your script run from the standalone app?

Thank you Jon
and yes, it works from psychopy
What I intended when using it in pycharm was that I had to run three discrete experiments in a row. I didn’t want a subject to write personal information three times so I thought including three experiments in a python script which gets personal information, and sequentially runs three .py files may work. Other than that, I wanted to edit the compiled python script to save data in a form I designed. Can I do that in psychopy app?

Hi, what does your Run Configuration look like? Could you please ensure that Show command line afterwards is unchecked, and to only run the code in Run, not Debug mode? Which Python interpreter/environment do you use in PyCharm? Is it the environment from the PsychoPy standalone install, or did you set up an entirely new Python installation?

1 Like

Yes, PsychoPy includes an editor: the coder view. Try opening the app and having a look?

Also, for thinking about running multiple experiments with one call, you could check out this post on a similar question , which discusses calling multiple files from a central main script. To not repeat the information input, you could pass that information as an argument to the calls to other experiments.

Okay, so the best way is to remain in standalone domain. Thanks, I’ll try it.

I tried run from pycharm(uses anaconda installed python) and shell and both are 2.7. I could not import psychopy through standalone installation(it failed), so I separately installed psychopy module through pip install. I’m bit confused since all lines apart that one are perfectly working… I decided to just erase it but thank you for your specific comment!


I don’t really understand. In PyCharm, you should be able select the Python environment from PsychoPy’s standalone installation as your Python interpreter of choice. Importing psychopy from there should work flawlessly if that standalone installation is not broken.

Installing PsychoPy into an entirely new environment via pip will certainly not take care of all the dependencies (e.g., Pyo), so is bound to fail.