Relative paths to github directories in Binder-hosted Jupyter notebook

Hi,
I have a Jupyter notebook that functioned properly a few months ago but now does not. Specifically it searches a local directory in the same GitHub repo as is hosting the Jupyter notebook and parses some files for a query demo.

Previously I did the following which worked but doesn’t seem to anymore. So my files are in subdirectories with this relative path from the location of the Jupyter notebook:

glob2.glob("…/…/terms/OpenNeuro_Datasets_terms/OpenNeuro_jsonld/**")

For what it’s worth, this notebook works fine locally but just not when Binder is hosting it.

Thanks!
Dave

Hi! Can you share a link to your GitHub/Binder repo? That should help someone figure out your problem.

Here it is, thanks: https://github.com/NIDM-Terms/terms/blob/f414743e1528a01367beb90bbf2f93c630f78d41/utils/query_demo/SimpleConceptQueryExample.ipynb

You have a typo in the path for your glob function in the notebook terms/SimpleConceptQueryExample.ipynb at f966b367569e2aa43b49504382e7565aa3521347 · NIDM-Terms/terms · GitHub . Your OpenNeuro_jsonld directory is in OpenNeuro_Datasets_Terms and not OpenNeuro_Datasets_terms. It should read:

for dataset in glob2.glob("../../terms/OpenNeuro_Datasets_Terms/OpenNeuro_jsonld/**")

Maybe whatever system you are trying it locally is less sensitive about case? Or maybe you have a mismatch in the name locally?

Also, glob is now part of the standard library. No need to use glob2 anymore, see Stefan’s Februarry 4th comment here.

1 Like

Wow, upps. That makes sense though. Thanks for the troubleshooting. Sorry about spamming the forum! :slight_smile:

1 Like