[Tutorial] How to get your NanoHatOLED to work

Maybe you need to enable i2c manually:

And use 2to3 to convert old python2 script to python3 version.

Hej, so I am trying to redeploy my NanoHatOLED on an Neo2 but @Aldoszx Package did not seem to work right away.
After some digging I found the Error, for the current DietPi 8.7 one hast to replace the python3.7 with python3.9

This worked for me

Yes this is somehow expected as in meantime we use Debian Bullseye. There Python 3.9 will be installed.

hello guys.
I share my solution with you:
the bakebit.py can’t run well in python3 but only work with python2.
when you run in python3, it will have “smbus module is not found”, “Mode =01” etc problems.

so, don’t waste time to make it work in python3, just install or keep python2 to run it.
in NanoPi-Neo oled Ubuntu16 ROM. it owns python2.7 and python3.5.4. the default command “python” is python2. if you install python3.10 or python3.11, the command “python” will be going to version python3.10 or python3.11.

way#1,you can use “ln -s /usr/bin/python2.7 /usr/bin/python” to softlink (re-direct) python to python2
way#2, modify vim /usr/bin/oled-start, add a new line after end line “python2 \root\NanoHatOLED/BakeBit/Software/Python/bakebit_128_64_oled.py”

if sys.version_info<(3,0):
p_version=2
else:
p_version=3

if sys.platform == ‘uwp’:
import winrt_smbus as smbus
bus = smbus.SMBus(1)
else:
import smbus
import RPi.GPIO as GPIO
rev = GPIO.RPI_REVISION
if rev == 2 or rev == 3:
bus = smbus.SMBus(0)
else:
bus = smbus.SMBus(0)

Something you definitely should not do as Python 2 is depreciated since nearly 3 years now Sunsetting Python 2 | Python.org

There was definitely enough time for python script maintainers to migrate to Python 3. Staying on python 2 is not a good option.

keep two versions of python on the system.
both python2 and python3.

revise:
NOT “\root\NanoHatOLED/BakeBit/Software/Python/bakebit_128_64_oled.py””
it should be "\root\NanoHatOLED/BakeBit/Software/Python/bakebit_nanohat_oled.py”