The script looks fine to me. Maybe something has been modified during the copy and paste operations.
try one more time to download the script directly from here http://quantumwise.com/documents/tutorials/latest/NanowireDevice/index.html/examples/nanodevice-gatescan.py
just check that the filename here
device_configuration = nlread("nanodevice_huckel.nc",DeviceConfiguration)[0]
is correct.