K
Karthikesh Raju
Hi All,
i am wondering about the best way to read in a configuration file that
goes like:
###########
[users]
source_dir = '/home/karthik/Projects/python'
data_dir = '/home/karthik/Projects/data'
result_dir = '/home/karthik/Projects/Results'
param_file = $result_dir/param_file
res_file = $result_dir/result_file
comment = 'this is a comment'
K = 8
simulate_K = 0
N = 4000
mod_scheme = 'QPSK'
Na = K+2
######################
As of now i use config parser and i get this in a dictionary but
a) but i have users.na and not users.Na (all the fields are in lower
case)
b) all the rhs arguements are string, but i have handled this by
trying " try eval(rhs) ... except ..." block
c) Na = 'K+2' though does not work, would like to have Na = 10, but i
get users.na = 'K+2'
d) result_file, param_file should actually be should be with pathname
extensions filled in.
Have looked in c.l.py none one ofthe suggestions was to use
splitlines, this cant handle blank lines, other was to have config.py
...
Hope to get some solution for this ..
with warm regards
karthik
--
-----------------------------------------------------------------------
Karthikesh Raju, email: (e-mail address removed)
Researcher, http://www.cis.hut.fi/karthik
Helsinki University of Technology, Tel: +358-9-451 5389
Laboratory of Comp. & Info. Sc., Fax: +358-9-451 3277
Department of Computer Sc.,
P.O Box 5400, FIN 02015 HUT,
Espoo, FINLAND
-----------------------------------------------------------------------
i am wondering about the best way to read in a configuration file that
goes like:
###########
[users]
source_dir = '/home/karthik/Projects/python'
data_dir = '/home/karthik/Projects/data'
result_dir = '/home/karthik/Projects/Results'
param_file = $result_dir/param_file
res_file = $result_dir/result_file
comment = 'this is a comment'
K = 8
simulate_K = 0
N = 4000
mod_scheme = 'QPSK'
Na = K+2
######################
As of now i use config parser and i get this in a dictionary but
a) but i have users.na and not users.Na (all the fields are in lower
case)
b) all the rhs arguements are string, but i have handled this by
trying " try eval(rhs) ... except ..." block
c) Na = 'K+2' though does not work, would like to have Na = 10, but i
get users.na = 'K+2'
d) result_file, param_file should actually be should be with pathname
extensions filled in.
Have looked in c.l.py none one ofthe suggestions was to use
splitlines, this cant handle blank lines, other was to have config.py
...
Hope to get some solution for this ..
with warm regards
karthik
--
-----------------------------------------------------------------------
Karthikesh Raju, email: (e-mail address removed)
Researcher, http://www.cis.hut.fi/karthik
Helsinki University of Technology, Tel: +358-9-451 5389
Laboratory of Comp. & Info. Sc., Fax: +358-9-451 3277
Department of Computer Sc.,
P.O Box 5400, FIN 02015 HUT,
Espoo, FINLAND
-----------------------------------------------------------------------