How to import python file located in same subdirectory in a pycharm project

前端 未结 8 1596
盖世英雄少女心
盖世英雄少女心 2020-12-13 08:48

I have an input error in pycharm when debugging and running.

My project structure is rooted properly, etc./HW3/. so that HW3 is the root di

8条回答
  •  Happy的楠姐
    2020-12-13 09:01

    I had the same issue with pycharm, but the actual mistake was that the file I was trying to import didn't have a .py extension, even though I was able to run it as a standalone script. Look in the explorer window and make sure it has a .py extension. If not, right click on the file in the explorer window, pick refactor, and then rename it with a .py extension.

提交回复
热议问题