Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 31/03/2020, à 16:32

L'Africain

Amélioration script python pour faire lien interne fichier xml

Bonjour,
Edit: En fait le séparateur de référence n'était pas juste. En le changeant pour une virgule ça rosolvait en partie le problème.
Maintenant le script fonctionne correctement sur le problème décrit plus bas mais ne réussit pas à traiter les références sans le nom du livre qui ont plusieurs versets. Exemple:

<reference osisRef="1Cor.9.7-1Cor.9.9 1Cor.9.14 1Tim.4.3-1Tim.4.5 1Tim.5.18">1Kor 9:7-9, 9:14, 10:25-27; 1Tim 4:3-5, 5:18<!-- orefs - unprocessed reference --></reference>

Nous voyons ici que 9:14 est bien traité, mais pas 10:25-27. SI le script pouvait réussir à traiter cette référence ça serait génial.

J'ai un fichier xml qui contient plusieurs livres, chapitre et versets. Dans ce même fichier il y a doit y avoir des liens qui renvoient à diverses parties du fichiers. Avant d'être traitées ces parties ressemblent à ceci:

<note type="crossReference"><reference>4 Царе 19:15; 2 Лет 2:12; Пс 8:3; 33:6; 115:15; Ер 10:12,16; Деян 4:24; Евр 11:3; Откр 4:11</reference></note>

Pour créer ces liens, j'utilise le script orefs.py qui va lire un autre fichier avec les abréviations de chaque livres du fichier xml. Le résultat devrait être ceci:

<note type="crossReference"><reference osisRef="2Kgs.19.15 2Chr.2.12 Ps.8.3 Rev.33.6 Rev.115.15 Jer.10.12 Jer.10.16 Acts.4.24 Heb.11.3 Rev.4.11">4 Царе 19:15; 2 Лет 2:12; Пс 8:3; 33:6; 115:15; Ер 10:12,16; Деян 4:24; Евр 11:3; Откр 4:11</reference>

Voici le fichier que lit orefs.py, je l'ai appellé BulverenRef:

[DEFAULT]
SEPM = ;
SEPP = ,
SEPC = :
SEPR = -
SEPRNORM = –—
DIGITS = 0123456789

[ABBR]
Gen = БИТИЕ, Бит
Exod = ИЗХОД, Изх
Lev = ЛЕВИТ, Лев
Num = ЧИСЛА, Чис
Deut = ВТОРОЗАКОНИЕ, Втзк
Josh = ИИСУС НАВИЕВ, Иис Нав
Judg = СЪДИИТЕ, Съд
Ruth = РУТ, Рут
1Sam = 1 ЦАРЕТЕ, 1 Царе
2Sam = 2 ЦАРЕТЕ, 2 Царе
1Kgs = 3 ЦАРЕТЕ, 3 Царе
2Kgs = 4 ЦАРЕТЕ, 4 Царе
1Chr = 1 ЛЕТОПИСИТЕ, 1 Лет
2Chr = 2 ЛЕТОПИСИТЕ, 2 Лет
PrMan = 
Jub = 
1En = 
Ezra = ЕЗДРА, Езд
Neh = НЕЕМИЯ, Неем
Tob = 
Jdt = 
Esth = ЕСТИР, Ест
EsthGr = 
1Meq = 
2Meq = 
3Meq = 
Job = ЙОВ, Йов
Ps = ПСАЛМИ, Пс
AddPs = 
5ApocSyrPss = 
Odes = 
Prov = ПРИТЧИ, Пр
Reproof = 
Eccl = ЕКЛИСИАСТ, Екл
Song = ПЕСЕН, Пес
Wis = 
Sir = 
PssSol = 
Isa = ИСАЯ, Ис
Jer = ЕРЕМИЯ, Ер
Lam = ПЛАЧЪТ, Плач
Bar = 
EpJer = 
2Bar = 
EpBar = 
4Bar = 
Ezek = ЕЗЕКИИЛ, Езек
Dan = ДАНИИЛ, Дан
DanGr = 
PrAzar = 
Sus = 
Bel = 
Hos = ОСИЯ, Ос
Joel = ЙОИЛ, Йоил
Amos = АМОС, Ам
Obad = АВДИЯ, Авд
Jonah = ЙОНА, Йона
Mic = МИХЕЙ, Мих
Nah = НАУМ, Наум
Hab = АВАКУМ, Авак
Zeph = СОФОНИЯ, Соф
Hag = АГЕЙ, Аг
Zech = ЗАХАРИЯ, Зах
Mal = МАЛАХИЯ, Мал
1Esd = 
2Esd = 
4Ezra = 
5Ezra = 
6Ezra = 
1Macc = 
2Macc = 
3Macc = 
4Macc = 
Matt = МАТЕЙ, Мт
Mark = МАРК, Мк
Luke = ЛУКА, Лк
John = ЙОАН, Йн
Acts = ДЕЯНИЯТА, Деян
Rom = РИМЛЯНИТЕ, Римл
1Cor = 1 КОРИНТЯНИТЕ, 1 Кор
2Cor = 2 КОРИНТЯНИТЕ, 2 Кор
Gal = ГАЛАТЯНИТЕ, Гал
Eph = ЕФЕСЯНИТЕ, Еф
Phil = ФИЛИПЯНИТЕ, Фил
Col = КОЛОСЯНИТЕ, Кол
1Thess = 1 СОЛУНЦИТЕ, 1 Сол
2Thess = 2 СОЛУНЦИТЕ, 2 Сол
1Tim = 1 ТИМОТЕЙ, 1 Тим
2Tim = 2 ТИМОТЕЙ, 2 Тим
Titus = ТИТ, Тит
Phlm = ФИЛИМОН, Филим
Heb = ЕВРЕИТЕ, Евр
Jas = ЯКОВ, Як
1Pet = 1 ПЕТЪР, 1 Петр
2Pet = 2 ПЕТЪР, 2 Петр
1John = 1 ЙОАН, 1 Йн
2John = 2 ЙОАН, 2 Йн
3John = 3 ЙОАН, 3 Йн
Jude = ЮДА, Юда
Rev = ОТКРОВЕНИЕТО, Откр
EpLao = 

J'exécute orefs.py comme ceci:

orefs.py -i fichier_d'entrée.xml -o fichier de sortie.xml -c BulverenRef

Et voilà mon problème: quand une référence sans le nom du livre, mais uniquement avec son chapitre et son verset suit un séparateur de référence (dans notre cas c'est le wink le script le convertit systématiquement avec la référence du livre Rev. Ce qui est faux. Par exemple dans le modèle donné plus haut vous pouvez voir deux entrée Rev:

Ps.8.3 Rev.33.6 Rev.115.15 

Or Rev devrait être Ps, car 33.6 et 115.15 sont des références du livre Ps. En gros quand plusieurs références d'un même livre se suivent on ne réécrit pas le nom du livre (sans dans ce qui est traité par orefs.py).
Voic le script en question:

#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""Helper script to add osisRef attributes to reference tags in osis files."""
from __future__ import print_function, unicode_literals
import sys
import argparse
import os
import os.path
import datetime
import configparser
from collections import OrderedDict
import re

# -------------------------------------------------------------------------- #

# NOTES AND KNOWN LIMITATIONS:
#
#   For automatic determination of book abbreviations, the presence
#   of toc2 and toc3 tags is required. If these are not present, there
#   won't be any way to determine the book part for the osisRef attribute.
#
#   ALTERNATIVELY, a separate config file can be used to manually specify
#   book names and abbreviations. See the README-orefs.md file for more
#   information and example config file contents.
#
#   A beginning config file can be automatically generated now using the
#   following command:
#
#       orefs.py -i OSISFILE -o CONFIGFILE -c create
#

# SPECIAL CHARACTERS USED DURING PROCESSING:
#    uFDEA     - marks start of book abbreviation during processing
#    uFDEB     - marks end of book abbreviation during processing

# VARIABLES THAT CONTROL HOW VERSE REFERENCES ARE PARSED
SEPM = ";"  # separates multiple references
SEPC = ":"  # separates chapter from verse
SEPP = ","  # separates multiple verses or verse ranges
SEPR = "-"  # separates verse ranges
SEPRNORM = ["–", "—"]  # used to normalize verse ranges
DIGITS = "0123456789"  # default set of decimal digits to use
DIGITTABLE = str.maketrans(DIGITS, DIGITS) # digit translation table

# book tag format string
BTAG = "\uFDEA{}\uFDEB"

# list of OSIS bible books
BOOKLIST = [
    'Gen', 'Exod', 'Lev', 'Num', 'Deut', 'Josh', 'Judg', 'Ruth', '1Sam',
    '2Sam', '1Kgs', '2Kgs', '1Chr', '2Chr', 'PrMan', 'Jub', '1En', 'Ezra',
    'Neh', 'Tob', 'Jdt', 'Esth', 'EsthGr', '1Meq', '2Meq', '3Meq', 'Job',
    'Ps', 'AddPs', '5ApocSyrPss', 'Odes', 'Prov', 'Reproof', 'Eccl', 'Song',
    'Wis', 'Sir', 'PssSol', 'Isa', 'Jer', 'Lam', 'Bar', 'EpJer', '2Bar',
    'EpBar', '4Bar', 'Ezek', 'Dan', 'DanGr', 'PrAzar', 'Sus', 'Bel', 'Hos',
    'Joel', 'Amos', 'Obad', 'Jonah', 'Mic', 'Nah', 'Hab', 'Zeph', 'Hag',
    'Zech', 'Mal',
    '1Esd', '2Esd', '4Ezra', '5Ezra', '6Ezra', '1Macc', '2Macc', '3Macc',
    '4Macc',
    'Matt', 'Mark', 'Luke', 'John', 'Acts', 'Rom', '1Cor', '2Cor', 'Gal',
    'Eph', 'Phil', 'Col', '1Thess', '2Thess', '1Tim', '2Tim', 'Titus', 'Phlm',
    'Heb', 'Jas', '1Pet', '2Pet', '1John', '2John', '3John', 'Jude', 'Rev',
    'EpLao'
]

# list of books with one chapter
ONECHAP = ['Obad', 'Phlm', '2John', '3John', 'Jude']

# revisionDesc
REVISIONDESC = '''<revisionDesc resp="{}">
        <date>{}</date>
        <p>osisRef attributes added using orefs.py</p>
      </revisionDesc>
      '''


def getabbrevs(text):
    """Get book abbreviations from toc2 and toc3 usfm tags."""
    abbrevs = OrderedDict()
    abbrevs2 = OrderedDict()
    book = ""
    lines = text.split("\n")
    num = 0
    for i in [_ for _ in lines if 'type="book"' in _]:
        num += 1
        bkline = lines.index(i)
        book = i.partition('osisID="')[2].split('"')[0]
        abbrevs[book] = ["{:03}".format(num)]
        abbrevs2["{:03}".format(num)] = book
        for j in range(bkline, bkline + 10):
            if "x-usfm-toc2" in lines[j]:
                abbr = lines[j].partition('n="')[2].split('"')[0]
                abbrevs[book].append(abbr)
            elif "x-usfm-toc3" in lines[j]:
                abbr = lines[j].partition('n="')[2].split('"')[0]
                abbrevs[book].append(abbr)
    return abbrevs, abbrevs2


def readconfig(fname):
    """Read a config file and return the values."""
    # set up config parser and read our config file...
    config = configparser.ConfigParser(allow_no_value=True)
    config.optionxform = str
    config.read(fname)

    # variables used while reading config file
    abbr = OrderedDict()

    # get default part of config...
    for i in ["SEPM", "SEPP", "SEPC", "SEPR", "SEPRNORM"]:
        globals()[i] = config["DEFAULT"][i]
    if "DIGITS" in config["DEFAULT"]:
        globals()["DIGITS"] = config["DEFAULT"]["DIGITS"]
        globals()["DIGITTABLE"] = str.maketrans("0123456789",
                                                globals()["DIGITS"])
    globals()["SEPRNORM"] = {
        True: list(globals()["SEPR"]),
        False: list(globals()["SEPRNORM"])
    }[globals()["SEPRNORM"] == ""]

    # get abbreviations
    for i in BOOKLIST:
        if i in config["ABBR"]:
            abbr[i] = {
                True: config["ABBR"][i],
                False: None
            }[config["ABBR"][i] != ""]

    # fix abbreviation lists
    abbrevs = OrderedDict()
    abbrevs2 = OrderedDict()
    num = 0
    for i in abbr:
        num += 1
        if abbr[i] is not None:
            abbr[i] = [i.strip() for i in abbr[i].split(",")]
            abbr[i] = sorted(abbr[i], key=len, reverse=True)
            abbr[i].insert(0, "{:03}".format(num))
            abbrevs[i] = abbr[i]
            abbrevs2[abbr[i][0]] = i

    # return our abbreviations and configuration
    return abbrevs, abbrevs2


def genconf(text):
    """Generate contents of a config file."""
    # set up config parser
    config = configparser.ConfigParser(allow_no_value=True)
    config.optionxform = str
    for i in (("SEPM", SEPM),
              ("SEPP", SEPP),
              ("SEPC", SEPC),
              ("SEPR", SEPR),
              ("SEPRNORM", "".join(SEPRNORM)),
              ("DIGITS", DIGITS)):
        config["DEFAULT"][i[0]] = i[1]

    # create ABBR section of config…
    config["ABBR"] = {}
    for i in BOOKLIST:
        config["ABBR"][i] = ""
    abbr1, _ = getabbrevs(text)
    for i in abbr1.keys():
        config["ABBR"][i] = ", ".join(abbr1[i][1:])

    # return our generate configuration
    return config


def processreferences(text, abbr, abbr2):
    """Process cross references in osis text."""
    crossrefnote = re.compile(
        r'(<note type="crossReference">)(.*?)(</note>)', re.U)
    reftag = re.compile(
        r'(<reference[^>]*>)(.*?)(</reference>)', re.U)

    lines = text.split('\n')

    currentbook = ""

    def simplerepl(match):
        """Simple regex replacement helper function."""
        errortext = ""
        text = match.group(2).strip()
        if text.startswith("(") and text.endswith(")"):
            text = text[1:-1].strip()
        osisrefs, oreferror = getosisrefs(text, currentbook, abbr, abbr2)

        if oreferror:
            errortext = '<!-- orefs - unprocessed reference -->'

        # process reference tags
        if match.group(1).startswith('<reference'):
            reftagstart = match.group(1).replace('>', ' {}>').format(
                'osisRef="{}"'.format(osisrefs))
            outtext = '{}{}{}</reference>'.format(
                reftagstart, text, errortext)
        else:
            # only process references if no reference tag is present in text.
            if '<reference ' not in text:
                outtext = r'<note type="crossReference">{}</note>'.format(
                    '<reference osisRef="{}">{}{}</reference>'.format(
                        osisrefs,
                        text,
                        errortext))
            else:
                outtext = r'<note type="crossReference">{}</note>'.format(
                    text)
        return outtext

    for i in (_ for _ in range(len(lines))):
        if 'div type="book"' in lines[i]:
            currentbook = lines[i].split('osisID="')[1].split('"')[0]
        if "<reference" in lines[i]:
            lines[i] = reftag.sub(simplerepl, lines[i], 0)
        if "crossReference" in lines[i]:
            lines[i] = crossrefnote.sub(simplerepl, lines[i], 0)

    return '\n'.join(lines)


def getosisrefs(text, currentbook, abbr, abbr2):
    """Attempt to get a list of osis refs from a line of text."""
    # skip reference processing if there is already a reference tag present.
    if "<reference" in text:
        return text, False

    # --- helper functions
    def chapchk(num):
        """Chapter number sanity check."""
        try:
            rval = str(int(num))
        except ValueError:
            rval = {
                True: num,
                False: False,
            }[num in "ABCDEFabcdef"]
        return rval

    def vrschk(num):
        """Verse number sanity check."""
        rval = False
        try:
            rval = str(int(num))
        except ValueError:
            try:
                if num[-1] in "ABCDabcd":
                    rval = "{}!{}".format(str(int(num[:-1])), num[-1])
            except (ValueError, IndexError):
                pass
        return rval

    def referror(text, abbr):
        """Print a reference error message."""
        for i in abbr.keys():
            text = text.replace("{}{}{}".format(BTAG[0],
                                                i,
                                                BTAG[-1]),
                                abbr[i])
        print("WARNING: Reference not processed… {}".format(text),
              file=sys.stderr)

    # --- flag used to indicate an error processing references
    oreferror = False

    # --- normalize range separator
    for i in SEPRNORM:
        text = text.replace(i, SEPR)
    text = text.replace("{}{}".format(SEPR, SEPR), SEPR)

    # --- filter out directional formatting characters
    for i in ['\u200E', '\u200F', '\u061C', '\u202A', '\u202B', '\u202C',
              '\u202D', '\u202E', '\u2066', '\u2067', '\u2068', '\u2069']:
        text = text.replace(i, '')

    # --- strip whitespace and parenthesis that may surround references.
    text = text.strip()
    text = text.lstrip('(').rstrip(')')

    # --- prepare book part of references for processing
    for i in reversed(abbr):
        tag = BTAG.format(abbr[i][0])
        restr = r'\b{}\b'.format('|'.join([re.escape(_) for
                                           _ in abbr[i][1:]]))
        text = re.sub(restr, tag, text, flags=re.U)

    # --- break multiple references part
    newtext = text.split(SEPM)
    if not isinstance(newtext, list):
        newtext = [newtext]
    newtext = [_.strip() for _ in newtext if _.strip() != '']

    # --- process book part of references
    lastbook = BTAG.format(abbr[currentbook][0])
    for i in reversed(abbr):
        tag = BTAG.format(abbr[i][0])

        for j in enumerate(newtext):
            try:
                if tag[0] in newtext[j[0]]:
                    lastbook = tag
                    tmp = newtext[j[0]].partition(" ")
                    try:
                        newtext[j[0]] = " ".join([
                            tmp[0][tmp[0].index(tag[0]):],
                            tmp[2]])
                    except ValueError:
                        newtext[j[0]] = " ".join([tmp[0], tmp[2]])
            except IndexError:
                pass
            # add last book to reference where it was omitted.
            nobook = True
            for k in newtext[j[0]]:
                nobkchk = "".join([SEPM, SEPC, SEPP, SEPR, "0123456789"])
                if k not in list(nobkchk):
                    nobook = False
                    break
            if nobook and lastbook is not None:
                newtext[j[0]] = "{} {}".format(lastbook, newtext[j[0]])

    # remove bad book references
    for i in enumerate(newtext):
        chk = i[1].partition(BTAG[-1])
        if chk[2] == "":
            referror(newtext[i[0]], abbr2)
            oreferror = True
            newtext[i[0]] = None
    newtext = [_ for _ in newtext if _ is not None]

    # --- process chapter/verse part of references
    refs = []
    for i in newtext:
        # book part
        bcv = i.partition(BTAG[-1])
        bkref = bcv[0].partition(BTAG[0])[2]

        # handle references that use something other than arabic numerals
        if globals()["DIGITS"] != "0123456789":
            bkref = bkref.translate(DIGITTABLE)

        # chapverse part
        if SEPC in bcv[2]:
            chapverse = bcv[2].lstrip(" ").partition(SEPC)
            chapverse = [_.strip() for _ in chapverse]
        # handle books that only have 1 chapter
        elif abbr2[bkref] in ONECHAP:
            chapverse = "1:{}".format(bcv[2].lstrip(" ")).partition(SEPC)
        # verseless reference... we can't process those yet.
        else:
            referror(i, abbr2)
            oreferror = True
            continue

        # check chapter number for validity
        chap = chapchk(chapverse[0])
        if chap is False:
            referror(i, abbr2)
            oreferror = True
            continue

        # split references into multiple parts separated by SEPP
        vrs = chapverse[2].split(SEPP)
        for j in vrs:
            # split on verse ranges
            vrsrange = j.split(SEPR)
            if len(vrsrange) > 1:
                # split 2nd part of verse range at SEPC
                vrsrange2 = vrsrange[1].split(SEPC)
                if len(vrsrange2) > 1:
                    # additional chapter specified
                    vrsrange2[0] = chapchk(vrsrange2[0])
                    vrsrange2[1] = vrschk(vrsrange2[1])
                    if False in vrsrange2:
                        referror(" ".join([abbr2[bkref], j]), abbr2)
                        oreferror = True
                        continue
                    refs.append("{}.{}.{}-{}.{}.{}".format(
                        abbr2[bkref],
                        chap,
                        vrsrange[0],
                        abbr2[bkref],
                        vrsrange2[0],
                        vrsrange2[1]))
                else:
                    # no additional chapter specified
                    vrsrange[0] = vrschk(vrsrange[0])
                    vrsrange[1] = vrschk(vrsrange[1])
                    if False in vrsrange:
                        referror(" ".join([abbr2[bkref], j]), abbr2)
                        oreferror = True
                        continue
                    refs.append("{}.{}.{}-{}.{}.{}".format(
                        abbr2[bkref],
                        chap,
                        vrsrange[0],
                        abbr2[bkref],
                        chap,
                        vrsrange[1]))
            # not a verse range
            else:
                if SEPC in j:
                    chapverse2 = j.split(SEPC)
                    if " " in chapverse2[1]:
                        chapverse2[1] = chapverse2[1].split(" ")[0]
                    chapverse2[0] = chapchk(chapverse2[0])
                    chapverse2[1] = vrschk(chapverse2[1])
                    if False in chapverse2:
                        referror(" ".join([abbr2[bkref], j]), abbr2)
                        oreferror = True
                        continue
                    refs.append("{}.{}.{}".format(abbr2[bkref],
                                                  chapverse2[0],
                                                  chapverse2[1]))
                else:
                    if " " in j:
                        j = j.split(" ")[0]
                    tmp = vrschk(j)
                    if tmp is False:
                        referror(" ".join([abbr2[bkref], j]), abbr2)
                        oreferror = True
                        continue
                    refs.append("{}.{}.{}".format(abbr2[bkref], chap, tmp))

    # --- return joined references
    return " ".join(refs), oreferror

# -------------------------------------------------------------------------- #


def processfile(args):
    """Process osis file."""
    with open(args.i, "r") as ifile:
        if args.v:
            print("Reading input file {} ...".format(args.i))
        text = ifile.read()

    if args.v:
        print("Getting book names and abbreviations...")
    if args.c is not None:
        if args.c == "create":
            if args.v:
                print("Creating config file...")
            generatedconf = genconf(text)
        else:
            if args.v:
                print("Using config file for abbreviations...")
            bookabbrevs, bookabbrevs2 = readconfig(args.c)
    else:
        if args.v:
            print("Extracting book names and abbreviations from osis file...")
        bookabbrevs, bookabbrevs2 = getabbrevs(text)
    if args.c != "create":
        if args.v:
            print("Processing cross references...")
        text = processreferences(text, bookabbrevs, bookabbrevs2)

    # add new revisionDesc to osis file...
    username = {
        True: os.getenv("LOGNAME"),
        False: os.getenv("USERNAME")
    }[os.getenv("USERNAME") is None]
    textsplit = text.partition("<revisionDesc")
    if len(textsplit[1]) > 0:
        # -- only add if there is already a revisionDesc tag present
        # -- just in case this was run on something processed by
        # -- another usfm to osis converter that didn't add a
        # -- revisionDesc tag to the osis document.
        text = "".join([textsplit[0],
                        REVISIONDESC.format(
                            username,
                            datetime.datetime.now().strftime(
                                "%Y.%m.%dT%H.%M.%S")),
                        textsplit[1],
                        textsplit[2]])

    if args.v:
        print("Writing output to {} ".format(args.o))
    if args.c == "create":
        with open(args.o, "w") as ofile:
            generatedconf.write(ofile)
    else:
        with open(args.o, "wb") as ofile:
            ofile.write(text.encode("utf8"))

    if args.v:
        print("Done.")

# -------------------------------------------------------------------------- #


def main():
    """
    Main routine.

    Process our command line arguments and pass the options
    along to subroutine that processes the file.

    """
    parser = argparse.ArgumentParser(
        description="""
            Process cross references.
        """
    )
    parser.add_argument("-v",
                        help="verbose output",
                        action="store_true")
    parser.add_argument("-i",
                        help="name of input file",
                        required=True, metavar="FILE")
    parser.add_argument("-o",
                        help="name of output file",
                        required=True, metavar="FILE")
    parser.add_argument("-c",
                        help="\n".join([
                            "config file to use.",
                            "create means to generate a config file."]),
                        metavar="FILE|create")
    args = parser.parse_args()

    if not os.path.isfile(args.i):
        print("ERROR: input file is not present or is not a normal file.",
              file=sys.stderr)
        sys.exit()

    processfile(args)


if __name__ == "__main__":
    main()

Pour info, le git de base est ici: https://github.com/adyeths/u2o
Mais ryan a abandonné la partie orefs.py, qui est essentielle à mon travail. Je sais qu'il avait fait une dernière modif à son script ce qui avait pour effet ne de plus fonctionner du tout avec mes fichiers. J'utilise la version avant les dernières modifications.

Merci d'avance pour toute aide. (il y a deux autres problèmes, mais moins important que celui-ci).

Dernière modification par L'Africain (Le 02/04/2020, à 13:17)


Ubuntu-Unity 18.04 LDLC (clevo) X/Lubuntu-Mate
"Donne à celui qui te demande…" Mt 5,42

Hors ligne

#2 Le 02/04/2020, à 13:19

L'Africain

Re : Amélioration script python pour faire lien interne fichier xml

Edit: Je viens de modifier le message au début, car en changeant le séparateur de référence, et en respectant ce qui est dans le fichier BulverenRef les références ne sont désormais plus systématiquement remplacées par Rev. Mais un autre problème, certe mineur surgit. Je l'ai décrit au début du premier post.
Merci d'avance.


Ubuntu-Unity 18.04 LDLC (clevo) X/Lubuntu-Mate
"Donne à celui qui te demande…" Mt 5,42

Hors ligne

#3 Le 06/04/2020, à 17:18

L'Africain

Re : Amélioration script python pour faire lien interne fichier xml

Bonjour,
Comme je m'étais trompé de section, je me permet de remettre un petit up sur ce post.


Ubuntu-Unity 18.04 LDLC (clevo) X/Lubuntu-Mate
"Donne à celui qui te demande…" Mt 5,42

Hors ligne