Bug caused by setting the breakpoint
from flask import Flask
import os
app = Flask(__name__)
if __name__ == '__main__':
for root, dirs, files in os.walk('/Users/test/dir/', topdown=False):
for filename in files:
print(filename) #An exception will occur at this breakpoint
app.run()
The exception is as follows:
Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 1551, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/test/inngke/python/ai_util_script/test.py", line 9, in <module>
print(filename)
NameError: name 'filename' is not defined
If this breakpoint is absent, the program runs normally.
Please sign in to leave a comment.
Hi Islujian , I am not able to reproduce this behavior on the recent 2024.1.4 release.
For better understanding of the issue, would you please share a screenshot of you Run / Debug configuration along with logs from Help | Collect Logs and Diagnostic Data ?
The directory for os.walk must be empty
Islujian , thank you for the screenshots!
Would you be able to run
test.py
outside of IDE in the same conda environment? Would it run without errors? If not, then the issue is most probably not related to IDE.Can you share a minimal simplified project (as a directory zipped) including requirements.txt for us to reproduce this behavior?
Please also share logs from Help | Collect Logs and Diagnostic Data for better understanding of the issue. Please upload it to https://uploads.services.jetbrains.com and let me know the upload ID.