Set DISPLAY at runtime

Asked by Denis K

Hi

Sikuli works fine if I export DISPLAY=:1 before run jython script

export DISPLAY'=:1
jython myscript.py

but ignores if I set it at runtime using

os.putenv('DISPLAY', ':1')
# or os.environ['DISPLAY'] = ':1'
import sikuli

Any solutions?

Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

as far as I understand:
- DISPLAY is a system environment variable on ..nix systems
- it is only interpreted, when an application starts

... so changing it in an app after startup (if possible at all), should not have any consequences

Jython os.environ/os.putenv
- there are some system specific behaviours and non-behaviors mentioned in the docs
- but as far as I understand: in no case it changes the system environment (only the internal copy for the Jython session, same restriction as with Java)
- changes in environment are visible to subprocesses

I tested on Mac OSX 10.9 with Jython 2.7 (which is included in Sikuli 1.1.0):
changes using os.putenv are available later when using os.environ in the same session

BTW: what is your intention? selecting the screen, that Sikuli should use at runtime?

what version of Sikuli?

Revision history for this message
Denis K (dnsk) said :
#2

My jython scenario
- run vnc server and get opened display value
- run sikuli using opened display

Sikuli version 1.0.1

Revision history for this message
RaiMan (raimund-hocke) said :
#3

Sikuli up to version 1.0.1 only works on the physical screen of the machine it is running on.
Out of the box it cannot work against a vnc-server.

With version 1.1.0 there will be a VNC-client available and a lightweight remote solution.

Can you help with this problem?

Provide an answer of your own, or ask Denis K for more information if necessary.

To post a message you must log in.