Missing DB in unmounted disk results in Traceback
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenLP |
Fix Committed
|
Low
|
Tomas Groth | ||
2.4 |
Fix Released
|
Low
|
Tomas Groth |
Bug Description
When data folder was moved from E: to D:, the following traceback
appears on startup after a few "Missing DB messages.
This is probably happening because the drive E: was dismounted and no longer available. Changing the path in registry fixed this issue.
Trunk 2696 | Win 10
Traceback (most recent call last):
File "openlp.py", line 44, in <module>
main()
File "D:\bzr\
sys.
File "D:\bzr\
raise e
File "D:\bzr\
return func(*args, **kwargs)
File "D:\bzr\
Registry(
File "D:\bzr\
result = function(*args, **kwargs)
File "D:\bzr\
raise e
File "D:\bzr\
return func(*args, **kwargs)
File "D:\bzr\
self.
File "D:\bzr\
raise e
File "D:\bzr\
return func(*args, **kwargs)
File "D:\bzr\
plugin.
File "D:\bzr\
self.media_item = self.media_
File "D:\bzr\
super(
File "D:\bzr\
self.
File "D:\bzr\
self.
File "D:\bzr\
image_groups = self.manager.
File "D:\bzr\
query = self.session.
AttributeError: 'NoneType' object has no attribute 'query'
Related branches
- Tim Bentley: Needs Fixing
- Tomas Groth: Needs Fixing
- Raoul Snyman: Approve
-
Diff: 302 lines (+90/-90)7 files modifiedopenlp/core/__init__.py (+40/-6)
openlp/core/lib/__init__.py (+15/-22)
openlp/core/ui/advancedtab.py (+0/-21)
openlp/core/ui/lib/treewidgetwithdnd.py (+6/-1)
openlp/core/ui/slidecontroller.py (+2/-0)
tests/functional/openlp_core_lib/test_lib.py (+25/-37)
tests/functional/openlp_plugins/bibles/test_swordimport.py (+2/-3)
- Raoul Snyman: Approve
-
Diff: 299 lines (+92/-89)6 files modifiedopenlp/core/__init__.py (+41/-5)
openlp/core/lib/__init__.py (+15/-22)
openlp/core/ui/advancedtab.py (+0/-21)
openlp/core/ui/lib/treewidgetwithdnd.py (+6/-1)
openlp/core/ui/slidecontroller.py (+2/-0)
tests/functional/openlp_core_lib/test_lib.py (+28/-40)
- Tim Bentley: Approve
-
Diff: 407 lines (+174/-29)12 files modifiedopenlp/core/__init__.py (+38/-2)
openlp/core/lib/treewidgetwithdnd.py (+6/-1)
openlp/core/ui/slidecontroller.py (+2/-0)
openlp/plugins/songs/lib/__init__.py (+2/-2)
openlp/plugins/songs/lib/importers/easyslides.py (+12/-12)
openlp/plugins/songs/lib/importers/songbeamer.py (+7/-3)
openlp/plugins/songs/lib/importers/videopsalm.py (+4/-2)
tests/functional/openlp_plugins/songs/test_easyslidesimport.py (+2/-0)
tests/resources/easyslidessongs/Amazing Grace.json (+6/-6)
tests/resources/easyslidessongs/Export_2017-01-12_BB.json (+44/-0)
tests/resources/easyslidessongs/Export_2017-01-12_BB.xml (+50/-0)
tests/resources/videopsalmsongs/videopsalm-as-safe-a-stronghold.json (+1/-1)
description: | updated |
description: | updated |
summary: |
- Missing DB results in Traceback + Missing DB in unmounted disk results in Traceback |
Changed in openlp: | |
importance: | Undecided → Low |
Changed in openlp: | |
assignee: | nobody → Azaziah (suutari-olli) |
status: | New → In Progress |
Changed in openlp: | |
assignee: | Azaziah (suutari-olli) → nobody |
assignee: | nobody → Tomas Groth (tomasgroth) |
status: | In Progress → Fix Committed |
milestone: | none → 2.5.1 |
This is just a symptom of the actual problem!
Line openlp. core.common. applocation line 84, we assume that a path taken from the settings exists, where as if we are using the default location we actually check that it exists (and create it if we dont)! (openlp.core.common line 65)
openlp. core.common. applocation line 84 ).contains( 'advanced/ data path'): ).value( 'advanced/ data path') get_directory( AppLocation. DataDir)
check_ directory_ exists( path) normpath( path)
def get_data_path():
"""
Return the path OpenLP stores all its data under.
"""
# Check if we have a different data location.
if Settings(
path = Settings(
else:
path = AppLocation.
return os.path.
openlp.core.common line 65
def check_directory _exists( directory, do_not_log=False):
"""
Check a theme directory exists and if not create it
:param directory: The directory to make sure exists
log. debug(' check_directory _exists {text}' .format( text=directory) ) exists( directory) :
os.makedirs( directory)
log.exception ('failed to check if directory exists or create directory')
:param do_not_log: To not log anything. This is need for the start up, when the log isn't ready.
"""
if not do_not_log:
try:
if not os.path.
except IOError as e:
if not do_not_log:
As we assume that the directory exists when openlp. core.lib. db.init_ db line 43 is called, it raises an exception openlp/ core/lib/ db.py:254 and the session isn't created.
First part of my prefered solution would be to modify check_directory _exists (openlp.core.common line 65) to return a boolean value indicating if it exists or not.
Then I would make sure that get_data_path (openlp. core.common. applocation line 84) checks that the custom path exists. If the custom path does not exist, the user would be informed (in case of a removable drive, etc.), with an option of resetting the path back to default. If they chose that option then OpenLP could carry on loading (with out the data), or OpenLP would close to allow the user to make the data available (insert removable drive, mount network share etc)