Hi Folks,
Can someone please point me to a location where I can find troubleshooting info on the PiicoDev SSD1306? I keep getting the same error message,
Traceback (most recent call last):
File “”, line 1, in
File “PiicoDev_SSD1306.py”, line 7
SyntaxError: invalid syntax
I have the PiicoDev_SSD1306.py driver loaded on a Pico-W, and am trying to run the text example from the repository only. I have also tried it with the PiicoDev_Unified.py loaded on the Pico-W. Same result.
The example file is loaded into Thonny. I have tried on another Pico-W board with additional libraries loaded. Same result.
The strange thing is the Line 7 referred to is a comment in the library.
Thanks
Tony
Hi Tony,
Are you able to upload the code you’re attempting to execute as well as a screenshot of Thonny so that we can have a deeper look into this?
Hi Michael,
This is the code:
from PiicoDev_SSD1306 import *
display = create_PiicoDev_SSD1306()
myString = "this is me"
myNumber = 123.4567
display.text("Hello, World!", 0,0, 1) # literal string
display.text(myString, 0,15, 1) # string variable
display.text(str(myNumber), 0,30, 1) # print a variable
display.text("{:.2f}".format(myNumber), 0,45, 1) # use formatted-print
display.show()
The syntax error is in line 7 of PiicoDev_SSD1306.py
which is a comment line.
# https://github.com/fizban99/microbit_ssd1306/blob/master/ssd1306_text.py
Just delete this line, most likely there is some character in the line that should not be there.
I just copied the 3 files needed from GitHub using ‘Copy Raw File
’, saved them in Thonny and it ran ok.
Regards
Jim
2 Likes
Thanks Jim,
Unfortunately there is no microbit library, so it results in a fail when I run the ssd1306_text.py file.
Traceback (most recent call last):
File “”, line 1, in
ImportError: no module named ‘microbit’
If I replace microbit with ssd1306 in the first line I get:
Traceback (most recent call last):
File “”, line 3, in
File “ssd1306.py”, line 8, in
ImportError: no module named ‘microbit’
On another note, the PiicoDev_SSD1306.py now displays this since opening this morning:
Any idea why that would be?
<html
lang="en"
data-color-mode=“auto” data-light-theme=“light” data-dark-theme=“dark”
data-a11y-animated-images=“system” data-a11y-link-underlines=“true”
<script crossorigin="anonymous" defer="de
That looks like a corrupted file system. You should at least install the library, but a full file system repair might be more effective.
You are right, Jeff. Just downloaded the original files again, and now it all works after deleting line 7 in the library. Thanks.
It is no wonder I have no hair left.
1 Like
The SSD1306 library has routines for the micro:Bit. The following can be used to check the naming. For Pico it prints rp2
, for micro:Bit it should print microbit
print(os.uname().sysname)
But looks like @Jeff105671 hit on the main problem.
So many times re-installing Micropython has solved a Pico problem for me.
Also getting the libraries and files from GitHub insures you have the latest and working versions.
Cheers
Jim
1 Like