0

I am facing this problem while my "from src.simulation.simulator import Simulator" is in the same directory. what should i do now to resolve this problem?

I have tried to solve this problem but did not understand what to do!!

  • Can you explain a bit more about your folder structure/packages ? Python import are notably difficult to use for a beguinner for custom packages. I encourage to read this source :https://realpython.com/python-import/ – Zelemist Nov 10 '22 at 06:48
  • Please provide enough code so others can better understand or reproduce the problem. – Community Nov 10 '22 at 16:31
  • Can [this answer](https://stackoverflow.com/a/61575987/18359438) solve your issue? – MingJie-MSFT Nov 11 '22 at 01:27

1 Answers1

0

Since you haven't updated for a long time, I have made a guess.

This maybe caused by vscode using workspace as root floder.

This will lead to a problem. When you use the os.getcwd() method in the deep directory of the workspace, you will still get the workspace directory.

You can open your settings and search Python > Terminal: Execute In File Dir then check it.

enter image description here

You can also use debug mode and add the following to your launch.json:

"cwd": "${fileDirname}"
MingJie-MSFT
  • 5,569
  • 1
  • 2
  • 13