【问题标题】:AssertionError: Importing test library 'Dialogs' failed: ImportError: No module named _tkinterAssertionError:导入测试库“对话框”失败:ImportError:没有名为 _tkinter 的模块
【发布时间】:2014-12-12 02:24:24
【问题描述】:

我尝试使用在documentation 中找到的以下内容在我的 Plone 附加包上调试 Robot Framework 测试:

*** Settings ***

Resource  plone/app/robotframework/keywords.robot

*** Test Cases ***

Pause tests with included Pause-keyword
   Pause

运行测试时显示以下错误:

Failure in test Test Locking Behavior (test_locking_behavior.robot)
Traceback (most recent call last):
  File "/home/hvelarde/.buildout/eggs/unittest2-0.5.1-py2.7.egg/unittest2/case.py", line 340, in run
    testMethod()
  File "/home/hvelarde/.buildout/eggs/robotsuite-1.6.1-py2.7.egg/robotsuite/__init__.py", line 455, in runTest
    assert last_status == 'PASS', last_message
AssertionError: Importing test library 'Dialogs' failed: ImportError: No module named _tkinter
Traceback (most recent call last):
  File "/home/hvelarde/.buildout/eggs/robotframework-2.8.4-py2.7.egg/robot/libraries/Dialogs.py", line 38, in <module>
    from dialogs_py import MessageDialog, PassFailDialog, InputDialog, SelectionDialog
  File "/home/hvelarde/.buildout/eggs/robotframework-2.8.4-py2.7.egg/robot/libraries/dialogs_py.py", line 17, in <module>
    from Tkinter import (Tk, Toplevel, Frame, Listbox, Label, Button, Entry,
  File "/home/hvelarde/buildout.python/parts/opt/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
PYTHONPATH:
  /home/hvelarde/.buildout/eggs/robotframework-2.8.4-py2.7.egg/robot/libraries
  /home/hvelarde/.buildout/eggs/robotframework-2.8.4-py2.7.egg
  /home/hvelarde/.buildout/eggs/Plone-4.3.4-py2.7.egg
  /home/hvelarde/.buildout/eggs/Products.ATContentTypes-2.1.14-py2.7.egg/Products/ATContentTypes/thirdparty
  /home/hvelarde/.buildout/eggs/plone.app.upgrade-1.3.7-py2.7.egg
  /home/hvelarde/collective/nitf/src
    [ Message content over the limit has been removed. ]
  /home/hvelarde/collective/nitf/bin
  /home/hvelarde/buildout.python/python-2.7/lib/python27.zip
  /home/hvelarde/buildout.python/python-2.7/lib/python2.7
  /home/hvelarde/buildout.python/python-2.7/lib/python2.7/plat-linux2
  /home/hvelarde/buildout.python/python-2.7/lib/python2.7/lib-tk
  /home/hvelarde/buildout.python/python-2.7/lib/python2.7/lib-old
  /home/hvelarde/buildout.python/python-2.7/lib/python2.7/lib-dynload
  /home/hvelarde/buildout.python/parts/opt/lib/python2.7
  /home/hvelarde/buildout.python/parts/opt/lib/python2.7/plat-linux2
  /home/hvelarde/buildout.python/parts/opt/lib/python2.7/lib-tk
  /home/hvelarde/buildout.python/python-2.7/lib/python2.7/site-packages
  /home/hvelarde/buildout.python/parts/opt/lib/python2.7/site-packages/setuptools-2.2-py2.7.egg
  /home/hvelarde/buildout.python/parts/opt/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg
  /home/hvelarde/buildout.python/parts/opt/lib/python2.7/site-packages/Pillow-2.6.0-py2.7-linux-x86_64.egg
  /home/hvelarde/buildout.python/parts/opt/lib/python2.7/site-packages
  .
  /home/hvelarde/collective/nitf/parts/test

我的系统中已经安装了 Tkinter:

# sudo apt-get install python-tk
Lendo listas de pacotes... Pronto
Construindo árvore de dependências       
Lendo informação de estado... Pronto
python-tk já é a versão mais nova.
python-tk configurado para instalar manualmente.
Os seguintes pacotes foram automaticamente instalados e não são mais necessários:
  linux-headers-3.13.0-39 linux-headers-3.13.0-39-generic
  linux-image-3.13.0-39-generic linux-image-extra-3.13.0-39-generic
Use 'apt-get autoremove' to remove them.
0 pacotes atualizados, 0 pacotes novos instalados, 0 a serem removidos e 13 não atualizados.

我该如何解决这个问题?

【问题讨论】:

    标签: python-2.7 tkinter plone robotframework


    【解决方案1】:

    我必须安装 tk-dev 包(在我的情况下使用 sudo apt-get install tk-dev)并重新编译我在 virtualenv 上使用的 Python。

    我在这里找到了答案:https://stackoverflow.com/a/5459492/644075

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-11-27
      • 2017-05-10
      • 1970-01-01
      • 2019-01-11
      • 1970-01-01
      • 1970-01-01
      • 2012-02-02
      相关资源
      最近更新 更多