I want to display the electronic paper HAT, but there is an error.

Asked 2 years ago, Updated 2 years ago, 84 views

Raspberry Pi, Python novice.

To display Waveshare 2.13 inch e-Paper HAT on Raspberry Pi I'm reading the user manual and trying to display the demo code.

The work done is as follows.
As per the user manual, after putting the demo code in /home/pi from /boot,

cp-r/boot/RaspberryPi/./
sudo chmod777-R RaspberryPi/

Install the Python 3 library and

 sudo apt-get install python3-pip
sudo apt-get install python-imaging
sudo pip3 install spidev
sudo pip3 install RPi.GPIO
sudo pip3 install Pillow

I tried displaying it, but

cd through /RaspberryPi/python3#enter example directory
sudo python3 main.py #running

An error has occurred.

Traceback (most recent call last):
  File "main.py", line 4, in <module>
    import epd2in13b
  File "/home/pi/RaspberryPi/python3/epd2in13b.py", line 51, in<module>
    import epdconfig
  File "/home/pi/RaspberryPi/python3/epdconfig.py", line 48, in<module>
    SPI=spidev.SpiDev(0,0)
FileNotFoundError: [Errno2] No such file or directory

I just started touching Raspberry Pi and Python, so I don't understand anything, so please take care of me. Thank you for reading.

Environment
Raspberry Pi Zero W
Raspbian Python 3
URL: User Manual

[Additional note]
First, we enabled SPI communication.
Also,
in the demo code file of the distribution bcm2835, WiringPi, Python2 and Python3 each had corresponding files, so
After installing and running these libraries,
bcm2835, WiringPi's demo code worked, but
I tried to run Python, but I couldn't.

 sudo python3 main.py#running
e-Paper busy
e-Paper busy release
Clear...
e-Paper busy
e-Paper busy release
Drawing
traceback.format_exc():
%s Traceback (most recent call last):
  File "main.py", line 25, in <module>
    font20 = ImageFont.truetype('/usr/share/font/truetype/wqy/wqy-microhei.ttc', 20)
  File"/usr/lib/python3/dist-packages/PIL/ImageFont.py", line 238, intrutype
    return FreeTypeFont (font, size, index, encoding)
  File"/usr/lib/python3/dist-packages/PIL/ImageFont.py", line 127, in __init__
    self.font=core.getfont(font,size,index,encoding)
OSError:cannot open resource

I'm stuck here.
Any advice will do.

python raspberry-pi raspbian

2022-09-29 21:31

1 Answers

and so on.
It seems to be replaced by some kind of operation.system font was generic CJK

ごThe problem you asked seems to have been solved by installing the font file.

This post was edited based on @kunif's Comment and posted as Community Wiki.This post was edited based on @kunif's Comment and posted as Community Wiki.


2022-09-29 21:31

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.