python while problem



  • Hello, i am Building my Internet Radio with my onion but cont figure out what is the Problem with my Radio.py script. I am a python beginner, maybe you have an idea what i did wrong. i tried a lot of variations and also googled wo help.
    i always get :

    radio3.py: line 80: syntax error: unexpected "done" (expecting "then")

    thanks lg christian

        gpioctl dirin 0
        gpioctl dirin 1
        gpioctl dirin 2
        gpioctl dirin 3
        gpioctl dirin 6
        gpioctl dirin 7
        gpioctl dirin 8
        gpioctl dirin 9
    	
         COUNTER=0
    	 
         while [  $COUNTER -lt 100 ]; do
        #     echo The counter is $COUNTER
        #     let COUNTER=COUNTER+1
    			BUTTON0=$(gpioctl get 0 | grep Pin | cut -b 10)
    			BUTTON1=$(gpioctl get 1 | grep Pin | cut -b 10)
    			BUTTON2=$(gpioctl get 2 | grep Pin | cut -b 10)
    			BUTTON3=$(gpioctl get 3 | grep Pin | cut -b 10)
    			#BUTTON6=$(gpioctl get 6 | grep Pin | cut -b 10)
    			BUTTON7=$(gpioctl get 7 | grep Pin | cut -b 10)
    			BUTTON8=$(gpioctl get 8 | grep Pin | cut -b 10)
    			BUTTON9=$(gpioctl get 9 | grep Pin | cut -b 10)
    
    
    			if [ $BUTTON0 = 'H' ]; then
    			killall mpg123
    						   echo starting radio mode
    							echo BBC 1
    			mpg123 http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p &
    						fi
    
    
    			if [ $BUTTON1 = 'H' ]; then
    			killall mpg123
    						   echo starting radio mode
    							echo BBC-World
    			mpg123 http://bbcwssc.ic.llnwd.net/stream/bbcwssc_mp1_ws-einws &
    						fi
    
    
    
    			if [ $BUTTON2 = 'H' ]; then
    			killall mpg123
    						   echo starting radio mode
    							echo France inter
    			mpg123 http://direct.franceinter.fr/live/franceinter-midfi.mp3 &
    						fi
    
    			#world: http://bbcwssc.ic.llnwd.net/stream/bbcwssc_mp1_ws-einws
    
    			if [ $BUTTON3 = 'H' ]; then
    			killall mpg123
    						   echo starting radio mode
    							echo SWR3
    			mpg123 http://swr-mp3-m-swr3.akacast.akamaistream.net/7/720/137136/v1/gnl.akacast.akamaistream.net/swr-mp3-m-swr3 &
    						fi
    
    
    			#if [ $BUTTON6 = 'H' ]; then
    			#killall mpg123
    			#               echo starting radio mode
    			#               echo D-Radio
    			#mpg123 http://stream.dradio.de/7/249/142684/v1/gnl.akacast.akamaistream.net/dradio_mp3_dlf_m &
    			#            fi
    
    
    			if [ $BUTTON9 = 'H' ]; then
    			killall mpg123
    						   echo starting radio mode
    							echo D-Radio Kultur
    			mpg123 http://stream.dradio.de/7/530/142684/v1/gnl.akacast.akamaistream.net/dradio_mp3_dkultur_m &
    						fi
    
    
    			if [ $BUTTON8 = 'H' ]; then
    			killall mpg123
    						   echo starting radio mode
    							echo D-Radio Wissen
    			mpg123 http://stream.dradio.de/7/698/142684/v1/gnl.akacast.akamaistream.net/dradio_mp3_dwissen_s &
    						fi
        sleep 1
         done


  • Python? All I see is a bash script? Have you added #!/bin/sh (or ash) as the first line for the script? Have you tried removing the done?


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.