python3上的vncdotool支持?

时间:2017-06-09 13:52:23

标签: python python-3.x vnc

看起来像vnc的最佳选择是来自vncdotool模块。我一直在使用它与Python2没有任何问题。现在我转向Python3。它似乎在我的Mac上根本不起作用。这是问题所在。

创建venv并安装pip3后安装vncdotool。运行vncdo命令时出现立即错误。它说“打印数据”。看起来它正在运行Python2代码“print'xxx'vs print('xxx')”

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="This is a simple CSS, HTML, and JS Test"/>
<title>WebToMed Website Developer Test</title>
<style>
/* Add all CSS enteries here */
    #div_1 {
    background: red;
    display: table-cell;
    text-align: left;
    width: 300px;
    height: 50px;
    }
    #div_2 {
    background: green;
    display: table-cell;
    text-align: center;
    height: 50px;
    }
    #div_3 {
    background: blue;
    display: table-cell;
    text-align: right;
    width: 350px;
    color: #ffffff;
    font-weight: bold;
    text-decoration: underline;
    height: 50px;
    }
    #div_4 {
    background: yellow;
    display: flex;
    text-align: center;

    height: 300px;
    }
    #div_5 {
    margin-top: auto;
    margin-bottom: auto;
    margin-right: auto;
    margin-left: auto;
    }
    #div_6 {
    border: 3px solid black;
    margin-top: 10px; 
    padding: 20px;         
    }
    .container {
    display: table;
    width: 100%;
    }
    /*color selectors*/
    #Gray1 {
    color:#333333;
    }
    #Gray2 {
    color:#777777;
    }
    #Gray3 {
    color:#CCCCCC;
    }
   </style>
<script>
/* Add any JavaScript here */
</script>
</head>
<body>

当我在交互模式下运行python3,并尝试导入api模块时。我收到另一个错误,说Queue不可用。

(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$

我检查了github page,看到确实有python3支持。但是,互联网上没有太多信息。

(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'
>>>

1 个答案:

答案 0 :(得分:0)

模块,如你所知,不支持Python 3 - 堆栈跟踪中的代码显然只是py2-only。开发人员添加了#3; Python 3&#34;到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中运行。如果支持不完整,您可以将其余修复提供给维护者作为拉动请求。