psychopy.org | Reference | Downloads | Github

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.