W
W
WH1T3_B0X2021-11-10 22:19:41
Visual Studio Code
WH1T3_B0X, 2021-11-10 22:19:41

How to make a python script run where it is in vs code?

I have been using the vs code text editor for 3 months now, but when I was mastering the os library, I ran into a problem:
If in vs code I opened folder A, which has folder B and it contains a script that should make folder C in the
same folder as the script , but for some reason the script creates a folder in the folder that I opened.
In the same pycharm, everything is created correctly.
I understand that this is due to the fact (judging by the discussions in the forums) that Pycharm runs the script where it is located.
A vs code runs it in the folder that was opened via vs code.
I tried making various edits to the launch.json file, but that didn't help.
Here's how it works on pycharm:
618c1a16da47c458048073.png
Here's how it works on vs code:
618c1a4b879e3429924704.png
As you can see on the screenshots in pycharm, everything was created in the folder where the script was.
And on vs code, for some reason, everything is created in the folder that I opened through vs code.
Perhaps this is solved by some plugins, but I do not know of such.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question