Error with ./install.sh

Thanks but as I posted lower down, I copied and pasted the 33 lines of the script from where I got it from, github, and made a new file called instal.sh. Running this completed, but with an error:

Traceback (most recent call last): File "", line 1, in File "/home/rob/.local/lib/python2.7/site-packages/RPi/GPIO/__init__.py", line 23, in from RPi._GPIO import * RuntimeError: This module can only be run on a Raspberry Pi! ./instal.sh: line 15: [: =: unary operator expected

I also posted this lower down.

Reply to
RobH
Loading thread data ...

I managed to get rid of the error at line 15: if [ $revision = "1" ] by changing it to this: if [ $revision: = "1" ] so no unary operator error now.

Again the demo clock.py file runs but not the pi zero.

Thanks

Reply to
RobH

You seem to be having spurious colons there, and a semicolon turning into a colon. Is there something about the way you're creating the file?

Theo

Reply to
Theo

All I did was copy and paste the new file instal.sh

Reply to
RobH

And why not? This is the canonical way of getting files from git. A lot of things can go wrong just by copying the raw file.

--
Ottavio Caruso
Reply to
Ottavio Caruso

What did you paste it into ?

-- Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. |

formatting link

Reply to
Ahem A Rivet's Shot

On Wed, 30 Sep 2020 20:16:25 +0100, RobH declaimed the following:

Don't know if indentation means anything to the shell, but your top file has a ";" where the second has a ":".

formatting link
""" When the shell sees a semicolon (;) on a command line, it's treated as a command separator -- basically like pressing the ENTER key to execute a command. """

Based upon

formatting link
the "then" is taken as a command (the examples all put it on the line UNDER the "if") so the ";" is likely correct. No idea what the ":" version was doing with it... Other than not seeing the "then" as a command.

And here, both of the lines from the second file have ":" at the end. You seem to have /something/ that seems to have created a lot of ":" where they don't belong.

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/
Reply to
Dennis Lee Bieber

On Wed, 30 Sep 2020 20:37:01 +0100, RobH declaimed the following:

Which is probably the wrong way to "fix" this.

The most likely reason for the "unary operator" message is that $revision has no value, making the statement

if [ = "1" ]

I'm guessing here, but one possible solution is to make the line

if [ "$revision" = "1" ]

hence ensuring you have an empty STRING on the left, and not a missing argument. IE:

if [ "" = "1"]

The REAL fix is to find out why the variable revision has not been set to a value!

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/
Reply to
Dennis Lee Bieber

On Wed, 30 Sep 2020 20:37:01 +0100, RobH declaimed the following:

Addendum to my immediately prior post...

formatting link

Read the section "Empty Variables"

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/
Reply to
Dennis Lee Bieber

Dude, he can't even copy-paste, so don't let hem do git.

Reply to
A. Dumas

Then why the hell are you posting in this thread?

Reply to
A. Dumas

What happens when you run: python -c "import RPi.GPIO as GPIO; print GPIO.RPI_REVISION" from the command line? In install.sh this sets the revision variable.

--

Chris Elvidge, England
Reply to
Chris Elvidge

Why are you copying and pasting instead of downloading? Depending on the copy source, you're possibly adding extra newlines that you don't know about. (I know that copying from the output of more will do that, while copying from the output of cat won't.) Just run this:

wget

formatting link

_/_ / v \ Scott Alfter (remove the obvious to send mail) (IIGS(

formatting link
Top-posting! \_^_/ >What's the most annoying thing on Usenet?

Reply to
Scott Alfter

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.