mirror of
				https://github.com/MCV-Software/TWBlue.git
				synced 2025-10-30 20:02:01 +00:00 
			
		
		
		
	Handle properly a psutil exception. Closes #501
This commit is contained in:
		| @@ -115,12 +115,13 @@ def check_pid(): | |||||||
|     if os.path.exists(pidpath): |     if os.path.exists(pidpath): | ||||||
|         with open(pidpath) as fin: |         with open(pidpath) as fin: | ||||||
|             pid = int(fin.read()) |             pid = int(fin.read()) | ||||||
|  |         try: | ||||||
|             p = psutil.Process(pid=pid) |             p = psutil.Process(pid=pid) | ||||||
|             if p.is_running(): |             if p.is_running(): | ||||||
|                 # Display warning dialog |                 # Display warning dialog | ||||||
|                 commonMessageDialogs.common_error(_("{0} is already running. Close the other instance before starting this one. If you're sure that {0} isn't running, try deleting the file at {1}. If you're unsure of how to do this, contact the {0} developers.").format(application.name, pidpath)) |                 commonMessageDialogs.common_error(_("{0} is already running. Close the other instance before starting this one. If you're sure that {0} isn't running, try deleting the file at {1}. If you're unsure of how to do this, contact the {0} developers.").format(application.name, pidpath)) | ||||||
|                 sys.exit(1) |                 sys.exit(1) | ||||||
|         else: |         except psutil.NoSuchProcess: | ||||||
|             commonMessageDialogs.dead_pid() |             commonMessageDialogs.dead_pid() | ||||||
|     # Write the new PID |     # Write the new PID | ||||||
|     with open(pidpath,"w") as cam: |     with open(pidpath,"w") as cam: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user