当我第一次尝试使用 Parley 1.0.0(我使用 Mint 17 32 位中的软件管理器安装)时,我通过内置机制下载了许多词汇文件,当我尝试第一个时,它告诉我所有五个常用脚本附加组件都失败了,标题中都有消息。它还说,对于我尝试从 Parley 的菜单项脚本 -> 脚本管理器重新启用的任何一个,都会出现这种情况。
如果我打开一个终端:
$ python --version
Python 2.7.6
所以...我不确定这是什么意思或者如何修复它。(文件的解释器.py
不是 Python 吗?为什么在常规安装中找不到它?)
给出的完整错误是:
文件 /usr/share/kde4/apps/parley/plugins/example.py 第 -1 行出现错误:无法确定脚本文件“/usr/share/kde4/apps/parley/plugins/example.py”的解释器
如果我从终端运行 Parley,它会提供更多信息,但最后一行是它在实际发生错误时吐出的全部内容,并且它不会提供比弹出窗口更多的内容:
$ parley
Could not add child element to parent element because the types are incorrect.
parley(10341)/kdeui (kdelibs): Attempt to use QAction "show_lesson_dock" with KXMLGUIFactory!
parley(10341)/kdeui (kdelibs): Attempt to use QAction "show_wordtype_dock" with KXMLGUIFactory!
parley(10341)/kdeui (kdelibs): Attempt to use QAction "show_inflection_dock" with KXMLGUIFactory!
parley(10341)/kdeui (kdelibs): Attempt to use QAction "show_comparison_dock" with KXMLGUIFactory!
parley(10341)/kdeui (kdelibs): Attempt to use QAction "show_multiplechoice_dock" with KXMLGUIFactory!
parley(10341)/kdeui (kdelibs): Attempt to use QAction "show_synonym_dock" with KXMLGUIFactory!
parley(10341)/kdeui (kdelibs): Attempt to use QAction "show_antonym_dock" with KXMLGUIFactory!
parley(10341)/kdeui (kdelibs): Attempt to use QAction "show_falsefriend_dock" with KXMLGUIFactory!
parley(10341)/kdeui (kdelibs): Attempt to use QAction "show_pronunciation_dock" with KXMLGUIFactory!
parley(10341)/kdeui (kdelibs): Attempt to use QAction "show_image_dock" with KXMLGUIFactory!
parley(10341)/kdeui (kdelibs): Attempt to use QAction "show_summary_dock" with KXMLGUIFactory!
parley(10341)/kdeui (kdelibs): Attempt to use QAction "show_audio_dock" with KXMLGUIFactory!
parley(10341)/kdeui (kdelibs): Attempt to use QAction "show_browser_dock" with KXMLGUIFactory!
parley(10341)/kdeui (kdelibs): Attempt to use QAction "show_latex_dock" with KXMLGUIFactory!
parley(10341)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "google_images"
parley(10341)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "parley_example_script"
parley(10341)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "google_dict"
parley(10341)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "wiktionary_sound"
parley(10341)/kdecore (KPluginInfo) KPluginInfo::kcmServices: found 0 offers for "leo_dict"
(parley:10341): Gtk-CRITICAL **: IA__gtk_widget_get_direction: assertion 'GTK_IS_WIDGET (widget)' failed
(parley:10341): Gtk-CRITICAL **: IA__gtk_widget_get_direction: assertion 'GTK_IS_WIDGET (widget)' failed
Kross: "Error error=Failed to determine interpreter for scriptfile "/usr/share/kde4/apps/parley/plugins/example.py" lineno=-1 trace=
"
第一行立即打印出来。当我单击“编辑器”时(加载下载的词汇文件后),打印了以下 kdelibs 行。当我单击“脚本”->“脚本管理器”时,打印了接下来的五行。当我单击“示例 Parley 脚本”旁边的复选框以将其切换为开启状态时,打印了 CRITICAL 行。当我单击“确定”时,打印了最后一行(并弹出错误)。
答案1
Bash 不会根据文件扩展名来设置解释器。它使用文件的第一行,通常称为“shebang”或“crunchbang”。这允许直接运行可执行的 Python 脚本。
一些例子:
#!/bin/bash
#!/usr/bin/python2
#!/usr/bin/env python
#!/usr/bin/env ruby
您应该检查这些“库存脚本”,看看它们是否有 shebang 行。如果没有,请将其作为错误报告给上游项目。我不熟悉 parley,但您还应该检查它们是否有默认解释器的选项。