Skip to content
Snippets Groups Projects
Commit 807d76df authored by jacques.grelet_ird.fr's avatar jacques.grelet_ird.fr
Browse files

add global/codeRoscop path in toml configuration file, give priority to cmd line arg value

parent 1a05b3d1
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ import PySimpleGUI as sg ...@@ -6,7 +6,7 @@ import PySimpleGUI as sg
import toml import toml
import logging import logging
from file_extractor import FileExtractor from file_extractor import FileExtractor
import pathlib from pathlib import Path
from configparser import ConfigParser from configparser import ConfigParser
import os import os
import distutils.util as du import distutils.util as du
...@@ -180,14 +180,19 @@ if __name__ == "__main__": ...@@ -180,14 +180,19 @@ if __name__ == "__main__":
if args.debug: if args.debug:
logging.basicConfig( logging.basicConfig(
format='%(levelname)s:%(message)s', level=logging.DEBUG) format='%(levelname)s:%(message)s', level=logging.DEBUG)
# get roscop file
r = Roscop("code_roscop.csv")
# read config Toml file and get the physical parameter list (Roscop code) for the specified instrument # read config Toml file and get the physical parameter list (Roscop code) for the specified instrument
cfg = toml.load(args.config) cfg = toml.load(args.config)
# this the select device from command line ! # this the select device from command line !
device = str(args.instrument) # convert one element list to str device = str(args.instrument) # convert one element list to str
# get roscop file
if cfg['global']['codeRoscop'] != None:
defaultRoscop = Path(cfg['global']['codeRoscop'])
if args.roscop != None:
defaultRoscop = args.roscop
print(defaultRoscop)
r = Roscop(defaultRoscop)
# test arguements from sys.argv, args is never to None with default option set # test arguements from sys.argv, args is never to None with default option set
if args.gui or len(sys.argv) == 1: if args.gui or len(sys.argv) == 1:
...@@ -278,9 +283,6 @@ if __name__ == "__main__": ...@@ -278,9 +283,6 @@ if __name__ == "__main__":
# print = sg.Print(size=(80,40)) # print = sg.Print(size=(80,40))
else: else:
if args.roscop != None:
defaultRoscop = args.roscop
r = Roscop(defaultRoscop)
# demo mode, only in command line # demo mode, only in command line
if args.demo != None: if args.demo != None:
print('demo mode: {}'.format(args.demo)) print('demo mode: {}'.format(args.demo))
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
author = "jgrelet IRD March 2019 PIRATA-FR29 cruise" author = "jgrelet IRD March 2019 PIRATA-FR29 cruise"
debug = false debug = false
echo = true echo = true
codeRoscop = 'C:\git\python\oceano2python\code_roscop.csv'
[cruise] [cruise]
cycleMesure = "PIRATA-FR29" cycleMesure = "PIRATA-FR29"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment