shawwwn/uMail

uMail and adding ussl.py to ESP32-CAM

Closed this issue · 2 comments

Good to see you are still around.

Trying to email a image obtained in the program:
https://github.com/shariltumin/esp32-cam-micropython-2022

Appears he didn't bake-in ussl so copied ussl.py from Micropython Github and get this error:

Camera ready?:  True
144540
STARTTLS OK
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cam.py", line 65, in <module>
  File "mail_functions.py", line 14, in send_image
  File "my_umail.py", line 154, in __init__
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
  File "ussl.py", line 36, in wrap_socket
RuntimeError: maximum recursion depth exceeded

Is there a proper way to add ussl to firmware that does not have it in?

Thanks heaps,
davef

Your best bet would be the recompile MicroPython with a naive SSL module.
Alternatively, you can recompile MP with an increased stack size. (I vaguely remember it was set via a config in ESP32 IDF.)

You can also try to flatten the recursion in ussl.py into a loop if you don't want to recompile anything.

I tried recompiling Micropython a year or so ago with the result that I think I lack the skills to do it successfully!
I will Google "flatten the recursion".
https://www.geeksforgeeks.org/python-program-to-flatten-a-nested-list-using-recursion/

He makes a statement:

To reduce size, webrepl, BLE, help modules were not included in the firmware.

Last-ditch procedure will be to send the image to an ESP32 that has uMail running on it.

Thanks,
Dave