0

looks like the best option to vnc from Python is vncdotool module. I've been using it with Python2 without any problem. Now I am moving toward to Python3. It seems not working at all on my Mac. Here is the problem.

after creating venv and install pip3 install vncdotool. I get immediate error when running the vncdo command. It says "print data". looks like it is running Python2 code "print 'xxx' vs print('xxx')"

(vnc) mac:vnc user$ vncdo
Traceback (most recent call last):
  File "/Users/user/Documents/code/vnc/bin/vncdo", line 11, in <module>
    load_entry_point('vncdotool==0.10.0', 'console_scripts', 'vncdo')()
  File "/Users/user/Documents/code/vnc/lib/python3.6/site-packages/pkg_resources/__init__.py", line 565, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/Users/user/Documents/code/vnc/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "/Users/user/Documents/code/vnc/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2291, in load
    return self.resolve()
  File "/Users/user/Documents/code/vnc/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/Users/user/Documents/code/vnc/lib/python3.6/site-packages/vncdotool/command.py", line 79
    print data
             ^
SyntaxError: Missing parentheses in call to 'print'
(vnc) Mac:vnc user$

when I run python3 in interactive mode, and trying to import the api module. I got another error saying Queue is not available.

(vnc) Mac:vnc user$ python
Python 3.6.1 (default, Apr  4 2017, 09:40:21)
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from vncdotool import api
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/user/Documents/code/rdpvnc/lib/python3.6/site-        packages/vncdotool/api.py", line 8, in <module>
    import Queue
ModuleNotFoundError: No module named 'Queue'
>>>

I checked the github page seeing that there is indeed python3 support. however, there is not much info anywhere on internet.

setup.py    added python 3  8 months ago
  • Possible duplicate of [Python 2 and Python 3 dual development](https://stackoverflow.com/questions/11372190/python-2-and-python-3-dual-development) – ivan_pozdeev Jun 09 '17 at 14:31
  • Ivan - Python2 is from the stand macos package. I install Python3 with homebrew on my mac. Do you mean Python2 and Python3 can't be coexist? –  Jun 09 '17 at 14:33
  • The suggested duplicate has hints how to fix that module so it runs in both py2 and py3. – ivan_pozdeev Jun 09 '17 at 14:35
  • Hi Ivan, not sure if Im getting the idea correctly. I am not looking for making my code to run on both py2 and py3 env. I want to use the vncdotool module in Py3. the error I got looks like the module doesn't run on py3 env. but the official web saying the vncdotool does support py3. i'm trying to get a Windows machine to test if it is mac specific but it's been taking very long time to install the VC++ buildtools which is required when installing twisted module for vncdotool. –  Jun 09 '17 at 14:43

1 Answers1

0

The module, as you have it, doesn't support Python 3 - the code in your stacktrace is clearly py2-only. The fact that the developer added "Python 3" to setup.py's metadata doesn't mean that the support is complete - especially considering the fact that the last release (as of this writing) was earlier - in Mar 2016.

You can install the git HEAD version of the module and see if the support works in it. At least, the print statements in command.py that your program chokes on have been fixed.

pip install git+https://github.com/sibson/vncdotool.git

The suggested duplicate, Python 2 and Python 3 dual development, suggests how to fix the code so that it runs in both Python 2 and 3. If the support is incomplete, you can offer the rest of the fixes to the maintainer as a pull request.

ivan_pozdeev
  • 33,874
  • 19
  • 107
  • 152
  • thanks a lot Ivan. it works now by installing the git directly as you suggested. –  Jun 09 '17 at 15:47