pensieve icon indicating copy to clipboard operation
pensieve copied to clipboard

Can not find the screenshots directory

Open xyb opened this issue 1 year ago • 2 comments

There's a crash if you not run the memos.commands watch in the directory ~/.memos:

❯ /Users/xyb/.virtualenvs/pensieve/bin/python3 -m memos.commands watch
...
│ /Users/xyb/.virtualenvs/pensieve/lib/python3.12/site-packages/memos/commands.py:144 in                           │
│ get_or_create_default_library                                                                                    │
│                                                                                                                  │
│   141 │   │   folder = {                                                                                         │
│   142 │   │   │   "path": str(screenshots_dir),                                                                  │
│   143 │   │   │   "last_modified_at": datetime.fromtimestamp(                                                    │
│ ❱ 144 │   │   │   │   screenshots_dir.stat().st_mtime                                                            │
│   145 │   │   │   ).isoformat(),                                                                                 │
│   146 │   │   }                                                                                                  │
│   147 │   │   response = httpx.post(                                                                             │
...
│ /Users/xyb/miniconda3/lib/python3.12/pathlib.py:840 in stat                                                      │
│                                                                                                                  │
│    837 │   │   Return the result of the stat() system call on this path, like                                    │
│    838 │   │   os.stat() does.                                                                                   │
│    839 │   │   """                                                                                               │
│ ❱  840 │   │   return os.stat(self, follow_symlinks=follow_symlinks)                                             │
│    841 │                                                                                                         │
│    842 │   def lstat(self):                                                                                      │
│    843 │   │   """                                                                                               │

FileNotFoundError: [Errno 2] No such file or directory: '/Users/xyb/screenshots'

xyb avatar Nov 18 '24 08:11 xyb

I fixed this by add a cd command before watch:

❯ cat ~/.memos/launch.sh
...
# run memos watch
cd ~/.memos
/Users/xyb/.virtualenvs/pensieve/bin/python3 -m memos.commands watch &

xyb avatar Nov 18 '24 08:11 xyb

This is a stupid bug I introduced https://github.com/arkohut/pensieve/commit/aa961a64bfa707878b2c5f1d964db05b445f198f . Already fixed.

arkohut avatar Nov 19 '24 11:11 arkohut

Works like a charm, thanks!

xyb avatar Nov 20 '24 09:11 xyb