Jul-25-2024, 07:47 AM
On a recent installation of Windows 10 I installed Python 3.12, things seemed to be working fine until I had difficulties importing other files. Which was weird considering I had no difficulties doing this on my Linux computer earlier. I thought maybe I was misremembering so I looked up some tutorials online and tried following them but still no luck.
Eventually I resorted to uninstalling Python 3.12 and downgrading to 3.11 to see if that was the issue. Lo and behold, I had no difficulties importing the files. I'm not sure what's causing this. If it's an issue on my computer; uninstalling, reinstalling & repairing does not seem to make any difference on the issue.
To be clear, here is my file structure and the statement I am using to load the module:
Where "Project" is the root directory of the project, and where the command prompt is located. Likewise, "foo" is the folder containing my module "bar".
Here is my import statement, which works in 3.11 but not 3.12:
And from this the only output I get is a
Any ideas? I feel like this is really obvious and I'm just out of the loop
Eventually I resorted to uninstalling Python 3.12 and downgrading to 3.11 to see if that was the issue. Lo and behold, I had no difficulties importing the files. I'm not sure what's causing this. If it's an issue on my computer; uninstalling, reinstalling & repairing does not seem to make any difference on the issue.
To be clear, here is my file structure and the statement I am using to load the module:
/ Project
| / foo
| | - bar.py
| - main.py (The file being executed)
Where "Project" is the root directory of the project, and where the command prompt is located. Likewise, "foo" is the folder containing my module "bar".
Here is my import statement, which works in 3.11 but not 3.12:
from foo import bar;
And from this the only output I get is a
ModuleNotFoundError
, specifically for foo.Any ideas? I feel like this is really obvious and I'm just out of the loop