Python tools fail with "ImportError: No module named IDF"
-
- Posts: 21
- Joined: Wed Oct 30, 2019 5:17 am
Python tools fail with "ImportError: No module named IDF"
Some of the tools fail with a "ImportError: No module named IDF" error. Specifically right now while running the example_test.py script used in simple_ota_example. I'm sure there's something really simple I'm missing but couldn't figure out what step I missed.
-
- Posts: 74
- Joined: Wed Oct 23, 2019 1:49 am
Re: Python tools fail with "ImportError: No module named IDF"
It needs the path of the tiny-test framework, try something like: export TEST_FW_PATH=$IDF_PATH/tools/tiny-test-fw
-
- Posts: 21
- Joined: Wed Oct 30, 2019 5:17 am
Re: Python tools fail with "ImportError: No module named IDF"
Yup, I ended up figuring that out a little bit ago. I had to fix a few python programs that don't seem to be updated to the current versions (yaml file broke and example_test.py didn't import everything properly). But finally got it working. Thank you.
Was that somewhere in the documentation I missed or would I have to look through the source code to figure that out?
Was that somewhere in the documentation I missed or would I have to look through the source code to figure that out?
-
- Posts: 74
- Joined: Wed Oct 23, 2019 1:49 am
Re: Python tools fail with "ImportError: No module named IDF"
That's good.
It's mentioned as a comment in the .py example test files, but I'm not aware of any other documentation that describes how to run these tests.
It's mentioned as a comment in the .py example test files, but I'm not aware of any other documentation that describes how to run these tests.
-
- Posts: 21
- Joined: Wed Oct 30, 2019 5:17 am
Re: Python tools fail with "ImportError: No module named IDF"
Cool. I'll try to make a note to create pull requests to fix those issues and add it to the appropriate documentation.
Re: Python tools fail with "ImportError: No module named IDF"
Hi, I have the least problem running example_test.py
I have executed in terminal:
But I can't make it work.
Could you tell me how they solved it?
Thank you
Code: Select all
pablo @ pablo-notbuk ~ / esp32 / workspace / websocket $ python example_test.py
Traceback (most recent call last):
File "example_test.py", line 4, in <module>
import IDF
ImportError: No module named IDF
Code: Select all
export TEST_FW_PATH = $ IDF_PATH: / tools / tiny-test-fw
Could you tell me how they solved it?
Thank you
-
- Posts: 21
- Joined: Wed Oct 30, 2019 5:17 am
Re: Python tools fail with "ImportError: No module named IDF"
Hey, sorry I didn't respond sooner. Don't know how to get email notifications on this forum yet. I made the change on my fork.
https://github.com/YeetBox/esp-idf/blob ... est.py#L22
Edit: Just realized you got a different error. But you'll get that one too after you fix yours. Let me look through my commits and see if it was a code change or an env variable change.
Edit2: I had assumed when you posted a topic you were automatically subscribed to it. You aren't... gotta subscribe. Now I know.
https://github.com/YeetBox/esp-idf/blob ... est.py#L22
Edit: Just realized you got a different error. But you'll get that one too after you fix yours. Let me look through my commits and see if it was a code change or an env variable change.
Edit2: I had assumed when you posted a topic you were automatically subscribed to it. You aren't... gotta subscribe. Now I know.
Last edited by jhubbardsf on Fri Nov 22, 2019 5:03 am, edited 1 time in total.
-
- Posts: 21
- Joined: Wed Oct 30, 2019 5:17 am
Re: Python tools fail with "ImportError: No module named IDF"
Ok, looking at your export statement I'm not sure if there was a formatting error or if you really have all those spaces but either way it doesn't look correct. But you'd want to do anpablolode wrote: ↑Wed Nov 20, 2019 10:00 pmHi, I have the least problem running example_test.pyI have executed in terminal:Code: Select all
pablo @ pablo-notbuk ~ / esp32 / workspace / websocket $ python example_test.py Traceback (most recent call last): File "example_test.py", line 4, in <module> import IDF ImportError: No module named IDF
But I can't make it work.Code: Select all
export TEST_FW_PATH = $ IDF_PATH: / tools / tiny-test-fw
Could you tell me how they solved it?
Thank you
Code: Select all
export TEST_FW_PATH=$IDF_PATH/tools/tiny-test-few
You have a semi colon after IDF_PATH and want a slash. I had to make a few other changes before it'd work, so before you go crazy debugging it check out the last couple commits in my fork.
I put that line in my ~/.profile and since my zsh terminal doesn't source that by default I also added
Code: Select all
source ~/.profile
Re: Python tools fail with "ImportError: No module named IDF"
You need a file named __init__.py (two underscores on each side) in every folder in the hierarchy. This is what python looks for to know that it should access a particular folder. The files are meant to contain initialization instructions but even if you create them empty this will solve it. To get rid of this error “ImportError: No module named”, you just need to create __init__.py in the appropriate directory and everything will work fine.
Who is online
Users browsing this forum: Google [Bot] and 80 guests