<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[wlan.scan() errno 12 ENOMEM]]></title><description><![CDATA[<p dir="auto">Hi everyone,</p>
<p dir="auto">I'm trying to run the wlan example in the PyCom documentation, the one where you scan for nearby networks and connect to one using this code:</p>
<p dir="auto">nets = wlan.scan()<br />
for net in nets:<br />
if net.ssid == 'mywifi':<br />
print('Network found!')<br />
wlan.connect(net.ssid, auth=(net.sec, 'mywifikey'), timeout=5000)<br />
while not wlan.isconnected():<br />
machine.idle() # save power while waiting<br />
print('WLAN connection succeeded!')<br />
break</p>
<p dir="auto">I'm using the ESP32 devkitC. My problem happens on that very first line. When I try running the command &quot;nets = wlan.scan()&quot; I get the following error:</p>
<p dir="auto">OSError: [Errno 12] ENOMEM</p>
<p dir="auto">I get this error both running the command in realtime REPL and also when loading the command into <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow">main.py</a> on the board. From what I've read this error has to do with the board running out of memory. I checked how much memory is available:</p>
<p dir="auto">os.getfree('/flash')</p>
<p dir="auto">And it said 487Kb. Is that not enough memory to do a wifi AP scan? It seems like there's something basic missing here.</p>
]]></description><link>https://forum.pycom.io/topic/2283/wlan-scan-errno-12-enomem</link><generator>RSS for Node</generator><lastBuildDate>Tue, 13 Oct 2026 18:46:05 GMT</lastBuildDate><atom:link href="https://forum.pycom.io/topic/2283.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 10 Dec 2017 23:08:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to wlan.scan() errno 12 ENOMEM on Sun, 10 Dec 2017 23:08:31 GMT]]></title><description><![CDATA[<p dir="auto">Hi everyone,</p>
<p dir="auto">I'm trying to run the wlan example in the PyCom documentation, the one where you scan for nearby networks and connect to one using this code:</p>
<p dir="auto">nets = wlan.scan()<br />
for net in nets:<br />
if net.ssid == 'mywifi':<br />
print('Network found!')<br />
wlan.connect(net.ssid, auth=(net.sec, 'mywifikey'), timeout=5000)<br />
while not wlan.isconnected():<br />
machine.idle() # save power while waiting<br />
print('WLAN connection succeeded!')<br />
break</p>
<p dir="auto">I'm using the ESP32 devkitC. My problem happens on that very first line. When I try running the command &quot;nets = wlan.scan()&quot; I get the following error:</p>
<p dir="auto">OSError: [Errno 12] ENOMEM</p>
<p dir="auto">I get this error both running the command in realtime REPL and also when loading the command into <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow">main.py</a> on the board. From what I've read this error has to do with the board running out of memory. I checked how much memory is available:</p>
<p dir="auto">os.getfree('/flash')</p>
<p dir="auto">And it said 487Kb. Is that not enough memory to do a wifi AP scan? It seems like there's something basic missing here.</p>
]]></description><link>https://forum.pycom.io/post/13474</link><guid isPermaLink="true">https://forum.pycom.io/post/13474</guid><dc:creator><![CDATA[dhblumenfeld1989]]></dc:creator><pubDate>Sun, 10 Dec 2017 23:08:31 GMT</pubDate></item><item><title><![CDATA[Reply to wlan.scan() errno 12 ENOMEM on Mon, 11 Dec 2017 06:54:14 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/2063">@dhblumenfeld1989</a> This cannot be the full script. At least a two lines are missing upfront, like:</p>
<pre><code>from network import WLAN
wlan = WLAN(mode=WLAN.STA)
</code></pre>
<p dir="auto">And as a side note: The flash size you get with uos.getfree() is not relevant for memory errors. These are caused by RAM shortage. The size of free RAM is told by gc.mem_free().<br />
And for all people trying to help it is useful to know the firmware version, which can be obtained by uos.uname().</p>
]]></description><link>https://forum.pycom.io/post/13475</link><guid isPermaLink="true">https://forum.pycom.io/post/13475</guid><dc:creator><![CDATA[robert-hh]]></dc:creator><pubDate>Mon, 11 Dec 2017 06:54:14 GMT</pubDate></item></channel></rss>