Permission denied python motor code simple bot


#1

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/serial/serialposix.py”, line 275, in open
self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
PermissionError: [Errno 13] Permission denied: ‘/dev/ttyAMA0’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/pi/motor code simple.py”, line 47, in
BrickPiSetup() # setup the serial port for communication
File “/home/pi/BrickPi.py”, line 690, in BrickPiSetup
ser.open()
File “/usr/lib/python3/dist-packages/serial/serialposix.py”, line 278, in open
raise SerialException(“could not open port %s: %s” % (self._port, msg))
serial.serialutil.SerialException: could not open port /dev/ttyAMA0: [Errno 13] Permission denied: ‘/dev/ttyAMA0’


#2

Hi @brynjar,

Can you tell us a little more about your setup, which OS you are using. If are using an image other than Raspbian for Robots , how did you install the drivers for BrickPi. Also can you tell us what all you have tried with BrickPi.

-Shoban


#3

Judging by the error you either don’t have the serial lines setup properly or you don’t have permission to use the serial lines. Are you using sudo when you run your program?


#4

hello @Shoban hoban and @JohnC

benn doing this up until now. Simple bot motor "syntax error" please help[SOLVED]

tryidng to make the simplebot project from dexter.


#5

im using a raspbrtty pi together with a brick pi and i have installed the commands that @karan recommended.


#6

Hi @brynjar,

If you are using a Raspbian for Robots image as recommended by @karan and still getting the error, then can you follow this tutorial and update your software. Please click “Update Dexter Software” on the DI_Update GUI. After updating your software, try running the simplebot program and it should solve the problem.

If the problem still persists then send us a screenshot of the error and also tell us how you are running the example.

-Shoban


#7

hello @Shoban i have updated my raspberry pi with the raspian for robots build now my all our codes disappeared in the process. I saw now that the codes for the simplebot on your website is gone. please help


#8

Hi @brynjar,

Sorry to hear that you have lost your codes, I would suggest you to save your codes in a new folder different from the Dexter industries. So do not store any files inside any of the Dexter industries folder( GoPiGo, GrovePi, BrickPi+, etc…).

Regarding the code for Simplebot, the location of the file has been moved and it can be found here.

In your image it should be inside /home/pi/Dexter/BrickPi+/Software/BrickPi_Python/Project_Examples

Let us know if you need more help,
-Shoban


#9

If you really need your code you may be able to recover it. Unless it was was overwritten.


#10

@shoban hello we have got the robot to work now but can’t make changes to the code. when we do and save we get the permission denied error. Can we do something about it?


#11

The os is blocking you because Dexter Ind doesn’t want accidently changes to the scripts. To fix that simply in the terminal type chmod +x Dexter/BrickPi+
Or if your using the pi3 chmod +x Dexter/BrickPi3

That should do it. However I recommend copying the code and changing the copy. Just make sure it is outside of the brickpi folder. Otherwise you’ll have to run chmod to do anything with it.


#12