Permission Denied: Raspberry pi MP3 Python 3












0















Noobiest of Noobs here.



Working on a project for a Stem lesson for my daughters class. Using Raspberry Pi, Python 3. Should be simple but I get a "permission denied" when I hit the button. Tried using mpg123 as well but get syntax error with that. I'm so close. Please help me help a 5th grade class.



import pibrella
import time
import random
import os
def randomgenerator ():
number = random.randint (1,4)
  if number == 1:
os.system ('/home/pi/Desktop/Gryffindor.mp3')
time.sleep (1)
elif number == 2:
os.system ('/home/pi/Desktop/Hufflepuff.mp3')
time.sleep (1)
elif number == 3:
os.system ('/home/pi/Desktop/Ravenclaw.mp3')
time.sleep (1)
else:
os.system ('/home/pi/Desktop/Slytherin.mp3')
time.sleep (1)
while True:
if pibrella.button.read ():
randomgenerator ()


Error



sh: 1: /home/pi/Desktop/Gryffindor.mp3: Permission denied
sh: 1: /home/pi/Desktop/Slytherin.mp3: Permission denied
sh: 1: /home/pi/Desktop/Gryffindor.mp3: Permission denied
sh: 1: /home/pi/Desktop/Ravenclaw.mp3: Permission denied









share|improve this question

























  • Linux semi-noob. I don't think it's a python issue, you need to change the file/folder permissions. chmod +x or (not advising this but saying as a start position for a search) chmod 777

    – roganjosh
    Nov 21 '18 at 20:14













  • Can you try running mpg123 /home/pi/Desktop/Gryffindor.mp3 on the command line first? Additionally, I believe if the everything in the brackets in os.system(...) should be in quotes.

    – Adam
    Nov 21 '18 at 20:20











  • Man you all are fast. If I add mpg123 in or out of the brackets I get SH:1:mpg123: Not found. I am going to spend some time on the permissions of the files themselves and see what I can find.

    – Toby
    Nov 21 '18 at 20:26













  • os.system ('mpg123 /home/pi/Desktop/Gryffindor.mp3')

    – Johnny Mopp
    Nov 21 '18 at 20:28











  • When I try that I get "SH:1:mpg/home/pi/Desktop/Gryffindor.mp3: Not found" I guess I do not understand the mpg123 part.

    – Toby
    Nov 21 '18 at 20:32


















0















Noobiest of Noobs here.



Working on a project for a Stem lesson for my daughters class. Using Raspberry Pi, Python 3. Should be simple but I get a "permission denied" when I hit the button. Tried using mpg123 as well but get syntax error with that. I'm so close. Please help me help a 5th grade class.



import pibrella
import time
import random
import os
def randomgenerator ():
number = random.randint (1,4)
  if number == 1:
os.system ('/home/pi/Desktop/Gryffindor.mp3')
time.sleep (1)
elif number == 2:
os.system ('/home/pi/Desktop/Hufflepuff.mp3')
time.sleep (1)
elif number == 3:
os.system ('/home/pi/Desktop/Ravenclaw.mp3')
time.sleep (1)
else:
os.system ('/home/pi/Desktop/Slytherin.mp3')
time.sleep (1)
while True:
if pibrella.button.read ():
randomgenerator ()


Error



sh: 1: /home/pi/Desktop/Gryffindor.mp3: Permission denied
sh: 1: /home/pi/Desktop/Slytherin.mp3: Permission denied
sh: 1: /home/pi/Desktop/Gryffindor.mp3: Permission denied
sh: 1: /home/pi/Desktop/Ravenclaw.mp3: Permission denied









share|improve this question

























  • Linux semi-noob. I don't think it's a python issue, you need to change the file/folder permissions. chmod +x or (not advising this but saying as a start position for a search) chmod 777

    – roganjosh
    Nov 21 '18 at 20:14













  • Can you try running mpg123 /home/pi/Desktop/Gryffindor.mp3 on the command line first? Additionally, I believe if the everything in the brackets in os.system(...) should be in quotes.

    – Adam
    Nov 21 '18 at 20:20











  • Man you all are fast. If I add mpg123 in or out of the brackets I get SH:1:mpg123: Not found. I am going to spend some time on the permissions of the files themselves and see what I can find.

    – Toby
    Nov 21 '18 at 20:26













  • os.system ('mpg123 /home/pi/Desktop/Gryffindor.mp3')

    – Johnny Mopp
    Nov 21 '18 at 20:28











  • When I try that I get "SH:1:mpg/home/pi/Desktop/Gryffindor.mp3: Not found" I guess I do not understand the mpg123 part.

    – Toby
    Nov 21 '18 at 20:32
















0












0








0








Noobiest of Noobs here.



Working on a project for a Stem lesson for my daughters class. Using Raspberry Pi, Python 3. Should be simple but I get a "permission denied" when I hit the button. Tried using mpg123 as well but get syntax error with that. I'm so close. Please help me help a 5th grade class.



import pibrella
import time
import random
import os
def randomgenerator ():
number = random.randint (1,4)
  if number == 1:
os.system ('/home/pi/Desktop/Gryffindor.mp3')
time.sleep (1)
elif number == 2:
os.system ('/home/pi/Desktop/Hufflepuff.mp3')
time.sleep (1)
elif number == 3:
os.system ('/home/pi/Desktop/Ravenclaw.mp3')
time.sleep (1)
else:
os.system ('/home/pi/Desktop/Slytherin.mp3')
time.sleep (1)
while True:
if pibrella.button.read ():
randomgenerator ()


Error



sh: 1: /home/pi/Desktop/Gryffindor.mp3: Permission denied
sh: 1: /home/pi/Desktop/Slytherin.mp3: Permission denied
sh: 1: /home/pi/Desktop/Gryffindor.mp3: Permission denied
sh: 1: /home/pi/Desktop/Ravenclaw.mp3: Permission denied









share|improve this question
















Noobiest of Noobs here.



Working on a project for a Stem lesson for my daughters class. Using Raspberry Pi, Python 3. Should be simple but I get a "permission denied" when I hit the button. Tried using mpg123 as well but get syntax error with that. I'm so close. Please help me help a 5th grade class.



import pibrella
import time
import random
import os
def randomgenerator ():
number = random.randint (1,4)
  if number == 1:
os.system ('/home/pi/Desktop/Gryffindor.mp3')
time.sleep (1)
elif number == 2:
os.system ('/home/pi/Desktop/Hufflepuff.mp3')
time.sleep (1)
elif number == 3:
os.system ('/home/pi/Desktop/Ravenclaw.mp3')
time.sleep (1)
else:
os.system ('/home/pi/Desktop/Slytherin.mp3')
time.sleep (1)
while True:
if pibrella.button.read ():
randomgenerator ()


Error



sh: 1: /home/pi/Desktop/Gryffindor.mp3: Permission denied
sh: 1: /home/pi/Desktop/Slytherin.mp3: Permission denied
sh: 1: /home/pi/Desktop/Gryffindor.mp3: Permission denied
sh: 1: /home/pi/Desktop/Ravenclaw.mp3: Permission denied






python raspberry-pi mp3






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 20:25







Toby

















asked Nov 21 '18 at 20:11









TobyToby

13




13













  • Linux semi-noob. I don't think it's a python issue, you need to change the file/folder permissions. chmod +x or (not advising this but saying as a start position for a search) chmod 777

    – roganjosh
    Nov 21 '18 at 20:14













  • Can you try running mpg123 /home/pi/Desktop/Gryffindor.mp3 on the command line first? Additionally, I believe if the everything in the brackets in os.system(...) should be in quotes.

    – Adam
    Nov 21 '18 at 20:20











  • Man you all are fast. If I add mpg123 in or out of the brackets I get SH:1:mpg123: Not found. I am going to spend some time on the permissions of the files themselves and see what I can find.

    – Toby
    Nov 21 '18 at 20:26













  • os.system ('mpg123 /home/pi/Desktop/Gryffindor.mp3')

    – Johnny Mopp
    Nov 21 '18 at 20:28











  • When I try that I get "SH:1:mpg/home/pi/Desktop/Gryffindor.mp3: Not found" I guess I do not understand the mpg123 part.

    – Toby
    Nov 21 '18 at 20:32





















  • Linux semi-noob. I don't think it's a python issue, you need to change the file/folder permissions. chmod +x or (not advising this but saying as a start position for a search) chmod 777

    – roganjosh
    Nov 21 '18 at 20:14













  • Can you try running mpg123 /home/pi/Desktop/Gryffindor.mp3 on the command line first? Additionally, I believe if the everything in the brackets in os.system(...) should be in quotes.

    – Adam
    Nov 21 '18 at 20:20











  • Man you all are fast. If I add mpg123 in or out of the brackets I get SH:1:mpg123: Not found. I am going to spend some time on the permissions of the files themselves and see what I can find.

    – Toby
    Nov 21 '18 at 20:26













  • os.system ('mpg123 /home/pi/Desktop/Gryffindor.mp3')

    – Johnny Mopp
    Nov 21 '18 at 20:28











  • When I try that I get "SH:1:mpg/home/pi/Desktop/Gryffindor.mp3: Not found" I guess I do not understand the mpg123 part.

    – Toby
    Nov 21 '18 at 20:32



















Linux semi-noob. I don't think it's a python issue, you need to change the file/folder permissions. chmod +x or (not advising this but saying as a start position for a search) chmod 777

– roganjosh
Nov 21 '18 at 20:14







Linux semi-noob. I don't think it's a python issue, you need to change the file/folder permissions. chmod +x or (not advising this but saying as a start position for a search) chmod 777

– roganjosh
Nov 21 '18 at 20:14















Can you try running mpg123 /home/pi/Desktop/Gryffindor.mp3 on the command line first? Additionally, I believe if the everything in the brackets in os.system(...) should be in quotes.

– Adam
Nov 21 '18 at 20:20





Can you try running mpg123 /home/pi/Desktop/Gryffindor.mp3 on the command line first? Additionally, I believe if the everything in the brackets in os.system(...) should be in quotes.

– Adam
Nov 21 '18 at 20:20













Man you all are fast. If I add mpg123 in or out of the brackets I get SH:1:mpg123: Not found. I am going to spend some time on the permissions of the files themselves and see what I can find.

– Toby
Nov 21 '18 at 20:26







Man you all are fast. If I add mpg123 in or out of the brackets I get SH:1:mpg123: Not found. I am going to spend some time on the permissions of the files themselves and see what I can find.

– Toby
Nov 21 '18 at 20:26















os.system ('mpg123 /home/pi/Desktop/Gryffindor.mp3')

– Johnny Mopp
Nov 21 '18 at 20:28





os.system ('mpg123 /home/pi/Desktop/Gryffindor.mp3')

– Johnny Mopp
Nov 21 '18 at 20:28













When I try that I get "SH:1:mpg/home/pi/Desktop/Gryffindor.mp3: Not found" I guess I do not understand the mpg123 part.

– Toby
Nov 21 '18 at 20:32







When I try that I get "SH:1:mpg/home/pi/Desktop/Gryffindor.mp3: Not found" I guess I do not understand the mpg123 part.

– Toby
Nov 21 '18 at 20:32














1 Answer
1






active

oldest

votes


















0














Thanks everyone. You were correct but I had not installed mpg123 (SMH) and it was causing the not found error. Works like a charm now. I have always heard how awesome the community here is and boy is it. Thanks again.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419795%2fpermission-denied-raspberry-pi-mp3-python-3%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Thanks everyone. You were correct but I had not installed mpg123 (SMH) and it was causing the not found error. Works like a charm now. I have always heard how awesome the community here is and boy is it. Thanks again.






    share|improve this answer




























      0














      Thanks everyone. You were correct but I had not installed mpg123 (SMH) and it was causing the not found error. Works like a charm now. I have always heard how awesome the community here is and boy is it. Thanks again.






      share|improve this answer


























        0












        0








        0







        Thanks everyone. You were correct but I had not installed mpg123 (SMH) and it was causing the not found error. Works like a charm now. I have always heard how awesome the community here is and boy is it. Thanks again.






        share|improve this answer













        Thanks everyone. You were correct but I had not installed mpg123 (SMH) and it was causing the not found error. Works like a charm now. I have always heard how awesome the community here is and boy is it. Thanks again.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 '18 at 22:02









        TobyToby

        13




        13






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53419795%2fpermission-denied-raspberry-pi-mp3-python-3%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Wiesbaden

            Marschland

            Dieringhausen