| Reference | Downloads | Github

Functionality loss of built-in functions after importing sound module



Hi there!

I’m trying to program a psychological experiment in which both visual and auditory stimuli are presented. I’m working on MacOS High Sierra 10.13.6 and use Python 2.7 with Psychopy 1.90.1. Before the actual start of my experiment starts, I request some manual inputs (e.g. participant initials, counter-balanced button-press version etc.) for which I use the built-in raw_input function.

However, if I specifically import the sound module of psychopy (both with “from psychopy.sound import Sound” and “from psychopy import sound”), the raw_input prompts disappear from my terminal. I do not get any errors and the presentation of stimuli works just fine,

So this is not very disastrous for the rest of the script, but it seems like a strange bug to me. Does anyone have any idea where this comes from and how I can fix it?

Thanks in advance!



Hi @stijnnuiten, there are alternatives to using raw_input, for example making use of PsychoPys gui module. If you add this to the beginning of your code, a gui will pop up before the experiment begins and store your entries in a dict, that you can access at any point during the script, e.g., for use in data filenames when saving the data.

# Store info about the experiment session
expName = 'untitled'  # from the Builder filename that created this script
expInfo = {'participant': '', 'session': '001'}
dlg = gui.DlgFromDict(dictionary=expInfo, title=expName)
if dlg.OK == False:
    core.quit()  # user pressed cancel



Thanks @dvbridges! This works fine indeed.