1

I would like to use RealVNC python api for one of my script.

So, I am trying to install realVNC for Python on my Windows 7 system. As I read the documentation on realvnc developer site many times, The documentation is not really clear enough. Technically, I've done the following steps;

  1. I registered on realvnc website
  2. Next, I downloaded the vncsdk-1.4.0 and extracted on my pc
  3. Next, I copied "vncsdk.py" file to "C:\Python27\Lib\site-packages"
  4. Next, I copied "vncsdk.dll" file to "C:\Windows\System32"
  5. Finally , I created a system variable named "VNCSDK_LIBRARY" and variable value is: "C:\Python27\Lib\site-packages\;C:\Windows\System32\;

But, Unfortunately it does not work for me. When I try to import the module from a python script, it gives me the following error;

>>> import vncsdk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\Lib\site-packages\vncsdk.py", line 144, in <module>
    VNCSDK_LIBRARY = _find_library()
  File "C:\Python27\Lib\site-packages\vncsdk.py", line 134, in _find_library
    raise ImportError("could not find the SDK shared object: VNCSDK_LIBRARY is n
ot a file or directory")
ImportError: could not find the SDK shared object: VNCSDK_LIBRARY is not a file
or directory
>>>

Any helps would be appreciated.

pylearner
  • 537
  • 2
  • 8
  • 26
  • What if you copy `vncsdk.py` to the same source directory? – xuhdev Mar 08 '17 at 10:27
  • Thanks for your comment @xuhdev. I've already tried before. Unfortunately that did not help at all. it gives me the same error. – pylearner Mar 08 '17 at 10:33
  • how did you creat the environmental variable? Did you restart the cmd window afterwards? – xuhdev Mar 08 '17 at 10:41
  • Yes. I tried more than 10 times. I also tried "vncsdk.py" with the same project directory. – pylearner Mar 08 '17 at 10:45
  • import os import vncsdk os.environ['VNCSDK_LIBRARY'] = os.path.join(os.path.dirname(__file__), 'resources') print('SDK library found at: ' + vncsdk.VNCSDK_LIBRARY) – pylearner Mar 08 '17 at 10:45
  • python test.py Traceback (most recent call last): File "test.py", line 2, in import vncsdk File "C:\Users\yke01\Documents\StormTest\Scripts\Completed\Utils\SU04Conversio n\vncsdk.py", line 144, in VNCSDK_LIBRARY = _find_library() File "C:\Users\yke01\Documents\StormTest\Scripts\Completed\Utils\SU04Conversio n\vncsdk.py", line 134, in _find_library raise ImportError("could not find the SDK shared object: VNCSDK_LIBRARY is n ot a file or directory") ImportError: could not find the SDK shared object: VNCSDK_LIBRARY is not a file or directory – pylearner Mar 08 '17 at 10:46

1 Answers1

0

In your script, you should Set VNCSDK_LIBRARY before you import vncsdk.

xuhdev
  • 8,018
  • 2
  • 41
  • 69
  • Thanks once again for your help. C:\Windows\System32;C:\Python27\Lib\site-packages; I just updated system variable. But unfortunately it still gives me the same error as above. – pylearner Mar 09 '17 at 14:17
  • @yakupme Did you do this in your code? Moved the import line after the os.environ line – xuhdev Mar 09 '17 at 21:43
  • Yes, I did. But unfortunately it still gives me the same error. – pylearner Mar 10 '17 at 09:29
  • @yakupme try to set VNCSDK_LIBRARY to the path to the library, not the dir. – xuhdev Mar 10 '17 at 20:17