[raspberry-vi] Re: error in code question

  • From: "Glenn K0LNY" <glennervin@xxxxxxxxxxxx>
  • To: <raspberry-vi@xxxxxxxxxxxxx>
  • Date: Thu, 15 Apr 2021 11:59:56 -0500

Hi Jeff,
I wrote it into a bash script, and did chmod on it so it can run, and the 
other parts of the bash script run but this one does not.
So I tried the sh file with python.  Same lack of results, except that 
python told me that the line I gave the list had syntax error.
I thought I put in the sudo later after it did not work the first time, but 
I can remove that.
Glenn
----- Original Message ----- 
From: "Geoff Shang" <geoff@xxxxxxxxxxxxxxx>
To: <raspberry-vi@xxxxxxxxxxxxx>
Sent: Thursday, April 15, 2021 5:29 AM
Subject: [raspberry-vi] Re: error in code question


On Wed, 14 Apr 2021, Glenn K0LNY wrote:

I got an error in a shell script when I ran it with python, it said syntax 
error
I had:
sudo aplay /home/pi/startup.wav
This usually runs from the command line.

I don't know whether you meant to just run this command or you meant to
run it as part of Python code.

Perhaps I'm stating the obvious, but Python is a programming language and
the Python interpreter is for running programs written in Python.

If all you want to do is execute this command, you can get a shell such as
sh or bash to run it.

Maybe give us some more information.

Oh and you may want to make your life a lot easier by getting sudo out of
the picture.

I don't have a pi running currently, but I'm guessing that your user
account lacks the needed permissions to read the file.

I would either add your user to a group which can read it or change the
permissions on the file so that your user can read it.

Cheers,
Geoff.

===========================================================
The raspberry-vi mailing list
Archives: //www.freelists.org/archives/raspberry-vi
Administrative contact: <mike.ray@xxxxxxxxxxxxxx>
-----------------------------------------------------------
Raspberry Pi and the Raspberry Pi logo are trademarks of the Raspberry Pi 
Foundation.

This list is not affiliated to the Raspberry Pi Foundation and the views and 
attitudes expressed by the subscribers to this list do not reflect those of 
the Foundation.

Mike Ray, list creator, January 2013

=========================================================== 
The raspberry-vi mailing list 
Archives: //www.freelists.org/archives/raspberry-vi
Administrative contact: <mike.ray@xxxxxxxxxxxxxx>
-----------------------------------------------------------
Raspberry Pi and the Raspberry Pi logo are trademarks of the Raspberry Pi 
Foundation.

This list is not affiliated to the Raspberry Pi Foundation and the views and 
attitudes expressed by the subscribers to this list do not reflect those of the 
Foundation.

Mike Ray, list creator, January 2013

Other related posts: