[Tutor] Looking for ConfigObj Documentation

Marc Tompkins marc.tompkins at gmail.com
Sun Feb 22 06:23:30 CET 2009


On Fri, Feb 20, 2009 at 2:19 PM, Wayne Watson
<sierra_mtnview at sbcglobal.net>wrote:

>  Good. Thanks. It works fine for me now.  I deleted the file. I just ran
> the program again straight from the py file, and it put my the black window
> with my raw_input prompt.  It seems odd that it wouldn't have left text
> debris when it crashed.
>
> I've attached a copy of an Initial file. It's still under development, but
> pretty close for the immediate purposes. The "_file_" names will likely end
> up as a string showing the complete path to the file.  start/stop_time will
> be times in
>  the format shown, hh:mm:ss. The first line is just a header, and currently
> gets tossed when the file is read.  "_name" are strings. No others have seen
> the program, so development continues.
>
> Sentinel NC Configuration File Sentinel User 3 - 1/3/2009 (Meteor Software)
> config_file_name=Initial.sen
> mask_file_name=*none*
> gray_scale=True
> post_event_stack=False
> post_event_format=Tiff 2
> show_real_time=False
> hourly_rate=12
> slowdown=1
> start_time=20:00:12
> stop_time=06:03:00
> lat=40.0
> long=120.0
> utc_offset=8
> elevation=1000.0
> site_name=Unknown
> clock_drift=0.0
> zenith_x_pixel=319
> zenith_y_pixel=239
> north_angle_rotation=0.0
> events=Events
> post_events=Post_Events
> meteors=Meteor_Tags
> composites=wtw:same as events?
> flat_mask_val=30
> mask_file_name=*none*
> mask_file_offset=30
> flat_mask_active=False
>
>
OK - first problem is, as the error message indicated, line 1:

> Sentinel NC Configuration File Sentinel User 3 - 1/3/2009 (Meteor Software)
>
It's not a comment, it's not a real configuration item, so ConfigObj barfs.
Put a "#" in front of that, and we run just fine until:

> configobj.DuplicateError: Duplicate keyword name at line 26.
>
which is also correct - line 26 is a duplicate of line 3.  Put a "#" in
front of _that_, and we run just fine with the following result:
"""

config_file_name = Initial.sen
mask_file_name = *none*
gray_scale = True
post_event_stack = False
post_event_format = Tiff 2
show_real_time = False
hourly_rate = 12
slowdown = 1
start_time = 20:00:12
stop_time = 06:03:00
lat = 40.0
long = 120.0
utc_offset = 8
elevation = 1000.0
site_name = Unknown
clock_drift = 0.0
zenith_x_pixel = 319
zenith_y_pixel = 239
north_angle_rotation = 0.0
events = Events
post_events = Post_Events
meteors = Meteor_Tags
composites = wtw:same as events?
flat_mask_val = 30
#mask_file_name=*none*
mask_file_offset = 30
flat_mask_active = False

"""
(Once again, those are my own triple quotes) Notice that the first line has
been suppressed - if you want a comment to survive into the actual file,
you'll need to add it in the configspec; however, line 26 _did_ survive...
there's some mystery there, but I'm not going to kill myself over it.
I haven't modified the actual program or the configspec.  This illustrates
that the configspec dictates the bare minimum that the config file can
contain, not the maximum - any valid lines (of the format "name = value")
that are in the config file but not in the spec will survive (and be
available to your program).


-- 
www.fsrtechnologies.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090221/a608a3b1/attachment.htm>


More information about the Tutor mailing list