<?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[lopy4 hangs with &quot;ERROR! Could not connect to Pybytes&quot;]]></title><description><![CDATA[<p dir="auto">I provisioned a third LoPy4.  Trying to get a fresh start on this one and enable multiple network connectivity if one SSID isn't available.<br />
I put this in <a href="http://boot.py" target="_blank" rel="noopener noreferrer nofollow">boot.py</a></p>
<pre><code># boot.py -- run on boot-up
import os
import machine

uart = machine.UART(0, 115200)
os.dupterm(uart)

known_nets = {
    'firstlan': {'pwd': 'firstl@n'},
    'secondlan': {'pwd': 'secondl@n'},#, 'wlan_config':  ('10.0.0.114', '255.255.0.0', '10.0.0.1', '10.0.0.1')}, # (ip, subnet_mask, gateway, DNS_server)
}

if machine.reset_cause() != machine.SOFT_RESET:
    from network import WLAN
    wl = WLAN()
    wl.mode(WLAN.STA)
    original_ssid = wl.ssid()
    original_auth = wl.auth()

    print(&quot;Scanning for known wifi nets&quot;)
    available_nets = wl.scan()
    nets = frozenset([e.ssid for e in available_nets])

    known_nets_names = frozenset([key for key in known_nets])
    net_to_use = list(nets &amp; known_nets_names)
    try:
        net_to_use = net_to_use[0]
        net_properties = known_nets[net_to_use]
        pwd = net_properties['pwd']
        sec = [e.sec for e in available_nets if e.ssid == net_to_use][0]
        if 'wlan_config' in net_properties:
            wl.ifconfig(config=net_properties['wlan_config'])
        wl.connect(net_to_use, (sec, pwd), timeout=10000)
        while not wl.isconnected():
            machine.idle() # save power while waiting
        print(&quot;Connected to &quot;+net_to_use+&quot; with IP address:&quot; + wl.ifconfig()[0])

    except Exception as e:
        print(&quot;Failed to connect to any known network, going into AP mode&quot;)
        wl.init(mode=WLAN.AP, ssid=original_ssid, auth=original_auth, channel=6, antenna=WLAN.INT_ANT)
</code></pre>
<p dir="auto">I copied the code from the WLAN tutorial and added my SSIDs.  It connected the first time, I tried pushing a change to <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow">main.py</a> and when it restarted, it halted with this:</p>
<pre><code>rst:0x1 (POWERON_RESET),boot:0x32 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff8028,len:8
load:0x3fff8030,len:1688
load:0x4009fa00,len:0
load:0x4009fa00,len:14592
entry 0x400a059c
Scanning for known wifi nets
Connected to firstlan with IP address:10.1.1.122
WMAC: 807D3A937918
Firmware: 1.18.2
Pybytes: 0.9.6
Pybytes configuration read from /flash/pybytes_config.json
WiFi connection established
MQTT ERROR! Avialable Interfaces are down
Trying to join LoRa.ABP for 15 seconds...
Setting up LoRa socket...
ERROR! Could not connect to Pybytes!
</code></pre>
<p dir="auto">I have two other devices using the same SSID and both are online.<br />
I went to the Firmware tool and checked &quot;erase flash filesystem&quot;, thinking this would wipe it.<br />
when it finised and I removed the boot jumper to ground, it came up once.  But the filesystem wasn't blank.  It ran and connected to pybytes.. went and changed a line of code, and the problem returned.</p>
<p dir="auto">Is there any way to make it just wait and reboot if it can't connect to pybyes?<br />
Would any of this code be the culprit?<br />
Also, in the code, this line has a comma at the end in the example.. but it seems it shouldn't be there?</p>
<pre><code>    'secondlan': {'pwd': 'secondl@n'},
</code></pre>
]]></description><link>https://forum.pycom.io/topic/4407/lopy4-hangs-with-error-could-not-connect-to-pybytes</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 14:37:48 GMT</lastBuildDate><atom:link href="https://forum.pycom.io/topic/4407.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 19 Feb 2019 03:11:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to lopy4 hangs with &quot;ERROR! Could not connect to Pybytes&quot; on Tue, 19 Feb 2019 03:11:43 GMT]]></title><description><![CDATA[<p dir="auto">I provisioned a third LoPy4.  Trying to get a fresh start on this one and enable multiple network connectivity if one SSID isn't available.<br />
I put this in <a href="http://boot.py" target="_blank" rel="noopener noreferrer nofollow">boot.py</a></p>
<pre><code># boot.py -- run on boot-up
import os
import machine

uart = machine.UART(0, 115200)
os.dupterm(uart)

known_nets = {
    'firstlan': {'pwd': 'firstl@n'},
    'secondlan': {'pwd': 'secondl@n'},#, 'wlan_config':  ('10.0.0.114', '255.255.0.0', '10.0.0.1', '10.0.0.1')}, # (ip, subnet_mask, gateway, DNS_server)
}

if machine.reset_cause() != machine.SOFT_RESET:
    from network import WLAN
    wl = WLAN()
    wl.mode(WLAN.STA)
    original_ssid = wl.ssid()
    original_auth = wl.auth()

    print(&quot;Scanning for known wifi nets&quot;)
    available_nets = wl.scan()
    nets = frozenset([e.ssid for e in available_nets])

    known_nets_names = frozenset([key for key in known_nets])
    net_to_use = list(nets &amp; known_nets_names)
    try:
        net_to_use = net_to_use[0]
        net_properties = known_nets[net_to_use]
        pwd = net_properties['pwd']
        sec = [e.sec for e in available_nets if e.ssid == net_to_use][0]
        if 'wlan_config' in net_properties:
            wl.ifconfig(config=net_properties['wlan_config'])
        wl.connect(net_to_use, (sec, pwd), timeout=10000)
        while not wl.isconnected():
            machine.idle() # save power while waiting
        print(&quot;Connected to &quot;+net_to_use+&quot; with IP address:&quot; + wl.ifconfig()[0])

    except Exception as e:
        print(&quot;Failed to connect to any known network, going into AP mode&quot;)
        wl.init(mode=WLAN.AP, ssid=original_ssid, auth=original_auth, channel=6, antenna=WLAN.INT_ANT)
</code></pre>
<p dir="auto">I copied the code from the WLAN tutorial and added my SSIDs.  It connected the first time, I tried pushing a change to <a href="http://main.py" target="_blank" rel="noopener noreferrer nofollow">main.py</a> and when it restarted, it halted with this:</p>
<pre><code>rst:0x1 (POWERON_RESET),boot:0x32 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff8028,len:8
load:0x3fff8030,len:1688
load:0x4009fa00,len:0
load:0x4009fa00,len:14592
entry 0x400a059c
Scanning for known wifi nets
Connected to firstlan with IP address:10.1.1.122
WMAC: 807D3A937918
Firmware: 1.18.2
Pybytes: 0.9.6
Pybytes configuration read from /flash/pybytes_config.json
WiFi connection established
MQTT ERROR! Avialable Interfaces are down
Trying to join LoRa.ABP for 15 seconds...
Setting up LoRa socket...
ERROR! Could not connect to Pybytes!
</code></pre>
<p dir="auto">I have two other devices using the same SSID and both are online.<br />
I went to the Firmware tool and checked &quot;erase flash filesystem&quot;, thinking this would wipe it.<br />
when it finised and I removed the boot jumper to ground, it came up once.  But the filesystem wasn't blank.  It ran and connected to pybytes.. went and changed a line of code, and the problem returned.</p>
<p dir="auto">Is there any way to make it just wait and reboot if it can't connect to pybyes?<br />
Would any of this code be the culprit?<br />
Also, in the code, this line has a comma at the end in the example.. but it seems it shouldn't be there?</p>
<pre><code>    'secondlan': {'pwd': 'secondl@n'},
</code></pre>
]]></description><link>https://forum.pycom.io/post/25996</link><guid isPermaLink="true">https://forum.pycom.io/post/25996</guid><dc:creator><![CDATA[dnear1]]></dc:creator><pubDate>Tue, 19 Feb 2019 03:11:43 GMT</pubDate></item><item><title><![CDATA[Reply to lopy4 hangs with &quot;ERROR! Could not connect to Pybytes&quot; on Tue, 19 Feb 2019 09:58:30 GMT]]></title><description><![CDATA[<p dir="auto">Are you still able to connect to the repl?</p>
<p dir="auto">if so try running</p>
<pre><code>&gt;&gt;&gt; import os 
&gt;&gt;&gt; os.mkfs('/flash')
</code></pre>
<p dir="auto">to wipe the storage if the checkbox fails on the firmware updater.</p>
]]></description><link>https://forum.pycom.io/post/26008</link><guid isPermaLink="true">https://forum.pycom.io/post/26008</guid><dc:creator><![CDATA[Paul Thornton]]></dc:creator><pubDate>Tue, 19 Feb 2019 09:58:30 GMT</pubDate></item><item><title><![CDATA[Reply to lopy4 hangs with &quot;ERROR! Could not connect to Pybytes&quot; on Sun, 21 Apr 2019 17:48:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3525">@Paul-Thornton</a> I have the same problem. Using the solution proposed by you does not fix the issue. I disabled also the firewall.</p>
<pre><code>Firmware: 1.18.2.r3
Pybytes: 0.9.10
Pybytes configuration read from /flash/pybytes_config.json
WiFi connection established
MQTT ERROR! Avialable Interfaces are down
ERROR! Could not connect to Pybytes!
</code></pre>
<p dir="auto">This is error printed in the REPL console.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/3737">@dnear1</a> If you want to connect to Pybytes and you did all the steps to register your board it is not necessary to connect to wi-fi in the <strong><a href="http://boot.py" target="_blank" rel="noopener noreferrer nofollow">boot.py</a></strong><br />
The wi-fi network connection is handled by pybytes so basically the pybytes will not have the wlan interface.</p>
]]></description><link>https://forum.pycom.io/post/27349</link><guid isPermaLink="true">https://forum.pycom.io/post/27349</guid><dc:creator><![CDATA[George C]]></dc:creator><pubDate>Sun, 21 Apr 2019 17:48:40 GMT</pubDate></item></channel></rss>