0 votes
211 vues

I got an error trying to use “Outils personnalisation” > “Admin” > “Show Project Plan HTML” on PT9.0 in Wasta-Linux. It turns out the python script attempts to use the Windows Registry to find the Paratext Projects folder. Note the 3rd line, “from _winreg import…” (from 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

However, this same folder can be found in a relative fashion using the os.path module. So I updated the function on my system to the following:

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

So I guess my question is: Is it possible that in a non-standard install the cms folder could be located somewhere other than within the Paratext Projects folder, which would necessitate the registry check in Windows? Or, if not, would someone consider updating the ProjectPlanImport.py and ProjectPlanRoot.py scripts to use the built-in tools to make the scripts more universally compatible?

I’d also be willing to work out a way to do an OS check and handle finding the settingsDirectory in an OS-dependent way if I could discuss this with the right person. By the way, these seem to be the only two places that the _winreg module is referenced in the cms scripts.

Paratext par (298 points)
modifié par | 211 vues

1 Réponse

0 votes
After using my own workaround for a few months I realized that 1) the above "settingsDirectory()" function is unnecessary because "SettingsDirectory" is actually a provided global variable to the CMS scripts, and 2) the "\toHtml" parameter in the .cms file is supposed to open the generated HTML file in the default browser, but that also fails in a Linux installation. So I created a CMS script that piggybacks off of the "Show Project Plan HTML" script to add "Show Project Plan HTML (Linux)". This script avoids both of the above problems.

You can get the files from https://github.com/sil-car/ProjectPlanHtmlLinux
par (298 points)

Questions connexes

0 votes
0 réponses 175 vues
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 posée mai 8, 2020
0 votes
3 réponses 335 vues
At a recent Introduction to Paratext workshop, one of the attendees was using Paratext 8 on Wasta-Linux. Not being ... to get the AutoCorrect.txt feature to work? Thank you
MSEAIT_LT 478 posée déc. 1, 2017
0 votes
1 réponse 378 vues
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 posée sept. 8, 2016
0 votes
0 réponses 167 vues
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 posée oct. 2, 2019
0 votes
1 réponse 421 vues
I would like to export the project to HTML so that I can share drafts with people. I don't want to export to PDF, ... forth. How do I hide the USFM markers from the exported HTML?
bit 495 posée avr. 14, 2022
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
Just as a body, though one, has many parts, but all its many parts form one body, so it is with Christ.
1 Corinthians 12:12
3,044 questions
6,003 réponses
5,671 commentaires
2,026 utilisateurs