if type(variable) is unicode:

Posted on
Thu Jun 09, 2022 12:23 pm
Ramias offline
Posts: 272
Joined: Nov 24, 2015

if type(variable) is unicode:

Looking at the code for the existing Nest plugin. Anybody know the best way to make this line work with Python 3?

Code: Select all
if type(nestCurrentValue) is unicode:

Posted on
Thu Jun 09, 2022 12:26 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: if type(variable) is unicode:

There’s a new Nest plugin about to be released; you’re probably best waiting for that.

viewtopic.php?f=369&t=26172


Sent from my iPhone using Tapatalk Pro

Posted on
Thu Jun 09, 2022 12:35 pm
Ramias offline
Posts: 272
Joined: Nov 24, 2015

Re: if type(variable) is unicode:

Yeah I'll probably end up buying a Starling...

in the meantime I think this fixed my unicode issue:

if isinstance(nestCurrentValue, type(u"")):

Posted on
Thu Jun 09, 2022 2:49 pm
jay (support) offline
Site Admin
User avatar
Posts: 18220
Joined: Mar 19, 2008
Location: Austin, Texas

Re: if type(variable) is unicode:

In python 3, all strings are unicode, so
Code: Select all
isinstance(nextCurrentValue, str)
should work.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest

cron