Blinkt! colorsys wont work

I just got my pi zero w and im trying out the example codes from, but whenever i try to do the rainbow one i get an error message saying SyntaxError: invalid syntax… Anyone got any tips?

Can you please post the full error please so we can help you debug the problem further

1 Like

Yes i can :)
File “”, line 1

import colorsys
SyntaxError: invalid syntax

do you have a shebang in that file? if not you need to explicitly run it as an argument to python, like so:


Im still quite new to programming, so im not sure what shebang is, but ive tried to run it as sudo python and python

hum, do you have a file named in that same directory by any chance? if so, that is the problem.

Nope…I have the file saved in /home/pi…

please start python in interactive mode, i.e type just ‘python’ at the command prompt.

then, in the interpreter, type:

import colorsys

if you don’t get the same error - and you shouldn’t - then the issue has to do with the context related to the file you have created, or the editor you are using to create it. Ultimately if you don’t share those details it will be difficult to make any progress with your issue.

Thanks for the tips. Its seems to work whenever i make the program in the terminal, but not when i make it in the IDE.

do you mean the idle program? seems to work pasting the code and running it (F5) here… can you talk us through the steps you follow?