-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] Report: handle PermissionError when trying to save #2225
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2225 +/- ##
=======================================
Coverage 72.37% 72.37%
=======================================
Files 319 319
Lines 55014 55014
=======================================
Hits 39819 39819
Misses 15195 15195 |
Orange/canvas/report/owreport.py
Outdated
@@ -162,13 +162,13 @@ def _setup_ui_(self): | |||
|
|||
class PyBridge(QObject): | |||
@pyqtSlot(str) | |||
def _select_item(myself, item_id): | |||
def _select_item(self, item_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this argument should have stayed myself
; using self
here shadows the self
from the outer scope.
See the line below: do instances of QObject
have an attribute table_model
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shame on me. I blindly followed lint's complaints.
Orange/canvas/report/owreport.py
Outdated
item = self.table_model.get_item_by_id(item_id) | ||
self.table.selectRow(self.table_model.indexFromItem(item).row()) | ||
self._change_selected_item(item) | ||
|
||
@pyqtSlot(str, str) | ||
def _add_comment(myself, item_id, value): | ||
def _add_comment(self, item_id, value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
Orange/canvas/report/owreport.py
Outdated
@@ -337,14 +340,14 @@ def open_report(self): | |||
|
|||
try: | |||
report = self.load(filename) | |||
except (IOError, AttributeError) as e: | |||
except (IOError, AttributeError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to open a file with extension .report, but which was not actually a report file. It crashes with UnpicklingError
. Perhaps you should add it to list, or even catch the general Exception
here.
Orange/canvas/report/owreport.py
Outdated
parent=self) | ||
self.tr("Could not load an Orange Report file"), | ||
title=self.tr("Error"), | ||
informative_text=self.tr("An unexpected error occurred " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unexpected (all errors are unexpected) and probably also the article, hence "Error occurred while loading '%s'.
Orange/canvas/report/owreport.py
Outdated
self.tr("Could not load an Orange Report file"), | ||
title=self.tr("Error"), | ||
informative_text=self.tr("An unexpected error occurred " | ||
"while loading '%s'.") % filename, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use formatting with {}
and format
, not the C-style %
. I would say the the old-style is permitted in Orange only for consistency in the modules that (still) use the old style.
Issue
https://sentry.io/biolab/orange3/issues/251030241/
Description of changes
Now shows a windows with error message and logs error as well.
Includes