I basically had only 1 line of code, that is:
data = pd.read_excel('Physical properties.xlsx', index_col=1, header=3)
this line works if it was in ipynb format, but produces [Errno 2] No such file or directory error if was run in py format. Both file exist in the same folder as the excel file, both has the exact same code (because I copy-pasted it). It does work if I put it as r'directory', but I'm wondering why it didnt work as just namefile.xlsx
It does work if I put it as r'directory', but I'm wondering why it didnt work as just namefile.xlsx
You can use Debug mode in VSCode. Vscode uses the workspace as the root directory to search for files, so you need to make additional settings.
You have to add
"cwd": "${fileDirname}"to yourlaunch.json. Then click as the following figure:This is the directory structure I use to reproduce the problem:
test.py
launch.json