Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Module import error
#1
Hello All. Trying to load a module into python 3, it keeps giving me error:
__
>>> import chaos
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import chaos
ModuleNotFoundError: No module named 'chaos'
__

I'm using a Mac and not sure if I'm saving it in the incorrect location?
Module contains:
def main():
print("This is an illustration of a chaotic fucntion")
x = eval(input("enter a number between 0 and 1: "))
for i in range(10):
x = 3.9 * x * (1-x)
print(x)

main()

Any help here much appreciated
Reply
#2
It is working perfectly on window 7 and python 3.6.2.
def main():
    print("This is an illustration of a chaotic function")
    x = eval(input("enter a number between 0 and 1: "))
    print(type(x))
    for i in range(10):
        x = 3.9 * x * (1-x)
    print("The value of chaotic function is ",x)
main()
Reply
#3
First of all, please insert your code and your output inside respective tags.
Secondly when you write
import chaos
the name of the file in which choas code is written should be chaos.py
and it should be inside the current directory (from which you are importing the module).

If you could not place the chaos.py inside the current directory then you could update the system path, which is by default set to current directory in your code from which you are importing the chaos module.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  is import cointegration_analysis a recognized module mitcht33 1 385 Nov-06-2023, 09:29 PM
Last Post: deanhystad
  problem in import module from other folder akbarza 5 1,259 Sep-01-2023, 07:48 AM
Last Post: Gribouillis
  can not import anaconda pandas module. PySpark pandas module is imported!! aupres 0 680 Aug-06-2023, 01:09 AM
Last Post: aupres
  Error on import: SyntaxError: source code string cannot contain null bytes kirkwilliams2049 7 6,166 Aug-03-2023, 06:00 PM
Last Post: Gribouillis
  import module error tantony 5 3,359 Dec-15-2022, 01:55 PM
Last Post: Lauraburmrs
  Import a module one step back of the path prathampatel9 1 1,036 Sep-21-2022, 01:34 PM
Last Post: snippsat
  Cryptic Error with import statement Led_Zeppelin 2 2,478 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,490 Jan-04-2022, 01:05 PM
Last Post: Anldra12
  Import a module for use in type hint? Milosz 0 1,455 Nov-08-2021, 06:49 PM
Last Post: Milosz
  Can't install nor import delorean module Tek 3 2,741 Oct-27-2021, 03:32 AM
Last Post: Tek

Forum Jump:

User Panel Messages

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