I have a script that behave differently when launched from main.py than from rrepl.
I run the dailybuild firmware "mp-esp8266-firmware-latest.bin" downloaded on 14/12/16 on a "nodemcu V3"
I have a script based on example_sub_led.py from umqtt library:
https://github.com/micropython/micropyt ... sub_led.py
I can run it from webrepl:
import example_sub_led.py
example_sub_led.main()
Note: main() doesn't start automaticaly when importing the module, is this normal ?
But, if I call it from the main.py, it doesn't work, it doesn't respond to publication to the topic, and of course I can't see what happen because the infinite loop eat 100% of the cpu so I can't log with webrep in the same time.
I have attached the sources files to help investigate if some can help?
Thanks Pidou46
[SOLVED] script that behave differently when launched from main.py than from rrepl.
[SOLVED] script that behave differently when launched from main.py than from rrepl.
- Attachments
-
- script.zip
- (1.43 KiB) Downloaded 268 times
Last edited by pidou46 on Thu Dec 15, 2016 7:28 pm, edited 1 time in total.
nodemcu V2 (amica)
micropython firmware Daily build 05/31/2016
micropython firmware Daily build 05/31/2016
Re: script that behave differently when launched from main.py than from rrepl.
I have some new informations to give. When I'm connecting back with repl through serial line, I get some error message: [Errno 103] ECONNABORTED
Can I do something to workaround this issue ?
Thanks
Code: Select all
dhcp client start...
ip:192.168.1.213,mask:255.255.255.0,gw:192.168.1.254
Traceback (most recent call last):
File "main.py", line 3, in <module>
File "example_sub_servo.py", line 34, in main
File "umqtt/simple.py", line 56, in connect
OSError: [Errno 103] ECONNABORTED
MicroPython v1.8.4-65-g67d52d8 on 2016-09-24; ESP module with ESP8266
Type "help()" for more information.
>>>
Thanks
nodemcu V2 (amica)
micropython firmware Daily build 05/31/2016
micropython firmware Daily build 05/31/2016
Re: script that behave differently when launched from main.py than from rrepl.
Solved
I have just added:
at the beginning of my script to give it some time to connect to network.
Thanks
I have just added:
Code: Select all
import time
time.sleep(5)
Thanks
nodemcu V2 (amica)
micropython firmware Daily build 05/31/2016
micropython firmware Daily build 05/31/2016