The following mwe has been discussed in this post, and this one. The mwe no longer works after a system update. Any guidance on troubleshooting is greatly appreciated.
W10, MikTeX 2.9, TeXWorks, installed Perl 5.30, installed grep, confirm that both are installed, added paths of external scripts to PATH through PC or TeXWorks, (both seem like they do the same thing)
The limited debug messages I see in the console are:
("C:\Users\Chris\AppData\Local\Programs\MiKTeX 2.9\tex/context/base/mkii\supp-p
df.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
)
\sectioncount=
Here is the mwe:
\documentclass{article}%
%\usepackage{titlesec} %**** uncomment to see error message
% Compile with --enable-write18 or --shell-escape options
\immediate\write18{texcount -char -merge -tex -sum \jobname.tex | grep -i section > \jobname Count.txt} % counts characters
%\immediate\write18{texcount -merge -tex -sum \jobname.tex | grep -i section > \jobname Count.txt} % counts words
\newcommand{\limitcount}{-1}
\usepackage{xstring}
\usepackage{ifthen}
\usepackage{xcolor}
\usepackage{nameref}
\newcommand{\processCount}{%
\newread\counts
\def\zpar{\par}
\openin\counts=\jobname Count.txt
\loop
\read\counts to \sectioncount
\ifx\sectioncount\zpar\else
\showcount{\sectioncount}\
\fi
\ifeof\counts
\else
\repeat
}
\newcommand*{\showcount}[1]{%
% e.g. 67+18+0 (1/0/0/0) S[ubs]ection: The first subsection
\StrBehind{#1}{ection: }[\sectiontitleplusspace]
\StrGobbleRight{\sectiontitleplusspace}{1}[\sectiontitle]
\StrBefore{#1}{+}[\thiscount]
\expandafter\ifcsname\sectiontitle limit\endcsname%
\renewcommand{\limitcount}{\csname\sectiontitle limit\endcsname}%
\else%
\renewcommand{\limitcount}{-1}%
\fi%
\sectiontitle:
{%
\ifthenelse{\thiscount>\limitcount}{%
\textcolor{red}{\thiscount/\limitcount}%
\ifthenelse{\limitcount>-1}{%
\ (over by \number\numexpr\thiscount-\limitcount\relax)%
}{}%
}{%
\textcolor{green}{\thiscount/\limitcount}%
}%
}
}
\makeatletter
\newcommand*{\contentlimit}[1]{%
\expandafter\newcommand\csname@currentlabelname limit\endcsname{#1}
}
\makeatother
\begin{document}
\section*{Over the Limit}
\contentlimit{5}
This content is over the limt.
\section*{Under the Limit}
\contentlimit{100}
More content, this time under the limit.
%TC:ignore
% display information on document
\section*{Document analysis}
\processCount
%TC:endignore
\end{document}
Update:
I verified that texcount.pl was present.
I verified that texcount.exe was present.
I verified that the Texworks compiler options included references to the paths corresponding to the above.
Still getting sectioncount= as an error.

\limitis defined, do you not see that error? – David Carlisle Jan 02 '21 at 18:19\limit already defined. – John Chris Jan 02 '21 at 19:01\limit already definederror in texlive 2016,2017,2018,2019,2020 – David Carlisle Jan 02 '21 at 19:40