You should init the WLAN AP first, then connect.
But I am having a similar problem. When connected via USB, everything works great. When I run the same program without USB connected, I get a wifi oserror, and attempts to have my StickC+ talk to my desktop via MQTT don't work at all. It won't even load the Widgets to set screen parameters on the StickC+. It's like the Wifi connection is only allowed to work for UIflow??