Error while finding module specification for 'app.main'

I’m stuck on Stage #ZV2.

it looks like the test runner cant find my code?
Running ./your_program.sh locally does work…?

Here are my logs:

Submitting changes (commit: 6d9b6ad)...
⏳ Turbo test runners busy. You are in queue.

Upgrade to skip the wait: https://codecrafters.io/turbo

Running tests on your code. Logs should appear shortly...

[compile] Moved ./.codecrafters/run.sh → ./your_program.sh
[compile] Compilation successful.

Debug = true

[tester::#ZV2] Running tests for Stage #ZV2 (Filename Completion - File completion)
[tester::#ZV2] [working_dir] - grape-7.txt
[tester::#ZV2] Running ./your_program.sh
[your-program] /usr/local/bin/python: Error while finding module specification for 'app.main' (ModuleNotFoundError: No module named 'ap
[tester::#ZV2] ^ Expected prompt ("$ ") but received "/usr/local/bin/python: Error while finding module specification for 'app.main' (ModuleNotFoundError: No module named 'ap"
[your-program] p')
[tester::#ZV2] Assertion failed.
[tester::#ZV2] Test failed

View our article on debugging test failures: https://codecrafters.io/debug

Repo

1 Like

Hey @Zeviraty, could you upload your code to GitHub and share the link? It will be much easier to debug if I can run it directly.

I have, the repo is linked in the main post

@andy1li ?

I have the same issue as OP has. Previous steps finish successfully, but new ZV2 fails on the early stage.

[your-program]     3  echo apple orange pineapple
[your-program]     4  echo orange blueberry
[your-program]     5  history
[tester::#JV2] ✓ History before exiting is correct
[your-program] $ exit
[tester::#JV2] ✓ Program exited successfully
[tester::#JV2] ✓ Found 6 commands in history file
[tester::#JV2] Test passed.

[tester::#ZV2] Running tests for Stage #ZV2 (Filename Completion - File completion)
[tester::#ZV2] [working_dir] - blueberry-90.txt
[tester::#ZV2] Running ./your_program.sh
[your-program] Creating a virtualenv for this project
[tester::#ZV2] ^ Expected prompt ("$ ") but received “Creating a virtualenv for this project”
[your-program] Pipfile: /tmp/pineapple/strawberry/raspberry/Pipfile
[your-program] Using /usr/local/bin/python3.13.12 to create virtualenv…
[your-program] ⠦ Creating virtual environment…created virtual environment CPython3.13.12.final.0-64 in 311ms
[your-program]   creator CPython3Posix(dest=/venvs/raspberry-dckYyxiR, clear=False, no_vcs_ignore=False, global=False)
[your-program]   seeder FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/root/.cache/virtualenv)
[your-program]     added seed packages: pip==26.0.1
[your-program]   activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
[your-program]
[your-program] ✔ Successfully created virtual environment!
[your-program] Virtualenv location: /venvs/raspberry-dckYyxiR
[your-program] Creating a Pipfile for this project…
[your-program] /venvs/raspberry-dckYyxiR/bin/python3: Error while finding module specification for ‘app.main’ (ModuleNotFoundError: No
[your-program] module named ‘app’)
[tester::#ZV2] Test failed

Same here

Looks like this is an issue on our end. We’re actively investigating it and will share an update as soon as a fix is available.

Hey everyone! To fix this, please update .codecrafters/run.sh to the following:

#!/bin/sh

set -e

SCRIPT_DIR="$(dirname "$0")"

PYTHONSAFEPATH=1 PYTHONPATH="$SCRIPT_DIR" exec uv run \
  --project "$SCRIPT_DIR" \
  --quiet \
  -m app.main \
  "$@"

Let me know if it still fails after the update.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.