Skip to content

Commit 591a4f7

Browse files
authored
Merge pull request #57 from PW-Sat2/fixes
Major Fixes
2 parents b79618a + bd71c42 commit 591a4f7

20 files changed

+55
-69
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ target/
7474
# pyenv
7575
.python-version
7676

77+
.vscode
78+
7779
# celery beat schedule file
7880
celerybeat-schedule
7981

app/from_file_to_gui_queue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def load_from_file(self):
2424
thread.start()
2525
thread.join()
2626
except:
27-
self.logger.log(logging.DEBUG, "Load file exception")
27+
self.logger.log(logging.ERROR, "Load file exception")
2828

2929

3030
class FromFileToGuiQueueThread(Thread):
@@ -42,5 +42,5 @@ def run(self):
4242
for packet in packets:
4343
self.gui_queue.append(packet)
4444
except TypeError:
45-
self.logger.log(logging.DEBUG, "Empty packets list")
45+
self.logger.log(logging.ERROR, "Empty packets list")
4646
self.logger.log(logging.DEBUG, "Finished FromFileToGuiQueueThread")

app/gui_connection_state.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,8 @@ def check(self):
2424
def run(self):
2525
self.check()
2626
while not self.stop_event.wait(30):
27-
self.check()
27+
try:
28+
self.check()
29+
except Exception as e:
30+
self.logger.error("Major Exception in Check Auth hread", exc_info=e)
2831
self.logger.log(logging.DEBUG, "Finished CheckAuthThread")

app/load_credentials_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ def load_with_dialog(config):
4646
logger.log(logging.DEBUG, "Wrong file")
4747
return WrongOrEmptyCredentials
4848
except:
49-
logger.log(logging.DEBUG, "Load file exception")
49+
logger.log(logging.ERROR, "Load file exception")
5050
return UnknownError

app/queue_to_signal.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ def run(self):
2121
self.item_ready.emit(widget_item)
2222
except IndexError:
2323
time.sleep(1)
24+
except Exception as e:
25+
self.logger.error("Major Exception in GetFromQueueToSignalThread", exc_info=e)
2426
self.logger.log(logging.DEBUG, "Finished GetFromQueueToSignalThread")

app/receive_distribute.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ def connect_and_get_packet(self):
2828

2929
def run(self):
3030
while not self.stop_event.wait(0):
31-
packet = self.connect_and_get_packet()
32-
if packet is not None:
33-
self.gui_queue.append(packet)
34-
self.file_queue.put(packet)
31+
try:
32+
packet = self.connect_and_get_packet()
33+
if packet is not None:
34+
self.gui_queue.append(packet)
35+
self.file_queue.put(packet)
36+
except Exception as e:
37+
self.logger.error("Major Exception in Receive Distribute Thread", exc_info=e)
3538
self.logger.log(logging.DEBUG, "Finished ReceiveDistribute")

app/save_frames_file.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,6 @@ def run(self):
4343
writer.save(data)
4444
except Queue.Empty:
4545
pass
46+
except Exception as e:
47+
self.logger.error("Major Exception in Save Frames Thread", exc_info=e)
4648
self.logger.log(logging.DEBUG, "Finished ReceiveDistribute")

app/setup_log.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ def setup_log(debug):
3737

3838
if debug:
3939
root_logger_std.setLevel(logging.DEBUG)
40+
root_logger_file.setLevel(logging.DEBUG)
4041
else:
4142
root_logger_std.setLevel(logging.INFO)
43+
root_logger_file.setLevel(logging.INFO)
4244

43-
root_logger_file.setLevel(logging.DEBUG)
45+

app/update.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def download_version_file(self):
3535
got_version_file = True
3636
except Exception as e:
3737
got_version_file = False
38-
self.logger.log(logging.DEBUG, "Error in getting version file: {0}".format(e))
38+
self.logger.log(logging.ERROR, "Error in getting version file: {0}".format(e))
3939
time.sleep(10)
4040
self.logger.log(logging.DEBUG, "Got version file")
4141

@@ -72,7 +72,10 @@ def msgbtn(self, response):
7272
self.logger.log(logging.DEBUG, "Web browser opened")
7373

7474
def run(self):
75-
self.download_version_file()
76-
self.load_new_version_desc()
77-
self.is_new_version_available()
75+
try:
76+
self.download_version_file()
77+
self.load_new_version_desc()
78+
self.is_new_version_available()
79+
except Exception as e:
80+
self.logger.error("Major Exception in Updater", exc_info=e)
7881
self.logger.log(logging.DEBUG, "Finished Updater")

app/upload_cloud.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,17 @@ def run(self):
3434
self.cloud_tx_queue.appendleft(data)
3535
if data.upload_status is False:
3636
self.error_queue.appendleft(data)
37-
self.logger.log(logging.DEBUG, "added to error queue because of credentials")
38-
except requests.ConnectionError, requests.ReadTimeout:
37+
self.logger.log(logging.WARNING, "added to error queue because of credentials")
38+
except (requests.ConnectionError, requests.ReadTimeout):
3939
data.upload_status = False
4040
self.error_queue.appendleft(data)
4141
self.cloud_tx_queue.appendleft(data)
42-
self.logger.log(logging.DEBUG, "added to error queue because of internet")
42+
self.logger.log(logging.WARNING, "added to error queue because of internet")
4343
except IndexError:
4444
time.sleep(1)
45+
except Exception as e:
46+
self.logger.error("Major Exception in Upload Thread", exc_info=e)
47+
4548
self.logger.log(logging.DEBUG, "Finished UploadCloud")
4649

4750

@@ -70,11 +73,13 @@ def run(self):
7073
self.cloud_tx_queue.append(data)
7174
if data.upload_status is False:
7275
self.error_queue.appendleft(data)
73-
print "again added to error queue"
76+
self.logger.log(logging.WARNING, "again added to error queue")
7477
except IndexError:
7578
time.sleep(1)
76-
except requests.ConnectionError:
79+
except (requests.ConnectionError, requests.ReadTimeout):
7780
self.error_queue.appendleft(data)
78-
print "again added to error queue"
81+
self.logger.log(logging.WARNING, "again added to error queue:")
82+
except Exception as e:
83+
self.logger.error("Major Exception in UploadCloudError Thread", exc_info=e)
7984

8085
self.logger.log(logging.DEBUG, "Finished UploadCloudError")

0 commit comments

Comments
 (0)