1

Suddenly I am seeing warnings from the IPython debugger ipdb that my code is stale, however editing / saving code while debugging is a common use case so this warning is not helpful.

*** WARNING: file <path-to-file.py> was edited, running stale code until the program is rerun

The message appears when I use the following in <path-to-file.py> as a debug breakpoint.

from ipdb import set_trace
...
set_trace()

IPython will stop at the debug breakpoint, then after editing / saving <path-to-file.py> the warning message begins to appear in the debugger console. Looking to completely disable this warning.

ipdb 0.13.13 ipython 8.28.0

1 Answer 1

0

I am seeing the same behavior on both Python 3.12 and 3.13 as the result of the following code:

scriptFile = self.writeScriptFile(script)
exec(compile(script, scriptFile, 'exec'), d)

where the script contains a breakpoint statement.

I fixed the problem as follows in writeScriptFile:

mod_time = os.path.getmtime(path)                  # New
with open(path, encoding='utf-8', mode='w') as f:  # Existing
    f.write(script)                                # Existing
os.utime(path, (mod_time, mod_time))               # New

HTH

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for looking into this! Can you please share those file locations relative to the environment path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.