Merge pull request #30 from Lab-8916100448256/master

chemin du fichier de sortie relatif à l'emplacement du script
This commit is contained in:
VEAUDOUR mickael 2019-06-05 21:53:51 +02:00 committed by GitHub
commit 2556893dfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

1
script/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
dev_config.py

View file

@ -7,6 +7,7 @@ from pprint import pprint
from rocketchat_API.rocketchat import RocketChat
import json
import dev_config as cfg
import os
def getNodesOrigin(channel):
nodes = []
@ -93,7 +94,17 @@ while True:
break
index += channels['count']
with open('../public/data/channelslist.json', "w") as file_write:
# Récupération du répertoire racine du repo
rootFolder = os.path.join(os.path.dirname(__file__), '..')
# Répertoire pour stocker le fichier de sortie
dataFolder = os.path.join(rootFolder, 'public','data')
# Faut il essayer de le créer au cas ou?
# os.makedirs(dataFolderPath, exist_ok=True)
channelsFilePath = os.path.abspath(os.path.join(dataFolder,'channelslist.json'))
#print("Ecriture dans : "+channelsFilePath)
with open(channelsFilePath, "w") as file_write:
json.dump(datas, file_write)
pprint("Nb displayed channels : " + str(nbChannels))