Dev Investigation Notes
If a Python import reads your own file instead of the standard library, check whether the file is named inspect.py
While scoring kept failing in an automated content pipeline (content-loop-mvp), I was writing a small diagnostic script to print per-criterion scores. The script wouldn't run on Windows 11, and a file named inspect.py was blamed.
Conclusion
When Python resolves a module, it searches the folder the running script lives in *before* it searches the standard library (the modules that ship with Python itself). So if inspect.py sits in that same folder, import inspect reads that file instead of the standard library's inspect. One line confirms it either way:
python -c "import inspect; print(inspect.__file__)"
If the printed path points inside your own project folder, the standard library has been shadowed.
In this session, that one line was never actually run. The script was renamed and re-run, but an old inspect.py left over in a scratch folder was still being picked up from the same spot , and the record cuts off right there once the session hit its turn limit .
If renaming doesn't fix it and the same error keeps showing up in the same place, do these three things:
- Delete the old
inspect.py. If you don't want to delete it, move it to a different folder. - In the folder you're running from, list
*.py(dir *.pyon Windows,ls *.pyon Mac/Linux) and check whether any other file shares a name with a standard library module. - Re-run the one-liner above and confirm
inspect.__file__now points at the standard library path.
Situation
content-loop-mvp is a Korean-language content pipeline: it generates topic candidates, gathers and cross-checks evidence from the web, writes the article, then has a separate model screen it — only articles that pass get saved. Originally all four stages required an OpenAI or Gemini API key to run . In this session, the decision was made to skip API keys entirely and shell out to the Claude and Codex CLIs as subprocesses to stand in for the model calls . All four stages actually running on Claude came after that . The condition was that the bar (minimum topic score of 75) would not be lowered .
The problem: even with the bar unchanged, five runs in a row produced zero articles. The highest topic score stayed at 74 . Adding per-criterion grading instructions to the scoring prompt and re-running still capped out at 72–74 . So the plan became: write a one-off diagnostic script to print one candidate's score, broken down by criterion .
Symptom
Running the diagnostic script failed. The AI concluded "the file is named inspect.py, which conflicts with the standard library's inspect" and decided to rename it and re-run . But the record doesn't contain the actual error message — there's no line confirming what the error actually was, or that it was really caused by the inspect shadowing.
Cause
The only cause on record is "because the file is named inspect.py." The name does collide with a standard library module, and the one-liner above would confirm the shadowing immediately — but in this session, that confirmation never happened. So this can't be written up as a confirmed cause for this session.
Fix
The plan was to rename the file and re-run, but the old inspect.py left behind in the scratch folder was still being picked up from the same location . Right as the old file was about to be deleted and re-run, the session hit its turn limit . So this article can't claim "fixed." The fix only counts as done once the old file is removed and the one-liner confirms which file is actually being read.
Bonus — renaming the file and removing the old one are not the same thing
Renaming avoids the new file being shadowed, but an old file left in the same folder keeps getting picked up regardless of what you rename the new one to. After renaming, list the folder again and check there isn't another .py file sharing a name with a standard library module. Putting a diagnostic script in a scratch/temp folder sets the same trap.
Reporter's Notes — thought renaming one file would be the end of it
A diagnostic script meant to print per-criterion topic scores won't run. There's no note quoting the actual error message.
inspect.py — it collides with the standard library's inspect inspect? Same name is a guess — have you actually seen which file got read?inspect.py is there, it gets picked up before the standard library. So renaming it should be the end of itinspect.__file__ should print our folder's path. Until you print it, it's just a hypothesisinspect.py was still sitting in the scratch folder