Title: Signature.html
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.  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.

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.  I'll try wxPython.

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.

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.  Anyway, here's the question.  Where is the syntax for items like boolean,  integer, and others described?  The doc I have barely refers to them.

Off to find wx...

Marc Tompkins wrote:
On Wed, Feb 18, 2009 at 7:42 PM, Wayne Watson <sierra_mtnv...@sbcglobal.net> wrote:
I took your "starter" code, and formatted it to be what I hope is an acceptable program, Gobal_Config.py. See attached.  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:
  ...
  File "C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\configobj.py", line 1637, in _parse
    ParseError, infile, cur_index)
  File "C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\configobj.py", line 1748, in _handle_error
    raise error
ParseError: Invalid line at line "1".

As far as I can tell, line 1 of config.obj looks OK. It's a comment. Something is amiss.

I hate to say it, but IDLE is really holding you back.  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...  I use wxPython for my GUI goodness, and swear by SPE (Stani's Python Editor).  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.

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...) 
First error:
    if argv is None:
       argv = sys.argv  <<== you haven't imported "sys"

Second error:
    app = MyApp(0)  <<== you haven't defined a class called "MyApp", so you can't do this...

So I cut it down to just this bit:
test = Global.cfgFile.validate(Global.vtor, copy=True)
Global.cfgFile.write()

(unindented all the way to the left, so that it executes as the main body of the program) and it works just fine... except:
Third error (well, issue not error):
Take all my comments out!  They weren't meant to be included in final code.  ConfigObj allows inline comments in your config file, and in the configspec - so my comments show up in there too.  Here's what Initial.sen ends up looking like:

mask_file_name = None
gray_scale = True
post_event_stack = False
post_event_format = Tiff 2
show_real_time = False
hourly_rate = 0
slowdown = 1    # I don't know what
#               this value is/does, so this is probably wrong
start_time = 00:00:00    # or you could make the default None?
stop_time = 00:00:00
    #               as a default latitude, if any...
I've cut everything down; I'm attaching it as Global_Config1.py (just to avoid confusion with the earlier version).  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.
   
 
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.

Ya know, I have no idea anymore.  I thought I knew - but I just did a SET from a command prompt, and I don't have a PYTHONPATH variable.  I seem to reacall something from a year or two ago... (looking now)  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.  As much as I love Python, I wish they'd get all this together...

--
www.fsrtechnologies.com

_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

--


           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)
            

                "Nature, to be commanded, must be obeyed."
                                   -- Sir Francis Bacon 

                    Web Page: <www.speckledwithstars.net/>
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to