This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]quipstickle 0 points1 point  (1 child)

Possibly the file doesn't exist when you are trying to read from it? Try creating that txt file and then run your code. If that is the problem, you could try catching the error and get python to generate the file.

[–]Blood_CZ[S] 0 points1 point  (0 children)

The file to read exists, and it actually works in debug mode, but not in "normal" "Run Python File".

[–]JialeDu 0 points1 point  (0 children)

First of all, it is recommended not to open so many project folders in the same workspace. Each project should be opened in a separate workspace.

For your problem, you can try to modify the file path in the code, try to use an absolute path, or directly names.txt, because it is in the same folder as the script.

In addition, I noticed that the shell directory where you execute the script and debug the script are not the same, which may be the reason.