← Back to team overview

sikuli-driver team mailing list archive

[Question #211412]: Couple of questions regarding how-to

 

New question #211412 on Sikuli:
https://answers.launchpad.net/sikuli/+question/211412

I made a suite which now can test an app in English and for any other locale. But, as of now I change the locale manually and run the suite. I want to write a .sh file to change the Mac OS language each time my suite runs based on the language I pass as command line arguments. Please see my below questions..

1. How to change the Mac OS language (either using AppleScript/Shell Script) - For MAC. Once it is done for a FR for instance, I can then call my suite passing fr-fr as a argument to run the whole suite for FR. Again the same script to change to other locale and again calling the suite for that locale. I want to put all these in a script file (like batch file in windows) so that clicking on that sh file, all locales will be tested with out manual intervention. Please advice how to achieve this ?

2. The other challenge I am facing is, my Main Script uses middle layer framework file (main script importing the framework file). My framework file importing the locale images. Now, if I pass locale as a command line to main script, how can I say to my framework file to use that locale. 
Example: 
#Framework file is like this (myFramework.sikuli)
locale = "En-En"
exec("import "+locale)
exec("reload(%s)"%(locale))
exec("from %s import *"%(locale))

#main file is (main.sikuli)
import myFramework
reload(myFramework)
from myFramework import *

myFramework.locale = sys.argv[1]

If I pass argv[1] as FR, the framework file is initializing to FR but, while execution it is looking for EN images only. I guessing this is because of importing 'myFramework' before assigning locale. 

Suggest me how to achieve this.

3. I am receiving this error in my report file if I run the script without re-starting the IDE. In the fresh instance of sikuli IDE this error is not seen. Why do we get this error? 

ft1.1: Traceback (most recent call last):
  File "/Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar/Lib/logging/__init__.py", line 750, in emit
  File "/Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar/Lib/logging/__init__.py", line 750, in emit
ValueError: I/O operation on closed file
Traceback (most recent call last):
  File "/Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar/Lib/logging/__init__.py", line 750, in emit
  File "/Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar/Lib/logging/__init__.py", line 750, in emit
ValueError: I/O operation on closed file

Thanks in advance. 
Neo.

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