Skip to content
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

Zotfile incompatability again #33

Open
mpea413 opened this issue Feb 16, 2024 · 5 comments
Open

Zotfile incompatability again #33

mpea413 opened this issue Feb 16, 2024 · 5 comments

Comments

@mpea413
Copy link

mpea413 commented Feb 16, 2024

I'm having exactly the same issue as what was reported here:
#8

But I'm using zotsite version 0.9.1, with zotfile installed this year (2024) and Zotero version 6.0.30

When I export a collection that has .pdfs that have not been moved by zotfile it works fine.

However any items that do have attached .pdfs moved with zotfile fail with a FileNotFoundErrror, such as:
FileNotFoundError: [Errno 2] No such file or directory: '/home/m/Zotero/storage/73T7AU4N/Conference Paper/.pdf'
Showing that it seems to be mixing the original zotero storage with the zotfile path (as I have it put it into a directory by type, so Journals are in a folder, Thesis are in a folder etc).

@plandes
Copy link
Owner

plandes commented Feb 16, 2024

Sorry you're having issues @mpea413.

Did you configure file_mapping = long per the previous thread and anything else the previous user tried?

I've never used zotfile and not sure what it is, and this other issue you mentioned is 5 years old so the details aren't fresh. There's really not much you've provided to help me with your problem.

Will you please send a stack trace. Thanks in advance.

@mpea413
Copy link
Author

mpea413 commented Feb 16, 2024

Thanks for getting back so quick!

Yes, I did try both the file_mapping = long and file_mapping = item and file_mapping = BART.
"BART" threw an error, so it is reading the configuration file.
But both "long" and "item" gave the same result, which I thought was curious.

Zotfile will rename and move the attached .pdfs to another location, so all the .pdfs can be in one spot. It is useful for large collections of .pdfs and for easily having access to them external to zotero.
I don't yet understand how zotero's database works, but it seems like somehow zotsite is taking the wrong link to the file when zotfile is involved.

My apologies. Yes, I will try and send a stack trace and ideally make a small test setup that can be easily shared. Will try figure it myself as well.
However, this will be in about 1 week, sorry.

@plandes
Copy link
Owner

plandes commented Feb 16, 2024

If you're getting the same results by changing those values, it could be the program isn't finding the configuration file. I'd try running the program with an explicit --config argument and/or adding an 'X' to the configuration file to get it to error out to make sure it's reading it.

@mpea413
Copy link
Author

mpea413 commented Feb 21, 2024

Thank you. I did try that and yes, it does seem to be reading the config file I gave it.

For now I have made it work by hacking the "path" function at line 146 of:
https://github.com/plandes/zotsite/blob/master/src/python/zensols/zotsite/domain.py

I did this by forcing it to enter the conditional with the comment "# assume ZoteroFile is used" and prepending my local "Linked Attachment Base Directory" setting (from Zotero Preferences:Advanced) to the path, after first removing the "attachments:" part of itemAttachments:path.
This only works if all the items in the collection are the same, that is have linked attachments with a relative path, which works in my specific case.

I think there might be a bug (? at least in my usecase ?) in line 160 ish of domain.py, because it didn't seem to enter the conditional code "# assume ZoteroFile is used" . This is because there's always a "storage:" or "attachments:" prepended to the path. I think what I need in my case is something special done in the "attachments:" case. I'll work on trying to make the hack neater and for this usecase over the next week. It might require an extra line in the config file to give the "Linked Attachment Base Directory" as I think this is stored in the Zotero preferences(.js) file and not the SQLite database.

I tried to get the log file by setting the log file level with "--level" but I can't find where the log file is saved for zotsite.
Do you know where the zotsite log file is saved?

My apologies, I'm not really sure how the mechanics of "debugging / adding to open source software helpfully" works. At the moment I'm kinda treating this issue as a bit of a log for the discoveries I've made. Please let me know what the correct procedure is. For instance I can close this if needed.

Thanks again for writing really useful software and making it available. :-) Have a good day.

@plandes
Copy link
Owner

plandes commented Feb 21, 2024

Hi @mpea413,

Thanks for looking at this and reporting on what you found, I'm sure it will help others using ZoteroFile in the future.

Regarding changes: one idea is to add this path that you've set as a configuration option instead of just branching on the formatting of the storage string. We could do that, but that means making changes to thread that configuration into this strategy (GoF patterns) class.

I'd be willing to do that if there were more requests for this feature, but you're only the second one in 4 years now that's reported issues using ZoteroFile. This and the fact that you mentioned it could be an edge case given your setup/configuration deprioritizes these changes in my mind. However, if you want to make these changes yourself that would be general enough for others to use, please submit a pull request.

Regarding the --level flag: that should have increased the verbosity of logging to standard out. However, this is a framework provided flag and the perhaps this application has little logging coverage over the code you're using to create the site.

Thanks for the nice comment about the software--these comments make it worth it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants