Python Forum
Import error with local file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Import error with local file
#1
Smile 
Hello. When I try to run a python file
python optimizer.py
it says
ImportError: No module named optimizers.PSO
There is a file called "PSO.py" on the folder "optimizers", that happens to be on the same directory where "optimizer.py" it is:

So, it is all about showing python this PSO.py? If yes, how can I do that? Many thanks
Reply
#2
Try python -m optimizers.optimizer perhaps.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error on import: SyntaxError: source code string cannot contain null bytes kirkwilliams2049 7 6,632 Aug-03-2023, 06:00 PM
Last Post: Gribouillis
Video doing data treatment on a file import-parsing a variable EmBeck87 15 2,807 Apr-17-2023, 06:54 PM
Last Post: EmBeck87
  Import XML file directly into Excel spreadsheet demdej 0 833 Jan-24-2023, 02:48 PM
Last Post: demdej
  import module error tantony 5 3,434 Dec-15-2022, 01:55 PM
Last Post: Lauraburmrs
  Cryptic Error with import statement Led_Zeppelin 2 2,529 Jan-11-2022, 01:13 PM
Last Post: Led_Zeppelin
  Install any library via pip get an error cannot import name 'SCHEME_KEYS' from 'pip. Anldra12 2 10,606 Jan-04-2022, 01:05 PM
Last Post: Anldra12
  How from sklearn.datasets import load_diabetes change to import to CSV file Anldra12 0 1,849 Dec-25-2021, 07:20 PM
Last Post: Anldra12
  How to import file and function in another folder SriRajesh 1 3,144 Dec-18-2021, 08:35 AM
Last Post: Gribouillis
  import module with syntax error Skaperen 7 5,264 Jun-22-2021, 10:38 AM
Last Post: Skaperen
  Import Error Christian 3 3,170 Apr-17-2021, 11:27 PM
Last Post: bowlofred

Forum Jump:

User Panel Messages

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