darc_toolbox icon indicating copy to clipboard operation
darc_toolbox copied to clipboard

improve adding package folders to path

Open drbenvincent opened this issue 6 years ago • 0 comments

At the moment we have this

sys.path.insert(0, '../') # relative coding of 'up' two folders.

which is ok for the PsychoPy demo stuff. But it's fragile. When we copy/paste demo experiments to start new ones, then it's clumsy.

How

import sys
from os.path import expanduser 

home = expanduser("~")
sys.path.insert(0, home + '/git-local/darc-experiments-python')  # absolute path

But also add in a check that that path exists and give a meaningful error if not.

Note

This will become redundant (in the demo .psyexp experiments) once bad and darc are included as part of PsychoPy.

drbenvincent avatar Feb 24 '19 15:02 drbenvincent