Quantcast
Channel: Pimoroni Buccaneers - Latest posts
Viewing all articles
Browse latest Browse all 54447

Piglow - Error Messages

$
0
0

sudo is basically the "simon says" of the Linux world. It has nothing especially to do with Python in particular, it's not an interpreter, but rather a command that tells the bash environment something along the lines of: "run this thing as the root user."

So when you type:

sudo python myscript.py

You're actually running that script in python with elevated privileges.

When you then run either idle or python and attempt to execute Python commands you're now running as an unprivileged user again.

The trick is, if you're using idle, ( also called the Python IDE in the Pi mens these days ), is to launch it from the terminal using the sudo command, like so:

sudo idle

You should also never be seeing " piglow.py" or "pyglow.pyc" anywhere. The pyglow.py file is part of the library which should be installed somewhere tucked away in a special location where Python knows to look for it.

If you have a pyglow.py alongside your other Python scripts then you'll inevitably run into problems where you save a script somewhere other than this folder and it can't find the library anymore.

Similarly, if you name your own script piglow.py and run it, if it tries to import piglow it will end up importing itself which is almost always not the desired behaviour. We have fun times with this little gotcha in workshops :D


Viewing all articles
Browse latest Browse all 54447

Latest Images

Trending Articles



Latest Images