Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__main__ not found? #49

Open
TermOfficial opened this issue Feb 20, 2022 · 1 comment
Open

__main__ not found? #49

TermOfficial opened this issue Feb 20, 2022 · 1 comment

Comments

@TermOfficial
Copy link

pi2@raspberrypi:~/raphael-kit/python $ python3 2.2.10_write.py
Traceback (most recent call last):
File "2.2.10_write.py", line 6, in
reader = SimpleMFRC522()
File "/home/pi2/.local/lib/python3.7/site-packages/mfrc522/SimpleMFRC522.py", line 14, in init
self.READER = MFRC522()
File "/home/pi2/.local/lib/python3.7/site-packages/mfrc522/MFRC522.py", line 130, in init
self.spi.open(bus, device)
FileNotFoundError: [Errno 2] No such file or directory

That's what I'm getting

@muasim
Copy link

muasim commented Mar 6, 2022

SimpleMFRC522 is using /dev/spidev0.0 device file.

def __init__(self):
self.READER = MFRC522()

def __init__(self, bus=0, device=0, spd=1000000, pin_mode=10, pin_rst=-1, debugLevel='WARNING'):
self.spi = spidev.SpiDev()
self.spi.open(bus, device)

https://github.com/doceme/py-spidev/blob/a5d82b88bd1c95c9f9ec46e9f7afe08c3323e625/spidev_module.c#L1311-L1328

Device file is not listed in /dev folder. Possible causes are;

  • SPI module is not activated - loaded - blacklisted.

I recommend you to look into official documentation.
https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#software

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants