Skip to content

Fix curl missing --create-dirs for helper files in subdirectories#161

Merged
bendichter merged 1 commit into
masterfrom
fix-curl-create-dirs
May 13, 2026
Merged

Fix curl missing --create-dirs for helper files in subdirectories#161
bendichter merged 1 commit into
masterfrom
fix-curl-create-dirs

Conversation

@bendichter
Copy link
Copy Markdown
Member

The bug

User report from a Colab run of 001_summarize_contents.ipynb:

ModuleNotFoundError: No module named 'helpers'

Three notebooks fetch a helper file via curl into a subdirectory that doesn't exist yet on a fresh Colab runtime:

Notebook Target subdir
001075/001075_paper_figure_1d.ipynb utils_001075/
000458/.../001_summarize_contents.ipynb helpers/
000402/.../microns_nwb_coreg_notebook.ipynb ng_visualization/

curl -o subdir/file.py URL without --create-dirs fails silently when subdir/ doesn't exist — and with -s (silent) you don't even see the error. The install cell appears to succeed; then the next cell hits the ModuleNotFoundError.

Fix

One-flag change per curl: insert --create-dirs right after !curl. That makes curl create the parent directory if it doesn't exist (equivalent to a mkdir -p first).

Curl commands writing to the current directory (e.g. ScanUnit.pkl, ng_utils.py) are untouched — they don't need the flag.

🤖 Generated with Claude Code

Three notebooks fetch a helper .py file via curl into a subdirectory
that doesn't exist yet on a fresh Colab runtime:

  001075/001075_paper_figure_1d.ipynb        -> utils_001075/
  000458/.../001_summarize_contents.ipynb    -> helpers/
  000402/.../microns_nwb_coreg_notebook.ipynb -> ng_visualization/

`curl -o subdir/file.py URL` without --create-dirs fails silently
when `subdir/` doesn't exist — and with -s (silent) you don't even
see the error. The install cell appears to succeed, then the next
cell hits 'ModuleNotFoundError: No module named helpers' (or similar).

Adding --create-dirs makes curl mkdir -p the parent first.

User report from a Colab run of 001_summarize_contents.ipynb:

  ModuleNotFoundError: No module named 'helpers'

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@review-notebook-app
Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 13, 2026

Preview for this PR has been removed (PR closed).

github-actions Bot added a commit that referenced this pull request May 13, 2026
@bendichter bendichter merged commit 117c5d8 into master May 13, 2026
6 checks passed
github-actions Bot added a commit that referenced this pull request May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant