黄老板逆天重写
This commit is contained in:
@@ -49,32 +49,32 @@ import time
|
||||
File_directory = os.path.join(input_data.File_directory)
|
||||
|
||||
## If the specified output directory exists, ask the user whether to continue
|
||||
if os.path.exists(File_directory):
|
||||
print( " Output dictionary has been existed !!! " )
|
||||
print( " If you want to overwrite the existing file directory, please input 'continue' in the terminal !! " )
|
||||
print( " If you want to retain the existing file directory, please input 'stop' in the terminal to stop the " )
|
||||
print( " simulation. Then you can reset the output dictionary in the input script file AMSS_NCKU_Input.py !!! " )
|
||||
print( )
|
||||
## Prompt whether to overwrite the existing directory
|
||||
while True:
|
||||
try:
|
||||
inputvalue = input()
|
||||
## If the user agrees to overwrite, proceed and remove the existing directory
|
||||
if ( inputvalue == "continue" ):
|
||||
print( " Continue the calculation !!! " )
|
||||
print( )
|
||||
break
|
||||
## If the user chooses not to overwrite, exit and keep the existing directory
|
||||
elif ( inputvalue == "stop" ):
|
||||
print( " Stop the calculation !!! " )
|
||||
sys.exit()
|
||||
## If the user input is invalid, prompt again
|
||||
else:
|
||||
print( " Please input your choice !!! " )
|
||||
print( " Input 'continue' or 'stop' in the terminal !!! " )
|
||||
except ValueError:
|
||||
print( " Please input your choice !!! " )
|
||||
print( " Input 'continue' or 'stop' in the terminal !!! " )
|
||||
# if os.path.exists(File_directory):
|
||||
# print( " Output dictionary has been existed !!! " )
|
||||
# print( " If you want to overwrite the existing file directory, please input 'continue' in the terminal !! " )
|
||||
# print( " If you want to retain the existing file directory, please input 'stop' in the terminal to stop the " )
|
||||
# print( " simulation. Then you can reset the output dictionary in the input script file AMSS_NCKU_Input.py !!! " )
|
||||
# print( )
|
||||
# ## Prompt whether to overwrite the existing directory
|
||||
# while True:
|
||||
# try:
|
||||
# inputvalue = input()
|
||||
# ## If the user agrees to overwrite, proceed and remove the existing directory
|
||||
# if ( inputvalue == "continue" ):
|
||||
# print( " Continue the calculation !!! " )
|
||||
# print( )
|
||||
# break
|
||||
# ## If the user chooses not to overwrite, exit and keep the existing directory
|
||||
# elif ( inputvalue == "stop" ):
|
||||
# print( " Stop the calculation !!! " )
|
||||
# sys.exit()
|
||||
# ## If the user input is invalid, prompt again
|
||||
# else:
|
||||
# print( " Please input your choice !!! " )
|
||||
# print( " Input 'continue' or 'stop' in the terminal !!! " )
|
||||
# except ValueError:
|
||||
# print( " Please input your choice !!! " )
|
||||
# print( " Input 'continue' or 'stop' in the terminal !!! " )
|
||||
|
||||
## Remove the existing output directory if present
|
||||
shutil.rmtree(File_directory, ignore_errors=True)
|
||||
|
||||
Reference in New Issue
Block a user