OSError: [Errno 12] ENOMEM

ESP32、ESP8266
ESP32-S2、ESP32-S3、ESP32-C3
回复
joey
帖子: 1
注册时间: 2022年 11月 30日 13:03

OSError: [Errno 12] ENOMEM

#1

帖子 joey »

在使用urequests库中的request时,显示OSError: [Errno 12] ENOMEM错误,有什么解决的办法吗?
以下为相关的代码
import network
import ubinascii
import urequests
import camera


wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.scan()
wlan.isconnected()
wlan.connect("ones", "dwh424666")
wlan.config("mac")
wlan.ifconfig()


try:
    camera.init(0, format=camera.JPEG)
except Exception as e:
    camera.deinit()
    camera.init(0, format=camera.JPEG)
    

buf = camera.capture()

with open("test.jpeg", "wb") as f:
    f.write(buf)
    print("拍照结束")
    
url = "https://aip.baidubce.com/rest/2.0/ocr/v ... 5-28622180"
f = open("test.jpeg", "rb")
payload = ubinascii.b2a_base64(f.read())
headers = {
    'Content-Type': 'application/x-www-form-urlencoded',
    'Accept': 'application/json'
}

response = urequests.request("POST", url, headers = headers, data = payload, stream=True)
print(response.text)
 

回复

  • 随机主题
    回复总数
    阅读次数
    最新文章