I am using VSCode. I have the following setup:
.
├── output
│
└── src
├── foo
│
└── main.py
I have some code that does a bunch of stuff and then creates an output excel file.
I am storing my results using pandas ExcelWriter:
writer = pd.ExcelWriter('../output/MyOutput.xlsx', engine='xlsxwriter').
Note that the relative path points to the folder output in the root directory.
The file is properly stored in the directory when I run the code using python terminal.
.
├── output
│ └── MyOutput.xlsx
└── src
├── foo
│
└── main.py
However I when running my code using: Run Current File in Python Interactive Window (based on IPython I presume) the file is simply created in the script directory.
.
├── output
│
└── src
├── foo
│
├── main.py
└── MyOutput.xlsx
I believe this has something to do with the way IPython works and is not a bug in my code.
So my question is, how to properly write my code so that both when running the interactive window and the python terminal the output ends up in the desired folder?
Bonus: If my guess is correct and this is the normal IPython behavior, could you point me to some reference or explain how it works?
output/directory somewhere to put the file in. Having it end up just insrc/should not be possible based on that line, else there's a bug on pandas.