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
  import module with syntax error Skaperen 7 369 Jun-22-2021, 10:38 AM
Last Post: Skaperen
  Import Error Christian 3 670 Apr-17-2021, 11:27 PM
Last Post: bowlofred
  Python - Import file sequence into Media Pool jensenni 1 430 Feb-02-2021, 05:11 PM
Last Post: buran
  Failing to copy file from a network to a local drive tester_V 4 811 Jan-20-2021, 07:40 AM
Last Post: tester_V
  Folium import error kashif_flavio 2 679 Dec-07-2020, 08:58 AM
Last Post: bowlofred
  Import error Beingcode 0 776 Nov-20-2020, 02:57 AM
Last Post: Beingcode
  switch from version 3.5.3 to 3.8.6 get import error python001 9 943 Oct-31-2020, 03:02 PM
Last Post: python001
  import yaml error for python3 maiya 4 3,584 Jul-15-2020, 06:07 PM
Last Post: Gribouillis
  Code import .CSV file to MySQL table rtakle 4 976 Apr-30-2020, 03:16 PM
Last Post: anbu23
  Which app do I import to fix this error? ErnestTBass 6 1,529 Apr-26-2020, 08:43 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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