简体   繁体   English

我的程序返回“解析时意外的EOF”或“预期的缩进块”均为语法错误

[英]My program comes back with either “Unexpected EOF while parsing” or “Expected indented block” both as syntax errors

Here is a small terminal-style program I had been working on, but stopped because of issues with the code.(Written in Python 3.4.1) Could anyone help with this? 这是我一直在使用的小型终端样式程序,但是由于代码问题而停止了。(用Python 3.4.1编写)有人可以帮忙吗?

import time
import sys
import os
#This next part restarts the program in case of invalid user/pass combination
def restart_program():
    python = sys.executable
    os.execl(python, python, * sys.argv)
#definitions of strings in lists
h = 'h'
d = 'd'
ma = 'ma'
me = 'me'
c = 'c'
a = 'a'
l = 'l'
yes = 'yes'
no = 'no'
y = 'yes'
n = 'no'
Yes = 'yes'
No = 'no'
YEs = 'yes'
NO = 'no'
YES = 'yes'
nO = 'no'
yES = 'yes'
yeS = 'yes'
yEs = 'yes'
YeS = 'yes'
#String lists
varList1 = [d,ma,me,c,a,l,h]    
yeS = [yes,y,Yes,YEs,YES,yES,yeS,yEs,YeS]
nO = [no,n,No,NO,nO]
admin = 'admin'
deerfield = 'deerfield'
password = 'password'
cmenasco = 'cmenasco'
cyape = 'cyape'
guest = 'guest'
userList = [cmenasco,cyape,guest]
passList = [admin,deerfield,password]

print('Booting up.....')
print('...............')
print('...............')
print('')
print('')
print('-----LOGIN-----')
TempUser = input('username: ')
TempPassword = input('password: ')

if TempUser == cmenasco:
    if TempPassword == admin:
        print('welcome-Christian-')
        print('------------------')
        time.sleep(2.5)
        print('*-------------------------------------------*')
        print('|         Welcome to SAMNET v1.0!           |')
        print('|       (type in a catagory to view)        |')
        print('|              -documents(d)-|              |')
        print('|                  -mail(ma)-|              |') 
        print('|              -messages(me)-|              |')
        print('|             -classified(c)-|              |')
        print('|            -accountinfo(a)-|              |')
        print('|                 -logout(l)-|              |')
        print('|                   -help(h)-|              |')
        print('|                                           |')
        print('|               c.2013                      |')
        print('*-------------------------------------------*')
        var1 = input('press any key to continue: ')
#Documents
        if var1 == d:
            print('*------------------------------------------*')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')      
            print('|                                          |')
            print('|                                          |')      
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')      
            print('|                                          |')
            print('*------------------------------------------*')


#Mail
        elif var1 == ma:
            print('*------------------------------------------*')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')      
            print('|                                          |')
            print('|                                          |')      
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')      
            print('|                                          |')
            print('*------------------------------------------*')



#Messages
        elif var1 == me:
            print('*------------------------------------------*')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')      
            print('|                                          |')
            print('|                                          |')      
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')      
            print('|                                          |')
            print('*------------------------------------------*')



#Classified
        elif var1 == c:
            print('*------------------------------------------*')
            print('|                                          |')
            print('| 1. report22.txt                          |')
            print('| 2. introd.txt                            |')      
            print('| 3. mason.txt                             |')
            print('| 4. recent_inves.txt                      |')      
            print('| 5. information/about.txt                 |')
            print('| 6. recent_events(rus_com)                |')
            print('| 7. support                               |')
            print('|                                          |')
            print('|                                          |')      
            print('|                                          |')
            print('*------------------------------------------*')


#Account Info
        elif var1 == a:
            print('*------------------------------------------*')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')      
            print('|                                          |')
            print('|                                          |')      
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')      
            print('|                                          |')
            print('*------------------------------------------*')


#Help


        elif var1 == h:     
            print('*------------------------------------------*')
            print('|                help                      |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('|                                          |')
            print('*------------------------------------------*')






#Logout
        elif var1 == l:
            print('*------------------------------------------*')
            print('|       SAMNET-path/user-cmenasco          |')
            print('|                                          |')
            print('|         Do you want to logout?           |')
            print('|                                          |')
            print('|                                          |')
            print('|******************************************|')
            print('|               Warning!                   |')
            print('|If you logout, session will be terminated!|')
            print('|******************************************|')
            print('|                                          |')
            print('|                                          |')
            print('*------------------------------------------*')
            respondYN = input('(yes/no) ')
            if respondYN == yeS:
                restart_program()
            elif respondYN == nO:






            #make the pages for each link

      #  elif var1 

This is the problem- it says that there is some "Expected indent" or "Unexpected EOF while parsing" -This is the rest of the unfinished program- 这是问题所在-它说有一些“预期的缩进”或“解析时出现意外的EOF”-这是未完成的程序的其余部分-

elif TempUser == cyape
    if TempPassword == deerfield
        print('success')

if TempUser == guest:
    if TempPassword == password:
        print('success')

if TempUser is not userList or TempPassword is not passList:
    print('incorrect password/username combination')

if TempUser is not userList or TempPassword is not passList:
        restart_program()

elif and if are missing colons Elif,如果缺少冒号

elif TempUser == cyape:
    if TempPassword == deerfield:
        print('success')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM