0
218 次浏览

我在 Wasta-Linux 上的 PT9.0 中尝试使用“Outils personnalisation” > “Admin” > “Show Project Plan HTML”时遇到了错误。原来该 Python 脚本试图使用 Windows 注册表来查找 Paratext 项目文件夹。请注意第 3 行,“from _winreg import…”(来自 cms/ProjectPlanImport.py):

def settingsDirectory():
    # Find the directory with Paratext 8 projects using the windows registry
    from _winreg import OpenKey, EnumValue, HKEY_LOCAL_MACHINE

    strPath = r"SOFTWARE\WOW6432Node\Paratext\8"
    try:
        aKey = OpenKey(HKEY_LOCAL_MACHINE, strPath)
        for i in [0,1,2,3,4,5]:
            aName, aValue, irrelevant = EnumValue(aKey,i)
            if aName == 'Settings_Directory':
                return aValue + '\\'
        return None
    
    except WindowsError:
        # The registry key was not found
        return None
    except:
        raise

然而,使用 os.path 模块可以通过相对路径找到同一个文件夹。因此,我将我系统上的该函数更新为以下内容:

def settingsDirectory():
    # Find the directory with Paratext 8 projects using Python 2 tools.
    cms_dir = os.path.dirname(os.path.realpath(__file__))
    if os.path.basename(cms_dir) == 'cms' and os.path.isdir(cms_dir):
        return os.path.dirname(cms_dir)
    else:
        return None

所以我想问的是:在非标准安装中,cms 文件夹是否可能位于 Paratext 项目文件夹之外的其他位置,从而需要在 Windows 中进行注册表检查?或者,如果不是这样,是否有人考虑更新 ProjectPlanImport.py 和 ProjectPlanRoot.py 脚本,使其使用内置工具,以提高脚本的通用兼容性?

如果我能与合适的人讨论此事,我也愿意研究一种方法进行操作系统检查,并以依赖操作系统的方式处理 settingsDirectory 的查找。顺便说一下,这些似乎是 cms 脚本中引用 _winreg 模块仅有的两个地方。

机器翻译自 English
Paratext (298 分) 发布
已编辑 发布 | 218 次浏览

1 个回答

0
在使用我自己的变通方法几个月后,我意识到 1) 上述 "settingsDirectory()" 函数是不必要的,因为 "SettingsDirectory" 实际上是提供给 CMS 脚本的全局变量,并且 2) .cms 文件中的 "\toHtml" 参数本应在默认浏览器中打开生成的 HTML 文件,但在 Linux 安装中这也失败了。因此,我创建了一个 CMS 脚本,它基于 "Show Project Plan HTML" 脚本,添加了 "Show Project Plan HTML (Linux)"。该脚本避免了上述两个问题。

您可以从 https://github.com/sil-car/ProjectPlanHtmlLinux 获取这些文件
机器翻译自 English
(298 分) 发布

相关问题

0
0 个回答 178 次浏览
Wasn't sure where to report this bug fix for the Show Project Plan Html script, found in the project Custom Tools > ... be causing the problem. Probably best to change it as well
jeffh 1.4k 发布 提问于 五月 8, 2020
0
3 个回答 348 次浏览
在近期的一次 Paratext 入门工作坊中,有一位参与者正在 Wasta-Linux 上使用 Paratext 8 由于我不熟悉 Linux 上的 Paratext 8,我很惊讶地发现 键盘切换 功能呈灰色(不可用) 它 ... 于 Linux 上的 Paratext,是否有什么特殊操作需要执行才能使 AutoCorrect.txt 功能正常工作? 谢谢
MSEAIT_LT 478 发布 提问于 十二月 1, 2017
0
1 个回答 378 次浏览
After an Install of Wasta 14 Paratext, the Advanced Checks is greyed out. In my home directory I see ... windows C:\MyParatextProjects\cms What might cause this?
anon432075 149 发布 提问于 九月 8, 2016
0
0 个回答 167 次浏览
I am recovering from a massive computer failure on a team member's computer. I have reinstalled Wasta-Linux 18 and am ... the way it normally does on that profile. Any ideas?
anon349755 120 发布 提问于 十月 2, 2019
0
1 个回答 427 次浏览
我想将项目导出为 HTML,以便与他人分享草稿 我不想导出为 PDF,因为 PDF 在智能手机和其他小屏幕设备上使用起来很不方便 我可以通过打开 Paratext,点击项目菜单按钮,然后选择 高级 (Advanced),再选择 将项目导出为 ... 标记是可见的,例如 \v 1 和 \s 等标记 我该如何在导出的 HTML 中隐藏这些 USFM 标记?
bit 495 发布 提问于 四月 14, 2022
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
And I tell you that you are Peter, and on this rock I will build my church, and the gates of Hades will not overcome it.
Matthew 16:18
3,045 个问题
6,005 个回答
5,671 条评论
2,026 位用户