When I run a program to display an image, it errors because it can't find the pillow module which is required to display images.
#!/usr/bin/env python
import time
from sys import exit
try:
from PIL import Image
except ImportError:
exit('This script requires the pillow module\nInstall with: sudo pip install pillow')
import unicornhathd as unicorn
def run(params):
width, height = unicorn.get_shape()
img = Image.open('doom.png')
try:
while True:
for o_x in range(int(img.size[0] / width)):
for o_y in range(int(img.size[1] / height)):
valid = False
for x in range(width):
for y in range(height):
pixel = img.getpixel(((o_x * width) + y, (o_y * height) + x))
r, g, b = int(pixel[0]), int(pixel[1]), int(pixel[2])
if r or g or b:
valid = True
unicorn.set_pixel(x, y, r, g, b)
if valid:
unicorn.show()
time.sleep(0.5)
except KeyboardInterrupt:
unicorn.off()
That produces a "This script requirtes the pillow module | Install with: sudo pip install pillow" message. Thing is though, pillow is installed.
Running this .py by itself, without Unicorn Remote, works just fine:
#!/usr/bin/env python
import time
from sys import exit
try:
from PIL import Image
except ImportError:
exit('This script requires the pillow module\nInstall with: sudo pip install pillow')
import unicornhathd
unicornhathd.rotation(0)
unicornhathd.brightness(0.3)
width, height = unicornhathd.get_shape()
img = Image.open('doom.png')
try:
while True:
for o_x in range(int(img.size[0] / width)):
for o_y in range(int(img.size[1] / height)):
valid = False
for x in range(width):
for y in range(height):
pixel = img.getpixel(((o_x * width) + y, (o_y * height) + x))
r, g, b = int(pixel[0]), int(pixel[1]), int(pixel[2])
if r or g or b:
valid = True
unicornhathd.set_pixel(x, y, r, g, b)
if valid:
unicornhathd.show()
time.sleep(0.5)
except KeyboardInterrupt:
unicornhathd.off()
When I run a program to display an image, it errors because it can't find the pillow module which is required to display images.
That produces a "This script requirtes the pillow module | Install with: sudo pip install pillow" message. Thing is though, pillow is installed.
Running this .py by itself, without Unicorn Remote, works just fine:
Any ideas?