• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

MicroPython, THONNY IDE – ImportError: no module found …

Q&A Forum › Category: ESP8266 › MicroPython, THONNY IDE – ImportError: no module found …
0 Vote Up Vote Down
zolandv asked 6 years ago

in the THONNY IDE

 

​Check path
>>> import sys
>>> print (sys.path)
[”, ‘/lib’, ‘/’]
 
>>> 

 
Wrote 3 modules:

 
lib/test_lib1.py
——————-
def test_libs():
    print(__name__)
    print(‘inside package lib/test_lib1’)

 

test_lib.py
————–

def test_libs():
    print(__name__)
    print(‘inside module test_lib’)
 

test_main.py

——————
import test_lib
#import lib.test_lib1
 
print (__name__)
test_lib.test_libs()
#lib.test_lib1.test_libs()

 
 
try to use external module
———————————–

>>> %upload test_lib.py test_lib.py
>>> %upload ‘lib\test_lib1.py’ test_lib1.py
>>> %upload test_main.py main.py
>>> %Run test_main.py
builtins
 
inside test_lib
 
>>>

 
change 

test_main.py

——————
#import test_lib
import lib.test_lib1
 
print (__name__)
#test_lib.test_libs()
lib.test_lib1.test_libs()

 
try to use external package, in folder ./lib/ place empty __init.py__

>>> %upload test_main.py main.py
>>> %Run test_main.py
Traceback (most recent call last):
 
  File “C:\Users\Admin\Documents\Python\workSpace\test_main.py”, line 2, in <module>
 
ImportError: no module named ‘lib’
 
>>> 

 
whats wrong?
 

3 Answers
0 Vote Up Vote Down
zolandv answered 6 years ago

Sorry my mistake __init__.py

0 Vote Up Vote Down
Sara Santos Staff answered 6 years ago

Hi.
Just to confirm. Were you able to fix your issue?

0 Vote Up Vote Down
zolandv answered 6 years ago

I made mistake in first issue __init__.py instead __init.py__

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.