Sunday, December 4, 2022

#1 2022-11-02 10:54:48 pm

Neophyte
Member
From:: Canberra, ACT, Australia
Registered: 2017-08-20
Posts: 89
Website

"Error reading stdin. Couldn't communicate with a help application"

My applet has code with uses curl to download a web page, convert the result into text then parses its content. The code has worked for years. The particular code at issue looks like this:

set YTDL_site_URL to "[url]https://github.com/yt-dlp/yt-dlp/releases[/url]"
set YTDL_releases_page to do shell script "curl " & YTDL_site_URL & " | textutil -stdin -stdout -format html -convert txt -encoding UTF-8

But, one of my users get nothing back. When testing the curl and the conversion in Terminal the user gets this:

~ % curl "[url]https://github.com/yt-dlp/yt-dlp/releases[/url]" | textutil -stdin -stdout -format html -convert txt -encoding UTF-8
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  365k    0  365k    0     0  2321k      0 --:--:-- --:--:-- --:--:-- 2419k
Error reading stdin.  Couldn't communicate with a helper application.

I have tested some ideas such as turning off various permissions but nothing I do on my Mac replicates the error.

I'm at a loss.  It seems that the "curl" is working for my user (the correct amount of data is downloaded) but something is preventing stdin feeding into "textutil". But, maybe the error is related to something else entirely.

Both the user and I are on macOS 13.0.

Any help much appreciated.

Garry


Public servants are people too
Mac Studio M1 Max 24c, 32GB, 1TB; Studio Display; macOS Monterey, 12.3.1

Offline

 

#2 2022-11-03 07:53:56 am

robertfern
Member
Registered: 2011-11-29
Posts: 225

Re: "Error reading stdin. Couldn't communicate with a help application"

Why do you have the '\[url\]' and '\[/url\]' in your string. (had a tough time to get the square brackets to show)

I've never used that in any of my curl commands

try

Applescript:

set YTDL_site_URL to "https://github.com/yt-dlp/yt-dlp/releases"
set YTDL_releases_page to do shell script "curl " & YTDL_site_URL & " | textutil -stdin -stdout -format html -convert txt -encoding UTF-8"

Also more code from your script where the problem arises would be useful

Last edited by robertfern (2022-11-03 07:57:44 am)

Offline

 

#3 2022-11-04 12:12:51 am

Neophyte
Member
From:: Canberra, ACT, Australia
Registered: 2017-08-20
Posts: 89
Website

Re: "Error reading stdin. Couldn't communicate with a help application"

robertfern wrote:

Why do you have the '\[url\]' and '\[/url\]' in your string. (had a tough time to get the square brackets to show)

I don't. They are put there by MacScripter when using the "Format" or "Quote" functions. I spent some time trying to stop that. Perhaps I should have used the "Applescript" function but, it was such a small amount of code.

robertfern wrote:

Also more code from your script where the problem arises would be useful

Difficult to know how much to show - I have over 5,000 lines in 5 script files. I know it's close to being silly so I'm working on redeveloping in SwiftUI.

Anyway, the important point is that my user could not run the simple Terminal command. They got the "Error reading stdin" response. This morning they let me know that they are running macOS Ventura on 2013 MBP with the opencore legacy patcher. I said they should ask the OCLP experts for help. I've also got them to remove and re-add Full Disk Access permissions, in case the bug is relevant. Didn't solve the problem. Poor user has reinstalled Ventura without luck and is working on installing Catalina on an external drive. In the meantime, I'm working up a workaround in my code.

Thanks.


Public servants are people too
Mac Studio M1 Max 24c, 32GB, 1TB; Studio Display; macOS Monterey, 12.3.1

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)