Pico W NameError: name 'network' isn't defined

Hi Guys,
I have recently purchased a Raspberry PI Pico W and I’m following the example on this link.

I believe I have the latest micro python build and I see this version when Thony starts up. Dated yesterday and it has the W shown.
MicroPython v1.19.1-728-g6503cd47a on 2022-12-06; Raspberry Pi Pico W with RP2040

I have filled in my SSID and Password but the execution fails before it event gets to that line with the following error.

Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
NameError: name 'network' isn't defined

I’ve tried Googling that error like a good little beginner but nothing useful comes up. To die on line 4 I’m obviously missing something fundamental.
Any ideas?


1 Like

YEP Fundamental.

I missed the first few lines when doing the copy and paste
Including the all important “import network”
Maybe google will find this post for the next person :slight_smile:

# A simple example that:
# - Connects to a WiFi Network defined by "ssid" and "password"
# - Performs a GET request (loads a webpage)
# - Queries the current time from a server

import network   # handles connecting to WiFi

Hi David,

Glad to hear you found the solution, and thanks for reporting back with your fix so others on the same path can benefit. :slight_smile:

Earlier this week I was googling a problem with a hardware/firmware combination I was trying to fault find and only found two threads describing my exact problem that never got an update.:smiling_face_with_tear:

All the best with the rest of your Pico W project!

1 Like

I once googled a very obscure technical problem and got a single hit and that was in Japanese.
Google translated it into English (sort of) and I solved my problem.
If my current project comes together I’ll try and do an article of how it works.