← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #187508]: UnicodeEncodeError when writing data into text file

 

Question #187508 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/187508

Atul Desai posted a new comment:
Hi RaiMan,

I would like to raise my question in same thread, as I was facing same
issue where I need to copy the text and compare. Now as I have overcome
the issue one another issue I am facing is while importing same script
in another scripts. Below is my script. Can you please help me to
resolve the issues as it raise "WHILE IMPORTING!! Non-ASCII character in
file ' D: test.sikuli\test.py', but no encoding declared; see
http://www.python.org/peps/pep-0263.html for details"

Script1: Test

from sikuli import*
import codecs

compareValue = "We built the new Hydra console just for you! We
encourage you take a tour to check out the new look and functionality.
If you’d like to continue using the old Hydra, click “Switch Back.”"


def testnow():
    getTitle = Region(find("1419429990021.png"))
    getTitle.highlight(2)
    getContent = Region(getTitle.x, getTitle.y+50, getTitle.w, getTitle.h)
    hover(getContent)
    for x in xrange(3):
        mouseDown(Button.LEFT)
        mouseUp()
    type("c", KEY_CTRL)
    gettext = Env.getClipboard().encode('utf-8')
    print "Text: ",gettext
    gettextnew = gettext.decode('ascii', 'ignore')
    if gettext == compareValue:
        print "Pass"
    else:
        print "Fail"
    
    

testnow()

Script2: Test1

from sikuli import*
import codecs

import test
reload(test)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.