Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1251

Python • pylint errors on normal "import RPi.GPIO"

$
0
0
First of all this is probably not the simplest way to bleed all the air from a solenoid valve,
assuming a program which used it crashed before calling GPIO.cleanup().
But it works.

The question is : ...
when I pylint this code it gets the following errors:

Code:

import RPi.GPIO as GPIOdef gpio_cleanup():    # if no pins were in use before cleanup you get an error;                                                                                                                                                                                                                                            # we have no way of knowing if it was called successfully on exit                                                                                                                                                                                                                                    # so we have to call it again;                                                                                                                                                                                                                                                                       GPIO.setwarnings(False)    print('GPIO.cleanup()')    # you can not set pin mode if it is already set; so we have to call cleanup();                                                                                                                                                                                                                       # this resets all pins to input pullups;                                                                                                                                                                                                                                                             GPIO.cleanup()    GPIO.setmode(GPIO.BCM)    print('set pin mode')    GPIO.setup (VALV_PIN_ENABLE, GPIO.OUT)    GPIO.setup (VALV_PIN,        GPIO.OUT)    pwm_valv = GPIO.PWM(VALV_PIN, 100)    pwm_valv.start(0)    pwm_valv.ChangeDutyCycle(0)    GPIO.output(VALV_PIN_ENABLE, False) # enable = False                                                                                                                                                                                                                                                 GPIO.output(VALV_PIN       , True ) # enable = True                                                                                                                                                                                                                                                  #############################################                                                                                                                                                                                                                                                        print("bonus; release air if stuck inflated; wait 3 sec to deflate;")    print("opening valve (on)")    pwm_valv.ChangeDutyCycle(100)    time.sleep(3)    pwm_valv.ChangeDutyCycle(0)    print("air released")    #############################################                                                                                                                                                                                                                                                        print("closing valve (off)")    pwm_pump.stop()    pwm_valv.stop()    GPIO.output(VALV_PIN_ENABLE, True ) # enable = False                                                                                                                                                                                                                                                 GPIO.output(VALV_PIN       , False) # enable = True                                                                                                                                                                                                                                                  print('GPIO.cleanup()')    GPIO.cleanup()    print("done; exit;")

Code:

reset-pins.py:29: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'setwarnings' memberreset-pins.py:33: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'cleanup' memberreset-pins.py:34: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'setmode' memberreset-pins.py:34: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'BCM' memberreset-pins.py:36: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'setup' memberreset-pins.py:36: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'OUT' memberreset-pins.py:37: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'setup' memberreset-pins.py:37: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'OUT' memberreset-pins.py:38: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'setup' memberreset-pins.py:38: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'OUT' memberreset-pins.py:39: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'setup' memberreset-pins.py:39: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'OUT' memberreset-pins.py:40: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'PWM' memberreset-pins.py:41: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'PWM' memberreset-pins.py:46: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'output' memberreset-pins.py:47: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'output' memberreset-pins.py:48: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'output' memberreset-pins.py:49: [E1101(no-member), gpio_cleanup] Module 'RPi.GPIO' has no 'output' member
I am not using a virtual environment or pip I don't think although one is installed.
Here is the only version of RPi.GPIO I could find.

Code:

garberw@nickel ---->>>> ls -d /lib/python3/dist-packages/RPi*/lib/python3/dist-packages/RPi  /lib/python3/dist-packages/RPi.GPIO-0.7.1a4.egg-info
Someone said that the path for pylint is not set correctly.
This happens both running pylint in emacs and from command line.
the path is empty.

Statistics: Posted by garberw — Sun Feb 25, 2024 11:58 pm



Viewing all articles
Browse latest Browse all 1251

Trending Articles