MatthieuBizien / roam-to-git

Automatic RoamResearch backup to Git
MIT License
550 stars 133 forks source link

Fails with PermissionError #74

Closed pyx900 closed 3 years ago

pyx900 commented 3 years ago

Describe the bug Failes with PermissionError: [Errno 13] Permission denied: '/.md'

To Reproduce Steps to reproduce the behavior:

  1. Follow the installation instructions

Expected behavior The git to be updated with the changes from Roam

Traceback https://gist.github.com/amplifications/02ec2a399db0ac6f107ad02c0545a2a2 2020-11-24T07:48:52.8959469Z File "/opt/hostedtoolcache/Python/3.8.6/x64/lib/python3.8/pathlib.py", line 1077, in _opener 2020-11-24T07:48:52.8961081Z return self._accessor.open(self, flags, mode) 2020-11-24T07:48:52.8962465Z │ │ │ │ └ 438 2020-11-24T07:48:52.8963533Z │ │ │ └ 524865 2020-11-24T07:48:52.8964720Z │ │ └ PosixPath('/.md') 2020-11-24T07:48:52.8966088Z │ └ <member '_accessor' of 'Path' objects> 2020-11-24T07:48:52.8967395Z └ PosixPath('/.md') 2020-11-24T07:48:52.8967972Z 2020-11-24T07:48:52.8969274Z PermissionError: [Errno 13] Permission denied: '/.md' 2020-11-24T07:48:52.8970600Z Traceback (most recent call last): 2020-11-24T07:48:52.8972460Z File "/opt/hostedtoolcache/Python/3.8.6/x64/bin/roam-to-git", line 33, in 2020-11-24T07:48:52.8974558Z sys.exit(load_entry_point('roam-to-git==0.1', 'console_scripts', 'roam-to-git')()) 2020-11-24T07:48:52.8987751Z File "/opt/hostedtoolcache/Python/3.8.6/x64/lib/python3.8/site-packages/loguru/_logger.py", line 1149, in catch_wrapper 2020-11-24T07:48:52.8989274Z return function(*args, **kwargs) 2020-11-24T07:48:52.8990441Z File "/opt/hostedtoolcache/Python/3.8.6/x64/lib/python3.8/site-packages/roam_to_git/main.py", line 82, in main 2020-11-24T07:48:52.8991492Z save_markdowns(git_path / "markdown", raws) 2020-11-24T07:48:52.8992682Z File "/opt/hostedtoolcache/Python/3.8.6/x64/lib/python3.8/site-packages/roam_to_git/fs.py", line 57, in save_markdowns 2020-11-24T07:48:52.8993719Z with dest.open("w", encoding="utf-8") as f: 2020-11-24T07:48:52.8994546Z File "/opt/hostedtoolcache/Python/3.8.6/x64/lib/python3.8/pathlib.py", line 1221, in open 2020-11-24T07:48:52.8995450Z return io.open(self, mode, buffering, encoding, errors, newline, 2020-11-24T07:48:52.8996401Z File "/opt/hostedtoolcache/Python/3.8.6/x64/lib/python3.8/pathlib.py", line 1077, in _opener 2020-11-24T07:48:52.8997395Z return self._accessor.open(self, flags, mode) 2020-11-24T07:48:52.8998303Z PermissionError: [Errno 13] Permission denied: '/.md' 2020-11-24T07:48:52.9298148Z ##[error]Process completed with exit code 1.

Run roam-to-git --debug notes/ and report what you get.

Please complete the following information:

Additional context Add any other context about the problem here.

phildenhoff commented 3 years ago

Hi @amplifications, do you have any pages in Roam with an empty title? Or pages that end with a slash, like "Projects/"? If you do, and can rename them (by giving them a title or by removing the slash) I think that should work.

pyx900 commented 3 years ago

Appreciate the revert @phildenhoff.

Yes I have used namespaces in some page titles. Is there a way to retain the namespace "/" and still get this backup process to work?

cheers!

phildenhoff commented 3 years ago

Yeah the script automatically splits namespaces into separate folders, so projects/write is a file write.md in the projects folder. But if your name ends in slash, I think it tries to create a file called project and one called /, or nothing, and then you get a permission error. I was having issues with this before.

I’d just take a look at all your pages and see if there’s anything ending in a /. You can still have Projects and Projects/Write. Just not Projects/

pyx900 commented 3 years ago

Got it. The restriction was only "ending with /" ... not containing "/".

Fixed the offending title .....and the script worked like a charm. Thx a ton!