drbenvincent / darc_toolbox

Run adaptive decision making experiments
MIT License
16 stars 2 forks source link

improve adding package folders to path #78

Open drbenvincent opened 5 years ago

drbenvincent commented 5 years ago

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.