SyntaxError:无效的语法Python 2.7

时间:2021-01-23 22:42:45

I am a newish programmer and I can't seem to figure this one out. I am getting an error on this bit of code that I put in. Note that this is on Linux (Raspberry Pi to be exact).

我是一个新手程序员,我似乎无法想出这个。我在这段代码中遇到错误。请注意,这是在Linux上(确切地说是Raspberry Pi)。

    direct = raw_input("\nPlease give the the directory or your song ending with the file type \nEX. /folder1/favoritesong.WAV"
        #ftype - file type
        #ftype 1 - WAV file
        #ftype 2 - mp3 file
        ftype11 = ".WAV" in direct
        ftype12 = ".wav" in direct
        ftype21 = ".mp3" in direct
        ftype22 = ".MP3" in direct
        if ftype11 or ftype12 == True:
            if ftype11 == True:
                os.system("clear")
                print "Does the song sound to fast, slow, or just not playing at all? Check the README files."
                check1 = os.system("sudo ./pifm " + direct + " " + str(freq) + " 22050 stereo")
                print check1
            elif ftype11 == False:
                if ftype12 == True:
                    os.system("clear")
                    print "Does the song sound to fast, slow, or just not playing at all? Check the README files."
                    check1 = os.system("sudo ./pifm " + direct + " " + str(freq) + " 22050 stereo")
                    print check1
                else:
                    time.sleep(3.5)
                    print "error 256"
                    print error256
                    time.sleep(2)
                    quit()
        elif ftype11 or ftype12 == False:
            if ftype21 == True:
                print good
            elif ftype21 == False:
                if ftype22 == True:
                    print good
                else:
                    time.sleep(3.5)
                    print "error256"
                    print error256
                    time.sleep(2)
                    quit()

Here is my entire code if you need it, thanks so much in advance.

如果您需要,这是我的整个代码,非常感谢您提前。

https://docs.google.com/document/d/1Pjk2MFAKwJzPoFvNXB7DWdrCMEnwnU7Y-oYoKAWcv_0/edit?usp=sharing

https://docs.google.com/document/d/1Pjk2MFAKwJzPoFvNXB7DWdrCMEnwnU7Y-oYoKAWcv_0/edit?usp=sharing

1 个解决方案

#1


1  

You're missing a close parenthesis on the first line.

你在第一行错过了一个紧密的括号。

#1


1  

You're missing a close parenthesis on the first line.

你在第一行错过了一个紧密的括号。