add exceptions
This commit is contained in:
		
							parent
							
								
									0fd4ff9b74
								
							
						
					
					
						commit
						ed10aa8f03
					
				
							
								
								
									
										2
									
								
								setup.py
								
								
								
								
							
							
						
						
									
										2
									
								
								setup.py
								
								
								
								
							|  | @ -13,7 +13,7 @@ def main(): | |||
|           long_description='SSH connection and aliases manager with curses and command line interface', | ||||
|           long_description_content_type='text/x-rst', | ||||
|           license='DWTWL 2.55', | ||||
|           version='1.04', | ||||
|           version='1.05', | ||||
|           py_modules=['sshch'], | ||||
|           scripts=['sshch/sshch'], | ||||
|           keywords='sshch ssh aliases curses manager', | ||||
|  |  | |||
							
								
								
									
										32
									
								
								sshch/sshch
								
								
								
								
							
							
						
						
									
										32
									
								
								sshch/sshch
								
								
								
								
							|  | @ -20,7 +20,7 @@ import curses | |||
| from curses import textpad, panel | ||||
| 
 | ||||
| # https://gitlab.com/zlax/sshch | ||||
| version = "1.04" | ||||
| version = "1.05" | ||||
| # expand groups by default | ||||
| expand_default = True | ||||
| # path to conf dir and file, default: ~/.config/sshch.conf | ||||
|  | @ -808,13 +808,28 @@ if __name__ == "__main__": | |||
|         pass | ||||
| 
 | ||||
|     if not path.exists(conf_dir): | ||||
|         from os import makedirs  | ||||
|         makedirs(conf_dir) | ||||
|         try: | ||||
|             from os import makedirs  | ||||
|             makedirs(conf_dir) | ||||
|         except: | ||||
|             print("Can't make dir " + conf_dir) | ||||
|             exit() | ||||
| 
 | ||||
|     conf = configparser.RawConfigParser() | ||||
| 
 | ||||
|     if not path.exists(conf_file): | ||||
|         open(conf_file, 'w') | ||||
|     conf.read(conf_file) | ||||
|         try: | ||||
|             open(conf_file, 'w') | ||||
|         except: | ||||
|             print("Can't make file at " + conf_dir) | ||||
|             exit() | ||||
|      | ||||
|     try: | ||||
|         conf.read(conf_file) | ||||
|     except: | ||||
|         print("Error: can't read config file " + conf_file) | ||||
|         exit() | ||||
| 
 | ||||
|     if len(argv) > 1: | ||||
|         try: | ||||
|             CMDOptions() | ||||
|  | @ -823,6 +838,10 @@ if __name__ == "__main__": | |||
|         except configparser.Error: | ||||
|             print("Error: can't parse your config file, please check it manually or make new one") | ||||
|             exit() | ||||
|         except IOError: | ||||
|             print("Error: can't use your config file, please check permissionss of " + conf_file) | ||||
|             exit() | ||||
| 
 | ||||
|     else: | ||||
|         try: | ||||
|             CursesMain() | ||||
|  | @ -834,3 +853,6 @@ if __name__ == "__main__": | |||
|         except curses.error: | ||||
|             CursesExit("".join(["Error: can't show some curses element, maybe ", | ||||
|                        "your terminal is too small"])) | ||||
|         except IOError: | ||||
|             CursesExit("".join(["Error: can't use your config file, please ", | ||||
|                        "check permissionss of ", conf_file])) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue