Page 1 of 1
Intermittent Twitter error - "closing paren expected"
Posted: Mon Oct 03, 2016 4:49 am
by sjmeff
Hi - I've used the same Twitter script for a while but it recently started intermittently failing (perhaps with the recent upgrade of Meteobridge?).
I'm on Meteobridge 3.1
The script is:
Code: Select all
#SandySpring #MD #MoCo [th0temp-act=F.1:--]°F (feels like [th0heatindex-act=F.1:--]°F) · Humidity: [th0hum-act=.0]٪ · Rain: #if#{*[rain0total-daysum]=0.0*}#then#0 in#else#[rain0total-daysum=in.2:---]in#fi# · Wind: [wind0dir-act=endir:---] [wind0wind-act=mph.1:--] to [wind0wind-max10=mph.1:--] mph
It runs fine for a while and then occasionally will throw this error:
"Error: sh: closing paren expected sh: closing paren expected can not post tweet (duplicate) (no more tries)"
Any ideas?
Re: Intermittent Twitter error - "closing paren expected"
Posted: Mon Oct 03, 2016 11:30 pm
by admin
I guess it cannot handle the degree symbols.
Re: Intermittent Twitter error - "closing paren expected"
Posted: Tue Oct 04, 2016 9:10 am
by weeramateur
admin wrote:I guess it cannot handle the degree symbols.
that's possible
Re: Intermittent Twitter error - "closing paren expected"
Posted: Tue Oct 04, 2016 4:29 pm
by sjmeff
Thanks for the replies.
I tested removing various characters -- ° · ٪ -- but still saw the error. Finally I tried removing the parenthesis around the "feels like" part and I haven't seen the error again. It's always been an intermittent issue, but this has been running for ~12 hrs so far, so I will just use the updated script.
Code: Select all
#SandySpring #MD #MoCo [th0temp-act=F.1:--]°F · Feels like [th0heatindex-act=F.1:--]°F · Humidity: [th0hum-act=.0]٪ · Rain: #if#{*[rain0total-daysum]=0.0*}#then#0 in#else#[rain0total-daysum=in.2:---]in#fi# · Wind: #if#{*[wind0wind-max10]>0.0*}#then#[wind0dir-act=endir:---] [wind0wind-act=mph.1:--] to [wind0wind-max10=mph.1:--] mph#else#0 mph#fi#
Thanks again!
Re: Intermittent Twitter error - "closing paren expected"
Posted: Thu Oct 06, 2016 2:38 pm
by admin
I see in your template that you don't have defined default values for all variables (th0hum-act, rain0total-daysum in if clause).
This might also cause trouble with the square brackets when no sensor data for this sensor available.
Re: Intermittent Twitter error - "closing paren expected"
Posted: Mon Oct 10, 2016 3:43 pm
by sjmeff
admin wrote:I see in your template that you don't have defined default values for all variables (th0hum-act, rain0total-daysum in if clause).
This might also cause trouble with the square brackets when no sensor data for this sensor available.
How do I set defaults? I didn't see that in the docs. Thanks!
Re: Intermittent Twitter error - "closing paren expected"
Posted: Mon Oct 17, 2016 1:05 am
by admin
It is done with the colon ":", please see section about templates in the wiki.
Re: Intermittent Twitter error - "closing paren expected"
Posted: Tue Oct 18, 2016 4:42 am
by WA4OPQ
I'm having the same problem, but with a very simple template:
Today's high temperature for Hickman County (8.5 miles NE of Centerville) was [th0temp-dmax=F.1:--] ºF. The low temperature was [th0temp-dmin=F.1:--] ºF
I can make it work by replacing the parentheses with commas. But I would like to be able to use parentheses in tweets.