I just tried to use zotero-sync on a 2021 Mac Pro (M1), and encountered some problems. I found some fixes that appear to make it work well, but I am not an advanced python user/developer, and have limited ability to check on various OS, etc. so I am a little reluctant to fork the repo, and issue pull requests, etc. Instead I am just going to report my findings to you in the hopes that it might be useful to you. Apologies if this is just wasting your bandwidth. Anyway, Here goes:
First, my environment, and the problem:
I tried to use it on my mac pro (M1 Max, running Ventura 13.0.1)
this required installing pip. I did so by installing conda (using the x86_64 architecture, not the ARM_64 architeture), then creating a new environment and install pip (telling conda to use the conda-forge channel, which produced an environment using python 3.11)
pip install zotero_sync worked fine.
executing zotero_sync trash scanned my zotfile directory on my machine and the cloud and decided that all of my PDF files should be moved to trash (which is not correct). So I started debugging.
I was not able to build the app using the poetry lockfile (after installing poetry), so I gave up on that, and just debugged the code by executing python -m zotero_sync trash, then isolating code segments to help debug it. Here is what I learned.
first, the variable "file_dir" that is returned from click is returned on my system as a string type variable, not a "Path" type. The result is that the glob command fails, and a later python command to create the string used to "mkdir trash" fails because the concatenation operator for a string differs from the concatenation for a path variables.
it was easy to fix this by checking the type, and casting the string to a path (see my mods below).
next problem was that the python code returns the list of PDF files on the cloud (variable "cloud_paths") with a string "attachment:" prepended to each filename, and so the compare with the list of files in the zotfile directory fails. So I added code to strip out the extra string and return only the filename (no path information) using the re package
last problem was that the compare to identify the files not present on the cloud (so they should be deleted on the computer) uses "path.absolute", but I think what is needed is "path.name" to create the list in variable "computer_unique" that is need for the subsequent move to the trash file.
After making these changes the code works fine. It identifies the files that aren't specified on the cloud and moves them to trash if I let it.
I will attach a git diff against your repo in the hope that it might be useful to you, and I would be glad to issue a pull request if you prefer, or to test a new build, if you decide to upgrade the code with your preferred fixes.
Like I said, I hope this is useful to you or others trying the code. The script is definitely useful to me, and I learned more python at the same time. Thanks!
Hi Jacob,
I just tried to use zotero-sync on a 2021 Mac Pro (M1), and encountered some problems. I found some fixes that appear to make it work well, but I am not an advanced python user/developer, and have limited ability to check on various OS, etc. so I am a little reluctant to fork the repo, and issue pull requests, etc. Instead I am just going to report my findings to you in the hopes that it might be useful to you. Apologies if this is just wasting your bandwidth. Anyway, Here goes:
First, my environment, and the problem:
pip install zotero_sync
worked fine.zotero_sync trash
scanned my zotfile directory on my machine and the cloud and decided that all of my PDF files should be moved to trash (which is not correct). So I started debugging.python -m zotero_sync trash
, then isolating code segments to help debug it. Here is what I learned.After making these changes the code works fine. It identifies the files that aren't specified on the cloud and moves them to trash if I let it.
I will attach a
git diff
against your repo in the hope that it might be useful to you, and I would be glad to issue a pull request if you prefer, or to test a new build, if you decide to upgrade the code with your preferred fixes.Like I said, I hope this is useful to you or others trying the code. The script is definitely useful to me, and I learned more python at the same time. Thanks!
Phil
git_diff_out.txt