0
219 次瀏覽

我在 Wasta-Linux 上的 PT9.0 中嘗試使用「Outils personnalisation」>「Admin」>「Show Project Plan HTML」時遇到了錯誤。原來該 Python 腳本試圖使用 Windows 登錄(Registry)來尋找 Paratext 專案資料夾。請注意第三行「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 點) 提出
已編輯 提出 | 219 次瀏覽

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 提出 已提問 5月 8, 2020
0
3 個回答 348 次瀏覽
在近期的一場 Paratext 入門工作坊中,有一位參加者正在 Wasta-Linux 上使用 Paratext 8 由於我不熟悉在 Linux 上使用的 Paratext 8,因此驚訝地發現「鍵盤切換」功能呈灰色(無法使用 ... 空格 在 Linux 上,是否需要進行特殊設定才能使 Paratext 的 AutoCorrect.txt 功能運作? 謝謝
MSEAIT_LT 478 提出 已提問 12月 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 提出 已提問 9月 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 提出 已提問 10月 2, 2019
0
1 個回答 427 次瀏覽
我想將專案匯出為 HTML,以便與他人分享草稿 我不想匯出為 PDF,因為 PDF 在智慧型手機和其他小螢幕裝置上操作起來相當不便 我可以透過開啟 Paratext,點擊專案選單按鈕,然後選擇「進階」(Advanced),再選擇「將專案 ... 而,USFM 標記是可見的,例如 \v 1 和 \s 等標記 我該如何隱藏匯出 HTML 中的 USFM 標記?
bit 495 提出 已提問 4月 14, 2022
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
Don’t you know that you yourselves are God’s temple and that God’s Spirit dwells in your midst?
1 Corinthians 3:16
3,045 個問題
6,005 個回答
5,671 則評論
2,026 位使用者