Experiment keeps showing "Variable name $_doc_is in use (by psychopy module). Try another name

Experiment keeps showing "Variable name $_doc_is in use (by psychopy module). Try another name when I click on the keyboard component. I have tried entering different names but nothing works.

1 Like

Iā€™m not sure, but I have a feeling that variables starting with a _ might be reserved. Have you only tried variables starting with _ (or $_ ?) ?

I donā€™t think there are any names for modules that start with _ but I will double check :slight_smile:
would you also know how to solve:
matplotlib.font_manager:findfont: Font family [ā€™ā€™] not found. Falling back to DejaVu Sans

So It seems like the only way to make it stop is if I use a ā€œ,ā€ after the allowed keys. I donā€™t know why but it works.

Ah yes, I know that new bug well.

Allowed keys have to be a list. If you have a single allowed key it gets interpreted as a string, e.g. ā€˜spaceā€™ unless you change it to:

  1. [ā€˜spaceā€™]
  2. ā€˜spaceā€™,ā€˜spaceā€™ OR
  3. ā€˜spaceā€™,
3 Likes

__doc__ goes deeper than just PsychoPy, itā€™s a reserved keyword for all of Python. Itā€™s the name of the current document youā€™re working in. Variables beginning with _ usually mean ā€œthis is something relevant to the inner workings of this packageā€, variables beginning with __ usually mean ā€œthis is something coming from the inner workings of Python itselfā€.

Whatā€™s probably happening is youā€™ve set something to be equal to __doc__, meaning when the code then says __doc__ = whatever it tries to set the current document rather than changing the value of your variable, but when itā€™s in a list and the code sets it, it will just replace the cell itā€™s in.