How to connect to vnc using jython?

Asked by Dmitrii on 2018-05-11

How to connect to vnc using jython?

My simple script:

import unittest
import org.sikuli.script.SikulixForJython
from sikuli import *

class Test_Thing1(unittest.TestCase):

   def setUp(self):
    vnc = vncStart("",5900)
    Test = vnc.capture();"test.png");

if __name__ == '__main__':

   suite = unittest.TestLoader().loadTestsFromTestCase(Test_Thing1) #give the class name
   runner = unittest.TextTestRunner()
   failures =
   sys.exit(not failures.wasSuccessful())

Return error:

Traceback (most recent call last):
  File "", line 16, in setUp
    Test = vnc.capture();
AttributeError: 'NoneType' object has no attribute 'capture'

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
RaiMan (raimund-hocke) said : #1

vnc = vncStart("",5900)

you have to check wether vnc is not None before proceeding.

The internal error checking is not that gorgeous ;-) so if the connection fails you will get back None.

So be sure a connection is possible.

vnc = vncStart("") # sufficient - 5900 is the default
if not vnc:
    # do something that makes sense ;-)

Can you help with this problem?

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

To post a message you must log in.