sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #18850
Re: [Question #231065]: Pasting special text with special characters endcoding from CSV file
Question #231065 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/231065
Status: Answered => Solved
Philippe Trounev confirmed that the question is solved:
Thank you RaiMan this works!
Also if someone has to paste a large number of unicode text items from
the CSV in the script and wants a reusable function for this.
class UnicodeCsvReader(object):
def __init__(self, f, encoding="utf-8", **kwargs):
self.csv_reader = csv.reader(f, **kwargs)
self.encoding = encoding
def __iter__(self):
return self
def next(self):
# read and split the csv row into fields
row = self.csv_reader.next()
# now decode
return [unicode(cell, self.encoding) for cell in row]
@property
def line_num(self):
return self.csv_reader.line_num
To initilize use:
with codecs.open(inputFileName, 'rb') as file:
myreader = UnicodeCsvReader(file)
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.