Closed ggrrll closed 6 years ago
for me on OSX the paths were the following (you will have to replace the bold parts by the parts specific to your system):
the M mendeley file was the file
/Users/**username**/Library/Application Support/Mendeley Desktop/**my@emailaddress.com**@www.mendeley.com.sqlite
the zotero file Z was
/Users/**username**/Library/Application Support/Zotero/Profiles/**KEY**.default/zotero/zotero.sqlite
Please, back up these files before running the program!
If you're on windows or some other system, these links might help:
there is no sub-folder called 'zotero'
here is the list of .sqlite
files in my key.default
:
but there is a. zotero.sqlite
- in firefox folder
~/Library/Application Support/Firefox/Profiles/key.default/zotero/zotero.sqlite
Ah, yes if you're using the plugin and not the standalone, that is the file to take (also according to https://www.zotero.org/support/zotero_data). Please, again, back up before running.
Do I have to choose the other parameters too? I thought they were optional
I just got:
mendeley2zotero.py: error: argument command: invalid choice: 'Support/Firefox/Profiles/hd0xctag.default/zotero/zotero.sqlite' (choose from 'added_dates', 'repair_dates', 'collections')
No, you have to indeed specify the "job" to do. Also, I noticed you have a space in your path, so you will need to add quotes to it. Seems i forgot to add this to the documentation, sorry for that.
So, summing up, a valid call in your case would be (assuming your mendeley file is in the directory used below):
python mendeley2zotero.py -m "/Users/username/Library/Application Support/Mendeley Desktop/my@emailaddress.com@www.mendeley.com.sqlite" -z "/Users/username/Library/Application Support/Firefox/Profiles/key.default/zotero/zotero.sqlite" collections
ps:
I am on mac os 10.12.3, and I am running it acutally on python3.6 - please, find attached the version of the script, where I just fixed all print x
-> print(x)
This is the last part of the error message I get (running with quotes)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 393, in connect
return self.dbapi.connect(*cargs, **cparams)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
Can you please post the full command you are using (you can replace private parts by placeholders)?
I suspect the db files might be locked.. Is mendeley or zotero running? Can you shut them down and try again?
Re: python3, yes this script is not yet python3 compatible..
(after I switched to the standalone)
python3.6 mendeley2zotero.py -m "my_home/Library/Application\ Support/Mendeley\ Desktop/my_mail@www.mendeley.com.sqlite" -z "~/Library/Application\ Support/Zotero/Profiles/my_key.default/zotero/zotero.sqlite" collections
Could you try replacing the paths by the full ones? I. e.
python3.6 mendeley2zotero.py -m "/users/username/Library/Application\ Support/Mendeley\ Desktop/my_mail@www.mendeley.com.sqlite" -z "/users/username/Library/Application\ Support/Zotero/Profiles/my_key.default/zotero/zotero.sqlite" collections
Especially im unsure whether the ~/Library
will get expanded, better try the full path.
@ggrrll by the way, feel free to open a PR with the python 3 compatible changes!
yes, that's why I did - I just typed here the 'simplified path'
still getting
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 393, in connect
return self.dbapi.connect(*cargs, **cparams)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
so, no clues?
Hm, it's hard to remote diagnose this without going into the code. Can you post the full stack trace (the full error with all lines)
First to make sure your paths are correct, run in a terminal. replace with the ones you are using.
test -f "/users/username/Library/Application\ Support/Zotero/Profiles/my_key.default/zotero/zotero.sqlite"
test -f "/users/username/Library/Application\ Support/Mendeley\ Desktop/my_mail@www.mendeley.com.sqlite"
Then, try running this for each of the paths above and see what you get.
from sqlalchemy import create_engine
path = "/users/username/Library/Application\ Support/Mendeley\ Desktop/my_mail@www.mendeley.com.sqlite"
e = create_engine('sqlite:///'+path, echo=False)
s = sessionmaker(bind=e)
session = s()
It runs fine (no errors) for both paths...but what I am suppose to get / check?
(btw, you forgot: from sqlalchemy.orm import sessionmaker
)
(test -f ***
are ok - no error message)
I was just trying to see whether sqlalchemy can open the sqlite files. Can you please post the full error you get when running the script itself?
here you go m2z_errors.txt
Ah, facepalm.
I think you might have to SUDO the command, the files are all in write restricted folders, and sqlite3 probably complains about this. I.e. sudo python3.6 mendeley2zotero.py ...
.
EDIT: Or maybe this will not solve it, since the files are in the the user owned library folders. The next step i would recommend is to copy both zotero.sqlite and mendeley.sqlite to the same directory as the script call the command from that directory as
python3.6 mendeley2zotero.py -m mendeley.sqlite -z zotero.sqlite collections
I just really wanna exclude this is a path problem. Also make sure the permissions on these files have read flags for your user.
after copying the 2 sqlite in ~/Downloads/mendeley2zotero-master
I get new errors (find them attached)
m2z_errors_new.txt
(python3.6 mendeley2zotero.py -m mendeley.sqlite -z zotero.sqlite 2> m2z_errors_new.txt
)
Thanks again for support
ps: yes, all files in pwd
are -rw
Try replacing the files in the script with these two. Could be mendeley updated their db structure. db_classes_3-2017.zip
done! - new errors:
Ok, can you try checking out this branch (this also includes the python3 changes)? https://github.com/flinz/mendeley2zotero/tree/2017_fixes
python3.6 mendeley2zotero.py -m mendeley.sqlite -z zotero.sqlite 2> m2z_errors_new_2017.txt
Closing this due to inactivity.
Hi,
I tried with both:
but I got this error
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
Thanks for your support.