mnemosyne.script: crash on relative data_path
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
The Mnemosyne Project |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
Using a relative data_path with the script module crashes mnemosyne on the pbienst and mnemosyne-proj branches (with the Mnemosyne(None) fix applied). In the example below, the path does not exist. Using an existing path leads to a different error, but I think it has the same cause:
from mnemosyne.script import Mnemosyne
m = Mnemosyne('foobar')
Error message:
Previous drive letter no longer available.
If you are using a USB key, refer to the instructions on the website so as not to be affected by drive letter changes.
An unexpected error has occurred.
Please forward the following info to the developers:
Traceback (innermost last):
File "./test.py", line 11, in <module>
m = Mnemosyne('foobar')
File "/home/
self.
File "/home/
self.
File "/home/
self.
File "/home/
self.
File "/home/
review_
TypeError: stop_media() missing 1 required positional argument: 'self'
An unexpected error has occurred.
Some observations:
In mnemosyne/
path = expand_
-> path = expand_
returns path: 'foobar/default.db'
In mnemosyne/
self._path = expand_path(path, self.config(
-> self._path = expand_
returns _path: 'foobar/
This is probably wrong.
- Calling "mnemosyne/
- This papers over the crash, but the real fix would be somewhere else, I guess:
=== modified file 'mnemosyne/
--- mnemosyne/
+++ mnemosyne/
@@ -2,6 +2,8 @@
# script <email address hidden>
#
+import os.path
+
from mnemosyne.
from mnemosyne.
from mnemosyne.
@@ -41,4 +43,8 @@
+
+ if data_dir is not None:
+ data_dir = os.path.
+
committed in pbienst, thanks!