IOError: [Errno 1] Operation not permitted

I used servo.py to rotate my servo motor (connected to pin 6), it work did work. However, the next day I run it with no changes made on the code, it appeared error.
Require urgent help. Thank you in advance :slight_smile:
the code:
import sys
import time
import navio.pwm

PWM_OUTPUT = 5
SERVO_MIN = 1.250 #ms
SERVO_MAX = 1.750 #ms

with navio.pwm.PWM(PWM_OUTPUT) as pwm:
pwm.set_period(50)
pwm.enable()

while (True):
    pwm.set_duty_cycle(SERVO_MIN)
    time.sleep(1)
    pwm.set_duty_cycle(SERVO_MAX)
    time.sleep(1)

the error:
Traceback (most recent call last):
File “try.py”, line 9, in
with navio.pwm.PWM(PWM_OUTPUT) as pwm:
File “/home/pi/Navio2/Python/navio/pwm.py”, line 15, in enter
self.initialize()
File “/home/pi/Navio2/Python/navio/pwm.py”, line 34, in initialize
pwm_export.write(str(self.channel))
IOError: [Errno 1] Operation not permitted

Wintho,

Do you see the same error if you log in as a root?

Yup

It looks like the script test.py cannot import the necessary module properly. Could be that the script is just out of the necessary folder.

Can you revert the Navio2/Python repository to the initial state and test it again?

Sorry, how can i do that?
I did uninstall and reinstall it.

You can use the command git reset --hard for it. You can also delete the whole folder and clone it again using the git clone command.