So I replaced it with urequests.py from Wipy link, I get following error;
OSError: [Errno 107] ENOTCONN
OpenMV Terminal:
Traceback (most recent call last):
File “”, line 47, in
File “urequests.py”, line 107, in post
File “urequests.py”, line 124, in urlopen
File “urequests.py”, line 27, in init
OSError: [Errno 107] ENOTCONN
So it opens urequests.py in OpenMV and stops at line 27 as shown in abovementioned traceback.
Would you explain more what I should do to fix the problem with the WLAN interface?
I mean where can I find the issue in the current lucien2k code?
Also how to solve the OSError: [Errno 107] ENOTCONN.
You need to init the wifi module first. The library just uses the socket interface. It does not setup the wifi module. See our wifi examples. You have to actually turn on the wifi part. Once that’s done MicroPython offers socket services to code which the library uses.
When I add the urequests.post at the end I get the OSError: [Errno 107] ENOTCONN for s.settimeout(3) in line 28, am I doing the init correctly?
#Details:
Traceback (most recent call last):
File “”, line 39, in
File “urequests.py”, line 108, in post
File “urequests.py”, line 125, in urlopen
File “urequests.py”, line 28, in init #OSError: [Errno 107] ENOTCONN
Yes, it returns a valid address, the IP of my website:
First the local IP address: (‘192.168.0.105’, ‘255.255.255.0’, ‘192.168.0.1’, ‘192.168.0.1’)
Then IP of my website and conventional 80 port number: (‘IP of my website’, 80)
Then I get errors:
Traceback (most recent call last):
File “”, line 39, in
File “urequests.py”, line 108, in post
File “urequests.py”, line 125, in urlopen
File “urequests.py”, line 28, in init
OSError: [Errno 107] ENOTCONN
MicroPython: e439f36 OpenMV: v4.0.1 HAL: v1.9.0 BOARD: OPENMV4P-STM32H743
Type “help()” for more information.
If you wanna test if you can upload an image to my website, I can email you my website address as its upload.php is working with the Python request library.
Is it because he “imports socket” as is? In OpenMV we have usocket not socket.
So I also added the following line below the above statement on urequests.py but it did not help;
import usocket as socket
If you need an upload website my website currently works receiving requests from my computer, I mentioned the Python code in this thread. So if you provide an email, I can share my website links;
To upload the photo from OpenMV
Use the gallery link that you can see if the photo on OpenMV is uploaded there
r = urequests.post(url, json=(file.read()), headers=headers)
AttributeError: 'dict' object has no attribute 'read'
r = urequests.post(url, json=file, headers=headers)
File "urequests.py", line 84; l = s.readline()
AttributeError: 'socket' object has no attribute 'readline'
“or send the file object directly” Not sure how to implement this
Btw for all these, first I had to modify urequest module as follows on line 55 to remove the 2 positional argument error mentioned recently; ai = usocket.getaddrinfo(host, port) #, 0, usocket.SOCK_STREAM)
The image should be posted and it’s trying to read back the HTTP response. The socket object doesn’t have a readline function you’ll need to add that yourself, just write a function that reads 1 byte in a loop and append it to a string (or bytearray) until you get a newline char ‘\n’ then return the string.
Note: Please put some more effort into fixing this, you’re basically copy&pasting errors for us to explain/fix for you. If you read the library you will understand what it’s doing and why it is failing, if you’re not a programmer I can’t help you with that.
Thanks for your help, you are right, I should work on it more!
I was focused on remembering the OOP again today with a Coursera tutorial to understand the library better.
I Will put more effort into fixing the library…
BTW this is actually more compatible with stm32 sockets, I don’t know why you couldn’t use it, it should be working (urequests.post(…)), it also supports auth and cookies, we may actually use this one instead.