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 incompatibility #8

Closed
odelalleau opened this issue Dec 16, 2019 · 16 comments
Closed

Zotfile incompatibility #8

odelalleau opened this issue Dec 16, 2019 · 16 comments

Comments

@odelalleau
Copy link

odelalleau commented Dec 16, 2019

I use Zotfile, which renames and moves my PDF to a different folder.

When trying to do a zotsite export I get this kind of error:

FileNotFoundError: [Errno 2] No such file or directory: '/Users/odelalleau/Zotero/storage/BCH5KBQL/Volumes/GoogleDrive/Mon disque/bib/Cobbe+al-2019_Leveraging-procedural-generation-to-benchmark-reinforcement-learning.pdf'

Here, the folder /Users/odelalleau/Zotero/storage/BCH5KBQL exists but is empty (or at least almost empty, it contains some full-text index information), and the PDF is actually inside /Volumes/GoogleDrive/Mon disque/bib/ (Zotfile's custom file location)

@plandes
Copy link
Owner

plandes commented Dec 20, 2019

I'm not sure really why this isn't working, but first I'd try to export to a local file system and then rsync it to a the target drive file system. This script was written to just that.

If that doesn't work, I'd recommend upgrading to the latest version, which maps long to short file names, without special characters and might also help.

The easiest way to upgrade is with:

pip intstall -U zensols.zotsite

Let me know if this works.

@odelalleau
Copy link
Author

Thanks, unfortunately:

  1. Using zotsite export -o /path/to/some/local/dir leads to the exact same error
  2. After upgrading with the suggested command, I now have a new error (regardless of whether or not I use the -o option):
 ~/tmp/zotsite_test2  zotsite export                                                                                                  ✔  1.81 L
copying static data -> zotsite
Traceback (most recent call last):
  File "/Users/odelalleau/opt/miniconda3/envs/py37-zotsite/bin/zotsite", line 8, in <module>
    sys.exit(main())
  File "/Users/odelalleau/opt/miniconda3/envs/py37-zotsite/lib/python3.7/site-packages/zensols/zotsite/cli.py", line 53, in main
    cl.invoke()
  File "/Users/odelalleau/opt/miniconda3/envs/py37-zotsite/lib/python3.7/site-packages/zensols/actioncli/simple.py", line 202, in invoke
    getattr(exec_obj, meth)()
  File "/Users/odelalleau/opt/miniconda3/envs/py37-zotsite/lib/python3.7/site-packages/zensols/zotsite/cli.py", line 17, in export
    self.site.export()
  File "/Users/odelalleau/opt/miniconda3/envs/py37-zotsite/lib/python3.7/site-packages/zensols/zotsite/site.py", line 148, in export
    self._copy_static()
  File "/Users/odelalleau/opt/miniconda3/envs/py37-zotsite/lib/python3.7/site-packages/zensols/zotsite/site.py", line 142, in _copy_static
    self._copy_static_res(src_dir, self.out_dir)
  File "/Users/odelalleau/opt/miniconda3/envs/py37-zotsite/lib/python3.7/site-packages/zensols/zotsite/site.py", line 128, in _copy_static_res
    for res in src.iterdir():
  File "/Users/odelalleau/opt/miniconda3/envs/py37-zotsite/lib/python3.7/pathlib.py", line 1090, in iterdir
    for name in self._accessor.listdir(self):
FileNotFoundError: [Errno 2] No such file or directory: 'resources/src'

@plandes
Copy link
Owner

plandes commented Dec 24, 2019

Did you do a pip3 install -U zensols.zotsite ?

@odelalleau
Copy link
Author

Yes (well except using pip instead of pip3 because I'm in a Python 3 conda env). Just ran it again and it skips everything due to "requirement already satisfied".

@plandes
Copy link
Owner

plandes commented Dec 24, 2019

Will you please tell me what this gives you:

pip freeze | grep zensols\.action

@plandes
Copy link
Owner

plandes commented Dec 24, 2019

@odelalleau This should now be fixed. Do another pip install -U zensols.zotsite and let me know what if it works.

@odelalleau
Copy link
Author

I ran into another error because apparently Path('~/Zotero/zotero.sqlite') is not valid (on MacOS), but I was able to get around it by specifying the full path to the data directory in a config file.

Unfortunately, now I am back to the original error where it still tries to concatenate the original storage path with the linked path:

FileNotFoundError: [Errno 2] No such file or directory: '/Users/odelalleau/Zotero/storage/JMGJQZKY/Volumes/GoogleDrive/Mon disque/bib/Goodfellow+al-2015_Explaining-and-harnessing-adversarial-examples.pdf'

@plandes
Copy link
Owner

plandes commented Dec 24, 2019

It's still using long file names. The default for file_mapping is item, but add this to your configuration file to and try again. Also, are you using the zotsite.sh script?

# one of: item or long
file_mapping = item

@odelalleau
Copy link
Author

Setting file_mapping to either item or long in my config file does not seem to make a difference.
I'm not using directly your zotsite.sh script but I am running zotsite export from a local drive, and specifying -o /path/to/a/local/destination.
The folder containing my PDFs is on Google Drive, but I'm using the Google Drive File Stream app set up so that this folder is fully synced on my drive.

In case this might help, I looked at what happened in fscpvisitor.py l.39 and at this point I have self.data_path=PosixPath('/Users/odelalleau/Zotero/storage') and child.file_name='JMGJQZKY//Volumes/GoogleDrive/Mon disque/bib/Goodfellow+al-2015_Explaining-and-harnessing-adversarial-examples.pdf'.

@plandes
Copy link
Owner

plandes commented Dec 24, 2019

OK, The issue with the path you mentioned with ~/Zotero/zotero.sqlite will be fixed in the next version. As for the it not using short names, I have no idea. I tested that specifically on my end (again) and it switches back and forth. Can you please set file_mapping to something like 'BERT' to see if it reading that configuration? It should choke on anything that's not item or long.

@odelalleau
Copy link
Author

Yes, if I set file_mapping to something else than item or long it crashes with "unknown file mapping". But regardless of whether it is set to item or long, in both cases the values of self.data_path and child.file_name are as listed above.

@plandes
Copy link
Owner

plandes commented Dec 24, 2019

Please download and do a pip install on this file:
zensols.zotsite-0.3.1-py3-none-any.whl.zip

Then use -w 2 at the end of the command line export and upload the the last several lines of the error. Also include the line that looks like this:

zensols.zotsite.fscpvisitor: data_path: /Users/user/some/path/storage, out_path: <some path>

@odelalleau
Copy link
Author

Here is the full log in attachment: log_long.txt

(with file_mapping = long but the same happens with item). It now crashes at a different place (doesn't seem to reach the line you mentioned).

@plandes
Copy link
Owner

plandes commented Dec 31, 2019

OK, I think we're getting closer--this was very helpful. Same routine.

zensols.zotsite-0.3.1-py3-none-any.whl.zip

@odelalleau
Copy link
Author

Working, thanks a lot!! (there was just a minor typo in your code which I fixed on my side: abs_path.exists() instead of abs_path.exist())

@plandes
Copy link
Owner

plandes commented Jan 3, 2020

Great! Also, thanks for noticing the typo. This is now available as version 0.3.2 and installable with:

pip install -U zensols.zotsite==0.3.2

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