<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi, actually I had two aims with the pseudo code, 1. print it, and 2.
check to see if it would pull in the two modules. I pulled it into
Word, and quickly formatted it to get the line wrap out, and put it in
some sort of readable format. After that, I thought why not just take
it as it was, and scoop it into IDLE.&nbsp; My plan was to right a test
program to get a better understanding of how to use ConfigObj rather
than just try it through the program I plan to use it in. <br>
<br>
I've tried to keep to IDLE for no reason other than the author
recommended it. Well, OK, I had gotten comfortable with the editor.&nbsp;
I'll try wxPython.<br>
<br>
I took a quick look look at where Python was installed and found it was
directly under C:, and not under Program Files. That's a surprise. Now
I recall where I found something about classes and paths. It's on the
File menu of IDLE, Class Browser and Path Browser. <br>
<br>
I thought, in the last post, I asked about items like: show_real_time =
boolean(default=False) and hourly_rate = integer(min=0, default=0);
but, apparently, I accidentally knocked it out.&nbsp; Anyway, here's the
question.&nbsp; Where is the syntax for items like boolean,&nbsp; integer, and
others described?&nbsp; The doc I have barely refers to them. <br>
<br>
Off to find wx...<br>
<br>
Marc Tompkins wrote:
<blockquote
 cite="mid:40af687b0902182353g38af5962o8700d01241919d92@mail.gmail.com"
 type="cite">
  <div class="gmail_quote">On Wed, Feb 18, 2009 at 7:42 PM, Wayne
Watson <span dir="ltr">&lt;<a moz-do-not-send="true"
 href="mailto:sierra_mtnview@sbcglobal.net">sierra_mtnview@sbcglobal.net</a>&gt;</span>
wrote:<br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div bgcolor="#ffffff" text="#000000">I took your "starter" code,
and formatted it to be what I hope is an
acceptable program, Gobal_Config.py. See attached.&nbsp; I'm using Python
2.5.2. I put the two modules in the same folder with it, and executed
it in IDLE. I got this:<br>
&nbsp; ...<br>
&nbsp; File
"C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\configobj.py",
line 1637, in _parse<br>
&nbsp;&nbsp;&nbsp; ParseError, infile, cur_index)<br>
&nbsp; File
"C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\configobj.py",
line 1748, in _handle_error<br>
&nbsp;&nbsp;&nbsp; raise error<br>
ParseError: Invalid line at line "1".<br>
    <br>
As far as I can tell, line 1 of config.obj looks OK. It's a comment.
Something is amiss.<br>
    </div>
  </blockquote>
  <div><br>
I hate to say it, but IDLE is really holding you back.&nbsp; It's convenient
because it installs automagically with Python, but it does funky,
confusing things - as in this case, where it's somehow stepped on the
real error and assigned blame in the wrong place; you've already
experienced its internal conflicts with Tkinter...&nbsp; I use wxPython for
my GUI goodness, and swear by SPE (Stani's Python Editor).&nbsp; I don't
want to re-ignite the IDE wars, but I definitely think you need to do
yourself a favor and move away from IDLE.<br>
  <br>
Anyway, I didn't mean for that to be a standalone program, but to be
picked apart into chunks and dropped into an existing program (or,
actually, just to be used as an example - maybe of what _not_ to do,
but an example...)&nbsp; <br>
First error: <br>
&nbsp;&nbsp;&nbsp; if argv is None:<br>
&nbsp; &nbsp; &nbsp; &nbsp;argv = sys.argv&nbsp; &lt;&lt;== you haven't imported "sys"<br>
  <br>
Second error:<br>
&nbsp;&nbsp;&nbsp; app = MyApp(0)&nbsp; &lt;&lt;== you haven't defined a class called
"MyApp", so you can't do this...<br>
  <br>
So I cut it down to just this bit:<br>
test = Global.cfgFile.validate(Global.vtor, copy=True)<br>
Global.cfgFile.write()<br>
  <br>
(unindented all the way to the left, so that it executes as the main
body of the program) and it works just fine... except:<br>
Third error (well, issue not error):<br>
Take all my comments out!&nbsp; They weren't meant to be included in final
code.&nbsp; ConfigObj allows inline comments in your config file, and in the
configspec - so my comments show up in there too.&nbsp; Here's what
Initial.sen ends up looking like:<br>
  <br>
  <blockquote>mask_file_name = None<br>
gray_scale = True<br>
post_event_stack = False<br>
post_event_format = Tiff 2<br>
show_real_time = False<br>
hourly_rate = 0<br>
slowdown = 1&nbsp;&nbsp;&nbsp; # I don't know what<br>
#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this value is/does, so this is probably wrong<br>
start_time = 00:00:00&nbsp;&nbsp;&nbsp; # or you could make the default None?<br>
stop_time = 00:00:00<br>
&nbsp;&nbsp;&nbsp; #&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; as a default latitude, if any...<br>
  </blockquote>
I've cut everything down; I'm attaching it as Global_Config1.py (just
to avoid confusion with the earlier version).&nbsp; If you do actually want
to use it as the basis of anything, you'll want to place the call to
.validate() somewhere near the beginning of the action - remember, the
call to .write() just afterward is completely optional; I had it in
there for testing and have kept it in there for the same reason.<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;</div>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div bgcolor="#ffffff" text="#000000">Does PYTHONPATH apply in Win
XP? I haven't played at the level of paths
for a long time in any OS. We can worry about an install "package"
later for the modules. It might be best for the users of this program. <br>
    </div>
  </blockquote>
  <div><br>
Ya know, I have no idea anymore.&nbsp; I thought I knew - but I just did a
SET from a command prompt, and I don't have a PYTHONPATH variable.&nbsp; I
seem to reacall something from a year or two ago... (looking now)&nbsp; Oh
yes - there's a directory under your Python directory (Python25 in my
case) called "Lib", and a folder under that called "site-packages"; any
text files with the extension ".pth" will be scaned for the names of
folders to add to the search path.&nbsp; As much as I love Python, I wish
they'd get all this together...<br>
  <br>
  </div>
  </div>
-- <br>
  <a moz-do-not-send="true" href="http://www.fsrtechnologies.com">www.fsrtechnologies.com</a><br>
  <pre wrap=""><pre wrap="">
<hr size="4" width="90%">
_______________________________________________
Tutor maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:Tutor@python.org">Tutor@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a>
</pre></pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta content="text/html;" http-equiv="Content-Type">
<title>Signature.html</title>
<pre class="moz-signature" cols="76">           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)
<font color="#330099">            </font>
<span style="font-weight: bold;"></span><b><b
 style="color: rgb(204, 51, 204);" class="b"><span
 style="color: rgb(255, 153, 255);"></span><span
 style="font-family: monospace;"></span></b></b>
                "Nature, to be commanded, must be obeyed."
                                   -- Sir Francis Bacon 
</pre>
<div style="margin-left: 40px;">
<b><b style="color: rgb(204, 51, 204);" class="b"><span
 style="font-family: monospace;"></span></b></b></div>
<pre class="moz-signature" cols="76"><b><b
 style="color: rgb(204, 51, 204);" class="b"><span
 style="font-family: monospace; color: rgb(153, 51, 153);"></span></b></b><b
 style="color: rgb(204, 51, 204);" class="b"><span
 style="font-family: monospace; color: rgb(153, 51, 153);"></span></b><span
 style="color: rgb(153, 51, 153);"></span><span
 style="color: rgb(153, 51, 153);">
</span><span style="color: rgb(153, 51, 153);"></span><b
 style="color: rgb(204, 51, 204);" class="b"><span
 style="font-family: monospace;"></span></b><span
 style="color: rgb(204, 51, 204);"></span>                    Web Page: &lt;<a class="moz-txt-link-abbreviated" href="http://www.speckledwithstars.net/">www.speckledwithstars.net/</a>&gt;</pre>
</div>
</body>
</html>