Hello all. I’ve tried implementing a custom function using the Templater plugin that will execute a curl command and pull some weather forecast text for inclusion. The command works perfectly in Terminal, but in Obsidian it can’t find one of the programs the command calls. Here’s the command:
curl -s https://api.weather.gov/gridpoints/PSR/172,49/forecast | fx .properties.periods.detailedForecast
Running in Terminal gives this output…
Sunny, with a high near 107. West wind 5 to 10 mph.
But when the template runs in Obsidian, I get this error in the console:
main.ts:213 Error with User Template NWSdayforecastAZA Error: Command failed: curl -s https://api.weather.gov/gridpoints/PSR/172,49/forecast | fx .properties.periods.detailedForecast /bin/sh: fx: command not found (23) Failed writing body at ChildProcess.exithandler (child_process.js:312) at ChildProcess.emit (events.js:315) at maybeClose (internal/child_process.js:1021) at Socket.<anonymous> (internal/child_process.js:443) at Socket.emit (events.js:315) at Pipe.<anonymous> (net.js:674)
It seems like it’s failing to find
fx, which I installed using Homebrew to parse the JSON file from the retrieved URL. Maybe Obsidian can’t just run it like Terminal for some reason? Not being an expert in such things, I can’t imagine why a command from Obsidian wouldn’t just run like a command entered straight into Terminal. Are Homebrew-installed packages treated differently somehow?
Just trying to get that command to execute properly/without error.