Templater icon indicating copy to clipboard operation
Templater copied to clipboard

System command issue

Open pillouz01 opened this issue 2 years ago • 5 comments

Hi All, I'm quite newbie with this plugin and need your help here I'm trying to reproduce that and get an error

app.js:1 Obsidian Developer Console (unknown) Loading Hotkeys++ plugin (unknown) loading url-into-selection (unknown) Dataview: Version 0.4.26 Loaded ObsidianOutlinerPlugin.ts:36 Loading obsidian-outliner main.ts:40 loading Hotkeys for templates plugin v1.4.3 VM144:28331 Loading Markdown-Prettifier VM145:760 Obsidian Admonition loaded VM150:39 loading dictionary main.ts:30 loading markdown-table-editor plugin main.ts:20 Loading Mind Map plugin main.ts:20 Loading natural language date parser plugin main.ts:31 Loading Note Refactor plugin main.ts:213 Recent Files: Loading plugin v1.3.2 main.ts:269 Recent Files: maxLength is not set, using default (50) main.ts:18 loading plugin "tasks" main.ts:48 loading obsidian-tracker plugin VM160:15998 Loading QuickAdd VM162:5387 Loading MetaEdit VM162:5146 MetaEdit: (LOG) automator of type 'KanbanHelper' does not exist. VM162:5146 MetaEdit: (LOG) automator of type 'ProgressProperties' does not exist. main.ts:28 Loading Day Planner plugin index.ts:154 Dataview: Task & metadata parsing queued in 0.064s. main.ts:148 Hotkeys for templates -> active plugins: templater-obsidian,core

**VM114:82 Templater Error: Error with User Template dailyEvents

Error: spawn /usr/local/bin EACCES

at Process.ChildProcess._handle.onexit (internal/child_process.js:267)

at onErrorNT (internal/child_process.js:469)

at processTicksAndRejections (internal/process/task_queues.js:84)**

log_error @ VM114:82 eval @ VM114:105 rejected @ VM114:57 Promise.then (async) step @ VM114:62 eval @ VM114:63 __async @ VM114:47 errorWrapper @ VM114:98 eval @ VM114:3766 eval @ VM114:63 __async @ VM114:47 append_template_to_active_file @ VM114:3759 onChooseItem @ VM114:2361 t.onChooseSuggestion @ app.js:1 t.selectSuggestion @ app.js:1 e.useSelectedItem @ app.js:1 e.onSuggestionClick @ app.js:1 s @ app.js:1

Is someone can help here ? Thanks Patrick

pillouz01 avatar Mar 21 '22 15:03 pillouz01

Hi! It looks like there is a permissions error when trying to access /usr/local/bin to run iCalBuddy.

Are you comfortable with the command line? If not, this is going to be a bit challenging to troubleshoot.

First thing to try is specifying the full path to iCalBuddy

In the terminal run which iCalBuddy. It should return the full path (if it doesn't that mean iCalBuddy was not installed properly). Copy that full path and replace iCalBuddy in the User Template command with it. See if that changes your error.

There are multiple other things that could be causing this error, but I hope it's as simple as this.

shabegom avatar Mar 21 '22 15:03 shabegom

I'm trying to do the exact same thing. As @shabegom suggested, you need to call icalBuddy by it's absolute path. It should look like something like this: image

However, I have another problem that I'm unable to solve for couple of days. When I insert this template, icalBuddy cannot find any calendars. I can see it in Obsidian console: image

The exact same command works in my terminal (iTerm). However the first time I ran it, macOS prompted me about permission stuff. After allowing iTerm to access my calendar, icalBuddy returns events as I wanted. But, macOS doesn't prompted me about permission stuff for Obsidian. In macOS System Preferences > Security & Privacy > Privacy > Calendar tab, I see the apps that I allowed before and there is no button to manually add an app :/ image

Has anyone encountered this kind of permission issue before?

dgurkaynak avatar Mar 21 '22 18:03 dgurkaynak

Hi Thanks a lot @shabegom I have tried adding the full path but same issue I have installed icalbuddy with hombrew In terminal the command works perfectly Any other idea? Thanks Patrick

pillouz01 avatar Mar 22 '22 07:03 pillouz01

@dgurkaynak that seems weird that the container app needs permission and not the iCalBuddy script itself. I know with some of those screens you can drag/drop apps on the list to add them.

@pillouz01 ah homebrew. Ok.

So a couple of common things that break shell scripts:

  1. Specify the full path to the shell you want to use in the templater settings (zsh, bash, etc)
  2. The most common problem is that the script needs access to your $PATH which for some reason the child process doesn't read properly (see #512). The fix is to explicitly set the $PATH before running the command (something like PATH=$PATH:/usr/local/bin).

If that doesn't work, maybe it is really just a permissions issue and you need to chmod the directory throwing the error? Seems odd that your user wouldn't have permissions tho.

shabegom avatar Mar 22 '22 12:03 shabegom

Hi Thanks a lot for the answer I took another approach in that case

Copy the fixed icalbudy binary in a folder and create my custom action

It works fine like that for me

Thanks a lot !!

Regards Patrick

Le 22 mars 2022 à 13:31, Sam @.***> a écrit :

@dgurkaynak https://github.com/dgurkaynak that seems weird that the container app needs permission and not the iCalBuddy script itself. I know with some of those screens you can drag/drop apps on the list to add them.

@pillouz01 https://github.com/pillouz01 ah homebrew. Ok.

So a couple of common things that break shell scripts:

Specify the full path to the shell you want to use in the templater settings (zsh, bash, etc) The most common problem is that the script needs access to your $PATH which for some reason the child process doesn't read properly (see #512 https://github.com/SilentVoid13/Templater/issues/512). The fix is to explicitly set the $PATH before running the command (something like PATH=$PATH:/usr/local/bin). If that doesn't work, maybe it is really just a permissions issue and you need to chmod the directory throwing the error? Seems odd that your user wouldn't have permissions tho.

— Reply to this email directly, view it on GitHub https://github.com/SilentVoid13/Templater/issues/597#issuecomment-1075118836, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVTJSZRIE5AYALUXQOEROXTVBG4SLANCNFSM5RIC6DHA. You are receiving this because you were mentioned.

pillouz01 avatar Mar 22 '22 13:03 pillouz01