Browse Source

Added try-except for os.listdir imo tbh famalmalmlam

Wazakindjes 4 years ago
parent
commit
244f46b2f9
1 changed files with 12 additions and 3 deletions
  1. 12 3
      hurr.py

+ 12 - 3
hurr.py

@@ -40,7 +40,10 @@ MUHCONF = {
 def getscrots():
 	global MUHCONF
 	p = re.compile(MUHCONF['scrotpattern'], re.I)
-	return [f for f in os.listdir(MUHCONF['scrotdir']) if p.match(f)]
+	try:
+		return [f for f in os.listdir(MUHCONF['scrotdir']) if p.match(f)]
+	except:
+		return []
 
 def getscrots_alt():
 	global MUHCONF
@@ -48,7 +51,10 @@ def getscrots_alt():
 		return []
 
 	p = re.compile(MUHCONF['scrotpattern_alt'], re.I)
-	return [f for f in os.listdir(MUHCONF['scrotdir_alt']) if p.match(f)]
+	try:
+		return [f for f in os.listdir(MUHCONF['scrotdir_alt']) if p.match(f)]
+	except:
+		return []
 
 def getscrots_db():
 	global MUHCONF
@@ -56,7 +62,10 @@ def getscrots_db():
 		return []
 
 	p = re.compile(MUHCONF['scrotpattern_db'], re.I)
-	return [f for f in os.listdir(MUHCONF['scrotdir_db']) if p.match(f)]
+	try:
+		return [f for f in os.listdir(MUHCONF['scrotdir_db']) if p.match(f)]
+	except:
+		return []
 
 def growlnotif(ID, errorid=None, errormsg=None):
 	global GROWL, MUHCONF