SQL errors in the log

Forum rules

This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo

Posted on
Sun Jun 10, 2012 8:36 am
hamw offline
Posts: 1212
Joined: Mar 31, 2008

SQL errors in the log

After starting the SQL plugin I've gotten some reproducible errors that show up in the log.

The Pandoras Box AppleScript, and the PandoraBoy AppleScript before it, will put this weird «constant ****sPAU» into the player state variable. I've been able to work around the issue as far as display purposes go, but now it makes SQL throw this error:
Code: Select all
  SQL Logger Error                exception trying to insert row into table variable_history_852852967 ("PandorasBoxPlayerState")
  SQL Logger Error                'ascii' codec can't encode character u'\xab' in position 0: ordinal not in range(128)
  SQL Logger Error                INSERT INTO variable_history_852852967 (value) VALUES (%s);



Also, since changing to the Simple Serial Plugin to control my Vaux matrix audio switch, I now get the Vaux response, which looks like this:
Code: Select all
 Trigger                         audio_8_source Python
  Simple Serial Plugin            Response from serial device (text): , of length 0 characters
  Trigger                         Vaux_Response
  Simple Serial Plugin            Response from serial device (text): !S,1,8,1,1,28,28,4,7
registered in the log file. The Recent Activity Log script plugs the events into variables, and SQL does not like what it sees. In fact, I don't think the Recent Activity Log will insert the response string into the variable. Here's the Recent Activity Log script:
Code: Select all
set the ActivityLog to do shell script "tail -9 \"/Library/Application Support/Perceptive Automation/Indigo 5/Logs/indigo_log.txt\""
set the TotalNumberOfLines to the count of paragraphs in the ActivityLog
set the CurrentLine to 1
repeat while the CurrentLine is less than or equal to the TotalNumberOfLines
    set stringTextOfTheCurrentLine to paragraph CurrentLine of the ActivityLog as string
    set TextOfTheCurrentLine to (characters 12 through -1 of stringTextOfTheCurrentLine as string)
    set the variableName to ("RecentActivity" & CurrentLine) as string
    if not (variable variableName exists) then
        make new variable with properties {name:variableName, value:TextOfTheCurrentLine}
    else
        set the value of the variable variableName to the TextOfTheCurrentLine
    end if
    set the CurrentLine to (the CurrentLine + 1)
end repeat


And the log file showing the Vaux Response and the error at Recent Activity 4 and 6. I think the " script error: Can’t make characters 12 thru -1 of "" into type string. (-1700)" must be from the Recent Activity Log.

Code: Select all
10Jun, 2012 10:24:07 AM
  Trigger                         audio_8_source Python
  Simple Serial Plugin            Response from serial device (text): , of length 0 characters
  Trigger                         Vaux_Response
  Simple Serial Plugin            Response from serial device (text): !S,1,8,1,2,28,28,4,7

, of length 22 characters
  Trigger                         Vaux_Response

10Jun, 2012 10:24:44 AM
  Received INSTEON                "Thermostat Main Bedrooms" humidity changed to 36.0
  Received INSTEON                "Thermostat Main Bedrooms" off (button 1)
  Error                           script error: Can’t make characters 12 thru -1 of "" into type string. (-1700)
  Received INSTEON                "Thermostat Fam Study" humidity changed to 42.0

10Jun, 2012 10:26:00 AM
  Error                           script error: Can’t make characters 12 thru -1 of "" into type string. (-1700)

10Jun, 2012 10:26:23 AM
  Received INSTEON                "Thermostat Fam Room" humidity changed to 38.0

10Jun, 2012 10:26:56 AM
  Received INSTEON                "Thermostat Main Bedrooms" temperature changed to 75.0
  Received INSTEON                "Thermostat GameRm" humidity changed to 42.0
  SQL Logger Error                exception trying to insert row into table variable_history_1862497340 ("RecentActivity4")
  SQL Logger Error                'ascii' codec can't encode character u'\u2019' in position 32: ordinal not in range(128)
  SQL Logger Error                INSERT INTO variable_history_1862497340 (value) VALUES (%s);
  SQL Logger Error                exception trying to insert row into table variable_history_1483307090 ("RecentActivity6")
  SQL Logger Error                'ascii' codec can't encode character u'\u2019' in position 32: ordinal not in range(128)
  SQL Logger Error                INSERT INTO variable_history_1483307090 (value) VALUES (%s);


Recent Activity SQL error.tiff
Recent Activity SQL error.tiff (84.57 KiB) Viewed 1508 times



Not that I know anything about it, but I found a page that discusses the unicode error:

http://stackoverflow.com/questions/3224 ... code-error
Last edited by hamw on Sun Jun 10, 2012 9:02 am, edited 1 time in total.

Posted on
Sun Jun 10, 2012 8:59 am
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

Re: SQL errors in the log

The SQL Logger encoding errors is a known buglet that will be fixed in Indigo 5.1.3.

Image

Posted on
Sun Jun 10, 2012 11:08 am
hamw offline
Posts: 1212
Joined: Mar 31, 2008

Re: SQL errors in the log

Super. Any idea as to why that Vaux string messes up the recent activity log?

Posted on
Sun Jun 10, 2012 6:15 pm
matt (support) offline
Site Admin
User avatar
Posts: 21429
Joined: Jan 27, 2003
Location: Texas

Re: SQL errors in the log

I'm not sure, but the log file is encoded using UTF-8. So I think the AppleScript do shell tail logic will return UTF-8 encoded text, and then perhaps the AppleScript doesn't like that encoding. I'm not sure off the top of my head how to do the encoding correctly in AppleScript (and I don't have good internet connectivity at the moment). But if you google around on UTF-8 and AppleScript you might find the answer. The StackOverflow article is about python UTF encoding, whereas the problem I believe here is AppleScript not liking the UTF-8 encoding.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest