5

我已成功安装“python-3.3.0.msi”并将 PATH 设置为“C:\Python33;” 在 Windows 7 上。之后,我尝试使用“robotframework-2.7.7.win32.exe”安装 Robot Framework(双击 .exe 文件)。在安装的最后一步,我发现了以下错误:

File "<string>", line 35
    except Exception, err:
                    ^
SyntaxError: invalid syntax

我点击了“完成”按钮——>安装向导消失了。我将 PATH 设置为“C:\Python33\Scripts”。然后我在命令提示符下使用命令“pybot --version”检查了版本。显示以下错误:

Traceback (most recent call last):
  File "C:\Python33\lib\runpy.py", line 140, in _run_module_as_main
    mod_name, loader, code, fname = _get_module_details(mod_name)
  File "C:\Python33\lib\runpy.py", line 102, in _get_module_details
    loader = get_loader(mod_name)
  File "C:\Python33\lib\pkgutil.py", line 482, in get_loader
    return find_loader(fullname)
  File "C:\Python33\lib\pkgutil.py", line 499, in find_loader
    pkg = importlib.import_module(pkg_name)
  File "C:\Python33\lib\importlib\__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1577, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1525, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 1023, in load_module
  File "<frozen importlib._bootstrap>", line 1004, in load_module
  File "<frozen importlib._bootstrap>", line 562, in module_for_loader_wrapper
  File "<frozen importlib._bootstrap>", line 869, in _load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "C:\Python33\lib\site-packages\robot\__init__.py", line 22, in <module>
    from robot.rebot import rebot, rebot_cli
  File "C:\Python33\lib\site-packages\robot\rebot.py", line 268, in <module>
    from robot.conf import RebotSettings
  File "C:\Python33\lib\site-packages\robot\conf\__init__.py", line 17, in <mo
    from .settings import RobotSettings, RebotSettings
  File "C:\Python33\lib\site-packages\robot\conf\settings.py", line 172
    except EnvironmentError, err:
                           ^
SyntaxError: invalid syntax

如何解决上述错误?

4

2 回答 2

4

Robot Framework 还不支持 Python 3。您应该尝试改用 Python 2.7。(Python 3 更改了语言语法中的许多内容,包括此回溯中显示的用于捕获异常的语法)。因此,请按照以下安装步骤操作:

  1. 安装Python2.7.3
  2. 安装robotframework2.7.7
  3. 将 PATH 设置为“C:\Python27\;C:\Python27\Scripts\”
  4. 在命令提示符下使用命令“pybot --version”验证安装。如果一切正常,
    将显示以下消息:“Robot Framework 2.7.7 (Python 2.7.3 on win32)”
于 2013-03-28T08:52:04.313 回答
2

你应该运行“pip install robotframework-python3” https://pypi.python.org/pypi/robotframework-python3

于 2014-11-18T02:42:52.720 回答