Python Forum
ImportError: No module named
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ImportError: No module named
Hello. I am facing the following error messages:

Traceback (most recent call last): File "", line 8, in <module> import optimizers.PSO as pso ImportError: No module named optimizers.PSO

when executing python

The file "optimizer" it is in the current directory, and there is a folder called "optimizers" where the file "" lives. So what I am doing wrong?
When you post a question don't assume the reader (me) has any idea what you are talking about. PSO, MFO mean nothing to me (particle swarm optimization?). Should they? Is PSO a module or is it something that is defined in a module?

The message says that there is no file name optimizers/ and no file named that defines something named PSO. What are you expecting? What is in the optimizers folder?
Quote: Is PSO a module or is it something that is defined in a module?

It is a file with a function
def PSO
inside of it

Quote:What are you expecting?

That the file "" runs because there is a "" inside the "optimizers" folder

Quote:no file named

This file has a
import optimizers.PSO as pso
inside it, I should have mentioned it.
If function PSO in, you can try:
from .optimizers.MFO import PSO as pso

Possibly Related Threads…
Thread Author Replies Views Last Post
  ModuleNotFoundError: No module named 'bluetooth' Error Rovelin 4 301 Aug-31-2021, 04:04 PM
Last Post: Rovelin
  No module named 'pysolar' - even tough pysolar is installed - What am I doing wrong? Jghurt 5 838 May-08-2021, 07:03 PM
Last Post: Jghurt
  ModuleNotFoundError: No module named 'graph' Anldra12 3 1,523 May-02-2021, 02:41 PM
Last Post: Anldra12
  ModuleNotFoundError: No module named 'fpdf' KatMac 4 1,808 Apr-19-2021, 01:23 PM
Last Post: KatMac
  ModuleNotFoundError: No module named 'com' aleksg 9 2,590 Dec-14-2020, 05:00 PM
Last Post: Larz60+
Video ModuleNotFoundError: No module named ‘…’ Frank911 1 1,472 Dec-11-2020, 03:59 PM
Last Post: michael1789
  no module named finbert found ErnestTBass 4 1,326 Dec-05-2020, 06:09 PM
Last Post: andrianas
  ModuleNotFoundError: No module named 'fcntl' ErnestTBass 2 6,393 Dec-05-2020, 02:39 PM
Last Post: ErnestTBass
  ModuleNotFoundError: No module named 'pyrlang.gen_server' Maxximiliann 0 669 Nov-19-2020, 01:15 AM
Last Post: Maxximiliann
  ModuleNotFoundError: No module named 'requests' Martin 2 1,000 Oct-04-2020, 03:35 PM
Last Post: Martin

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020