# HG changeset patch # User artbio # Date 1589240137 0 # Node ID e62e3b548b7ed51b808506558fb5f6d44e669fc9 # Parent b8460b9f425354e58ac7ae6ce6137e7db03b098e "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625" diff -r b8460b9f4253 -r e62e3b548b7e facturation.py --- a/facturation.py Thu Jan 10 11:19:53 2019 -0500 +++ b/facturation.py Mon May 11 23:35:37 2020 +0000 @@ -3,12 +3,16 @@ import argparse import re +import warnings import openpyxl import pandas as pd +warnings.filterwarnings("ignore") + + def Parser(): the_parser = argparse.ArgumentParser() the_parser.add_argument('--input', '-i', action='store', type=str, @@ -27,7 +31,7 @@ """Script de parsing des fichiers de facturation de l'IBPS""" # ouverture fichier input - with open(input_file, 'r') as file_object: + with open(input_file, 'rb') as file_object: facture_html = file_object.read() # convert to unicode utf-8, remove   and € facture_html = facture_html.decode('utf-8') @@ -35,11 +39,11 @@ facture_html = facture_html.replace(r' €', '') facture_html = facture_html.replace(u' \u20ac', '') # parsing de la référence, de la date et de la période de facturation - date = re.search(r'Paris le (.*?)

'.decode('utf-8'), + date = re.search(r'Paris le (.*?)

', facture_html).group(1) - periode = re.search(r'de la prestation (.*?)

'.decode('utf-8'), + periode = re.search(r'de la prestation (.*?)

', facture_html).group(1) - ref = re.search(r'rence interne d.*? :\s*(.*?)<'.decode('utf-8'), + ref = re.search(r'rence interne d.*? :\s*(.*?)<', facture_html).group(1) # parsing des tableaux html avec pandas @@ -68,7 +72,7 @@ # ouverture fichier output facture_output = openpyxl.load_workbook( - template, data_only=False, keep_vba=False) + template, data_only='True', keep_vba=False) ws = facture_output.worksheets[0] # rajout de l'image de SU qui ne survit pas à la conversion diff -r b8460b9f4253 -r e62e3b548b7e facturation.xml --- a/facturation.xml Thu Jan 10 11:19:53 2019 -0500 +++ b/facturation.xml Mon May 11 23:35:37 2020 +0000 @@ -1,11 +1,11 @@ - + - beautifulsoup4 - html5lib - openpyxl - pandas - pil + beautifulsoup4 + html5lib + openpyxl + pandas + pillow