Code: Select all
import binascii; boundary=binascii.hexlify(os.urandom(16)).decode('ascii')
Code: Select all
line 233 NameError: name uos isnt defined
Code: Select all
import binascii; boundary=binascii.hexlify(os.urandom(16)).decode('ascii')
Code: Select all
line 233 NameError: name uos isnt defined
Code: Select all
import os
os.urandom
Code: Select all
import os
print('esp32', uos.urandom(16))
Code: Select all
esp32 b'\x05t46#\x06%\xb6<\xb6\x81U\xceQ\x18\xa1'
Code: Select all
import code
Code: Select all
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "code.py", line 3, in <module>
NameError: name 'uos' isn't defined
This shows the issue -- you're importing os, but using uos. Something else is importing uos (which is true, see below).
stijn is right -- this is a particular quirk of ESP32 where the filesustem initialisation and loading is implemented in Python, and that code imports uos. (See https://github.com/micropython/micropyt ... s/_boot.py )
You can use either. My point is that you just need to use "uos.urandom" if you "import uos", or "os.urandom" if you "import os".