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

AttributeError: 'module' object has no attribute 'run' #5

Open
gtoal opened this issue Apr 28, 2023 · 2 comments
Open

AttributeError: 'module' object has no attribute 'run' #5

gtoal opened this issue Apr 28, 2023 · 2 comments

Comments

@gtoal
Copy link

gtoal commented Apr 28, 2023

pi@octavius:~/bin $ ./gpioreadall.py
+----------------------------+ Pi B+ +----------------------------+
| BCM | Name | Mode | V | Board | V | Mode | Name | BCM |
+-----+-----------+------+---+----++----+---+------+-----------+-----+
| 3.3v | 1 || 2 | 5v |
Traceback (most recent call last):
File "./gpioreadall.py", line 151, in
main()
File "./gpioreadall.py", line 148, in main
print_gpio(pin_state)
File "./gpioreadall.py", line 111, in print_gpio
print('|{0:4} | {1[0]:<10}| {1[1]:<4} | {1[2]} |{2:3} '.format(hh, pin_state(hh), h), end='|| ')
File "./gpioreadall.py", line 62, in pin_state
result = subprocess.run(['raspi-gpio', 'get', ascii(g)], stdout=subprocess.PIPE).stdout.decode('utf-8')
AttributeError: 'module' object has no attribute 'run'

@Milliways2
Copy link
Owner

This appears to be missing raspi-gpio which is a utility included in Raspberry Pi OS

Description: Dump the state of the BCM270x GPIOs
 This tool prints out one line per BCM270x GPIO pin giving the current value
 on the pin, and the function it is currently set to in the GPFSELx registers.

@gtoal
Copy link
Author

gtoal commented Jun 16, 2023

Thanks, I was posting more to point out the error message which isn't very helpful for users who are not python programmers and just want to use your utility, given that you say "GPIOreadall runs on Raspberry Pi OS Stretch, Buster and Bullseye (32 or 64 bit) and requires no additional libraries as it uses the raspi-gpio debug tool". I didn't uninstall raspi-gpio on that machine, so I presume raspi-gpio was not included by default on some version of the OS. But it might be worth adding a test to see if it is available and a more helpful error message? Unfortunately a couple of months later when I found your reply, I can't remember which PI I was trying to run it on (I have several dozen doing various dedicated tasks around the house) and my current dev system does run it OK.

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