python3 是否支持 vncdotool?
vncdotool support on python3?
看起来 Python 中 vnc 的最佳选择是 vncdotool 模块。我一直在 Python2 上使用它,没有任何问题。现在我正朝着 Python3 迈进。它似乎在我的 Mac 上根本不起作用。问题来了。
创建 venv 并安装 pip3 后安装 vncdotool。当 运行 执行 vncdo 命令时,我立即收到错误消息。它说 "print data"。看起来是 运行ning Python2 码 "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$
当我 运行 python3 处于交互模式时,并尝试导入 api 模块。我收到另一个错误,提示队列不可用。
(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'
>>>
我检查了 github page 看到确实有 python3 支持。然而,互联网上的任何地方都没有太多信息。
setup.py added python 3 8 months ago
您拥有的模块不支持 Python 3 - 您的堆栈跟踪中的代码显然是 py2-only。开发人员将 "Python 3" 添加到 setup.py
的元数据这一事实并不意味着支持是完整的 - 特别是考虑到最后一个版本(截至撰写本文时)更早 - in Mar 2016.
您可以安装模块的 git
HEAD
版本,看看支持是否适用。至少,command.py
中导致程序阻塞的 print
语句已得到修复。
pip install git+https://github.com/sibson/vncdotool.git
建议的副本 Python 2 and Python 3 dual development 建议如何修复代码以使其在 Python 2 和 3 中运行。如果支持不完整,您可以提供其余修复作为拉取请求发送给维护者。
看起来 Python 中 vnc 的最佳选择是 vncdotool 模块。我一直在 Python2 上使用它,没有任何问题。现在我正朝着 Python3 迈进。它似乎在我的 Mac 上根本不起作用。问题来了。
创建 venv 并安装 pip3 后安装 vncdotool。当 运行 执行 vncdo 命令时,我立即收到错误消息。它说 "print data"。看起来是 运行ning Python2 码 "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$
当我 运行 python3 处于交互模式时,并尝试导入 api 模块。我收到另一个错误,提示队列不可用。
(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'
>>>
我检查了 github page 看到确实有 python3 支持。然而,互联网上的任何地方都没有太多信息。
setup.py added python 3 8 months ago
您拥有的模块不支持 Python 3 - 您的堆栈跟踪中的代码显然是 py2-only。开发人员将 "Python 3" 添加到 setup.py
的元数据这一事实并不意味着支持是完整的 - 特别是考虑到最后一个版本(截至撰写本文时)更早 - in Mar 2016.
您可以安装模块的 git
HEAD
版本,看看支持是否适用。至少,command.py
中导致程序阻塞的 print
语句已得到修复。
pip install git+https://github.com/sibson/vncdotool.git
建议的副本 Python 2 and Python 3 dual development 建议如何修复代码以使其在 Python 2 和 3 中运行。如果支持不完整,您可以提供其余修复作为拉取请求发送给维护者。