chemin du fichier de sortie relatif à l'emplacement du script
This commit is contained in:
parent
89b5863f62
commit
5e14f01cd5
1 changed files with 14 additions and 1 deletions
|
@ -7,6 +7,8 @@ from pprint import pprint
|
||||||
from rocketchat_API.rocketchat import RocketChat
|
from rocketchat_API.rocketchat import RocketChat
|
||||||
import json
|
import json
|
||||||
import dev_config as cfg
|
import dev_config as cfg
|
||||||
|
import os
|
||||||
|
import inspect
|
||||||
|
|
||||||
def getNodesOrigin(channel):
|
def getNodesOrigin(channel):
|
||||||
nodes = []
|
nodes = []
|
||||||
|
@ -93,7 +95,18 @@ while True:
|
||||||
break
|
break
|
||||||
index += channels['count']
|
index += channels['count']
|
||||||
|
|
||||||
with open('../public/data/channelslist.json', "w") as file_write:
|
# Récupération du chemin ou est installé le script
|
||||||
|
scriptFileName = pprint(inspect.getfile(inspect.currentframe()))
|
||||||
|
# scriptFileName contiens habituellement le chemin complet mais pas toujours
|
||||||
|
# (ce n'est pas le cas sur Mac OSX par exemple).
|
||||||
|
scriptFolderPath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
|
||||||
|
|
||||||
|
# Répertoire pour stocker le fichier de sortie
|
||||||
|
dataFolderPath = scriptFolderPath + '/../public/data'
|
||||||
|
# Faut il essayer de le créer au cas ou?
|
||||||
|
# os.makedirs(dataFolderPath, exist_ok=True)
|
||||||
|
|
||||||
|
with open(dataFolderPath + '/channelslist.json', "w") as file_write:
|
||||||
json.dump(datas, file_write)
|
json.dump(datas, file_write)
|
||||||
|
|
||||||
pprint("Nb displayed channels : " + str(nbChannels))
|
pprint("Nb displayed channels : " + str(nbChannels))
|
||||||
|
|
Loading…
Reference in a new issue