Re: Who's on First, IDLE or pythonWin? Dialog Problem?

2009-02-11 Thread W. eWatson



The two separate loops being PyWin (which uses MFC) and your program
(which uses Tkinter). You just can't mix GUIs in the same process like
that, sorry.

regards
 Stedve
--
Steve Holden+1 571 484 6266   +1 800 494 3119
Holden Web LLC  http://www.holdenweb.com/


Deja-vu!

http://mail.python.org/pipermail/python-list/2001-March/076069.html

The question now is what can I do about it? reboot?

Just to re-iterate the answer I provided the answer to above, I'm using 
Tkinter for the program's GUI.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Who's on First, IDLE or pythonWin? Dialog Problem?

2009-02-11 Thread W. eWatson

So, how do I get rid of it? reboot?


Just to re-iterate the I provided the question to above, I'm using Tkinter 
for the program's GUI.



--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Who's on First, IDLE or pythonWin? Dialog Problem?

2009-02-11 Thread W. eWatson
It looks like I got an accidentally case of send message 3 times. Well, 
here's a correct below.

The question now is what can I do about it? reboot?

Just to re-iterate the answer I provided to *the question to a post above*, I'm using 
Tkinter for the program's GUI.





--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter w.pack()?

2009-02-07 Thread W. eWatson

MRAB wrote:

W. eWatson wrote:

...
I thought some months ago, I found Google commands that would operate 
in the browser link window. Guess not.


BTW, isn't there an O'Reilly book on Google hacks of this sort? Where 
else does one find out about these Google tools?



Google? :-)

http://www.google.com/support/websearch/bin/answer.py?hl=enanswer=136861

Thanks. I may have that book marked from many, many months ago. If so, I see 
why I'd never find it. The BM entry does not show Google. It does now. ;-)


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter w.pack()?

2009-02-06 Thread W. eWatson

...



The use of letmegooglethatforyou (not my video tool, by the way) is to
point out that with the right search string you could have answered the
question for yourself.

Since you didn't appear to know that Google allowed you to search a
single site (something I perhaps take for granted) I am glad that point
wasn't lost. Yes, you can just search the PIL documentation. Isn't the
Internet great? ;-)

regards
 Steve

Yes, I agree on the internet, and I now see letme...com. So, I've now tried 
in my browser's link window:
site:effbot.org/tkinterbook tkfiledialog, and get site is not a registered 
protocol.


If I put the site:... in the Google window,it works fine. In fact it's 
quite clever.


I thought some months ago, I found Google commands that would operate in the 
browser link window. Guess not.


BTW, isn't there an O'Reilly book on Google hacks of this sort? Where else 
does one find out about these Google tools?


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter w.pack()?

2009-02-01 Thread W. eWatson

Steve Holden wrote:

W. eWatson wrote:

Steve Holden wrote:

W. eWatson wrote:

r wrote:

On Jan 28, 10:12 pm, W. eWatson notval...@sbcglobal.net wrote:

Where in the world is a description of pack() for Tkinter widgets?
Is it
some sort of general method for all widgets? I'm looking in a few
docs that
use it without ever saying where it is described. For one,
http://effbot.org/tkinterbook/label.htm. In the NM Tech pdf on
Tkinter,
it's not found anywhere. I see Universal methods for widgets, but no
mention
of pack(). package, packed, but no pack.

did you try here :)
http://effbot.org/tkinterbook/pack.htm

Thanks. I have the site bookmarked, but it's hard to search. I posted a
comment to them that they should have it in pdf form.


http://letmegooglethatforyou.com/?q=site%3Aeffbot.org%2Ftkinterbook+pack

regards
 Steve

Well, that's an interesting link. Another side of Google facilities?
Maybe you're using Snagit or its brethern? However, I'm interested in
searching a pdf, which, of course, doesn't yet exist.


OK, someone asked if you'd seen the HTML pages. You replied that you had
them bookmarked but they were difficult to search. So I simply
demonstrated that a search of the site for pack gave the right page as
its first result.

Maybe you *do* want a PDF, but it will be less searchable than the
existing HTML, so I am somewhat confused about why.

regards
 Steve
So what are you telling me? I should use Google to search the web site? If 
so, I guess I missed the method you used. Apparently, it hinges on the key 
site: The use of your video tool camouflaged your intent, IMHO.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter w.pack()?

2009-01-31 Thread W. eWatson

Steve Holden wrote:

W. eWatson wrote:

r wrote:

On Jan 28, 10:12 pm, W. eWatson notval...@sbcglobal.net wrote:

Where in the world is a description of pack() for Tkinter widgets? Is it
some sort of general method for all widgets? I'm looking in a few
docs that
use it without ever saying where it is described. For one,
http://effbot.org/tkinterbook/label.htm. In the NM Tech pdf on
Tkinter,
it's not found anywhere. I see Universal methods for widgets, but no
mention
of pack(). package, packed, but no pack.

did you try here :)
http://effbot.org/tkinterbook/pack.htm

Thanks. I have the site bookmarked, but it's hard to search. I posted a
comment to them that they should have it in pdf form.


http://letmegooglethatforyou.com/?q=site%3Aeffbot.org%2Ftkinterbook+pack

regards
 Steve
Well, that's an interesting link. Another side of Google facilities? Maybe 
you're using Snagit or its brethern? However, I'm interested in searching a 
pdf, which, of course, doesn't yet exist.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter w.pack()?

2009-01-31 Thread W. eWatson

Gabriel Genellina wrote:
En Thu, 29 Jan 2009 14:55:13 -0200, W. eWatson notval...@sbcglobal.net 
escribió:

Gabriel Genellina wrote:
En Thu, 29 Jan 2009 02:57:04 -0200, W. eWatson 
notval...@sbcglobal.net escribió:



The word pack doesn't exist on the NMT pdf. Maybe there's a newer one?

 There is a PDF version of An Introduction to Tkinter here:
http://www.pythonware.com/library/

Thanks. I have it but it's an odd one to search on pack(. There may 
be over 100 reference to pack(. It's probably explained there 
somewhere, but how many times do I want to press the search key? I 
have it printed out too. I guess I need to eyeball it. It's probably 
faster. Maybe find the section (geometry?) where it and others like it 
are found. There is an index, but it's a pitiful one page.


Uh? The very first occurence of pack is in the Table of Contents, The 
pack geometry manager. (You may want to improve your search skills :) )


Yes, that's correct, but I was looking for pack(. It all depends on one's 
perspective on how to search. I'll not labor the point.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Python Doc 2.6 vs 2.5--A Matter of Format?

2009-01-31 Thread W. eWatson
I see http://www.python.org/doc/2.5/ for 2.5 and http://docs.python.org/ 
for 2.6. I'm guessing these two pages differ somewhat in formats simply 
because someone decided to do so, and not that I'm in the wrong place for 
each of the two versions, correct? For example, somewhere down in the 2.5, I 
should find the 2.6 equivalent of http://docs.python.org/genindex.html?

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter w.pack()?

2009-01-29 Thread W. eWatson

Gabriel Genellina wrote:
En Thu, 29 Jan 2009 02:57:04 -0200, W. eWatson notval...@sbcglobal.net 
escribió:



The word pack doesn't exist on the NMT pdf. Maybe there's a newer one?


There is a PDF version of An Introduction to Tkinter here:
http://www.pythonware.com/library/

Thanks. I have it but it's an odd one to search on pack(. There may be 
over 100 reference to pack(. It's probably explained there somewhere, but 
how many times do I want to press the search key? I have it printed out too. 
I guess I need to eyeball it. It's probably faster. Maybe find the section 
(geometry?) where it and others like it are found. There is an index, but 
it's a pitiful one page.


Found in Chapter 34.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter w.pack()?

2009-01-29 Thread W. eWatson

r wrote:

On Jan 28, 10:57 pm, W. eWatson notval...@sbcglobal.net wrote:

The word pack doesn't exist on the NMT pdf. Maybe there's a newer one?


Only the grid manager is discussed at NMT. I just like how at NMT the
widget attributes are in a table and then a list the widget methods
follows below that -- much better navigation.

I talked again to John at NMT and he assured me very soon he's going
to make all the updates. It would probably help if you sent him a nice
message of encouragement like -- 'Can you please update the
documentation, i really like the sites layout?' -- but please don't
forget to thank him for all his contributions to the Python community.

I am currently crusading to have all the old Python tuts and
documentation updated(among other crusades). This was my second win
and i hope that more will follow. The python docs out there need a
dusting off and spit shining.

I fully agree with your assessment of their state.

I might not want him to update the NMT. :-) Why would that be. I just had it 
printed. Another $8! I'm kidding, of course.


Not only is it a good layout, I think it's the best layout out there, IMHO. 
I'll contact him. I think one of his other pdf files needs updating too. 
Possibly the one for PIL.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Drawing and Displaying an Image with PIL

2009-01-28 Thread W. eWatson

r wrote:

Change this line:
draw.line((0,0),(20,140), fill=128)

To This:
draw.line((0,0, 20,140), fill=128)

And you should be good to go. Like you said, if you need to combine 2
tuples you can do:
(1,2)+(3,4)
Yes, that's true, but the big question is how to see the final image? 
Either one employees another module or writes the file into a folder, then 
displays it with a paint program?


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Drawing and Displaying an Image with PIL

2009-01-28 Thread W. eWatson

Peter Otten wrote:

W. eWatson wrote:


r wrote:

Change this line:
draw.line((0,0),(20,140), fill=128)

To This:
draw.line((0,0, 20,140), fill=128)

And you should be good to go. Like you said, if you need to combine 2
tuples you can do:
(1,2)+(3,4)

Yes, that's true, but the big question is how to see the final image?
Either one employees another module or writes the file into a folder, then
displays it with a paint program?


For debugging purposes you can just invoke the show() method

im = Image.open(...)
# modify image
im.show() 


If you want to integrate the image into your own Tkinter program -- that is
explained here:

http://effbot.org/tkinterbook/photoimage.htm

Following these instruction you code might become

import Tkinter as tk
import Image
import ImageTk
import ImageDraw
import sys

filename = sys.argv[1]
im = Image.open(filename)

draw = ImageDraw.Draw(im)
draw.line((0, 0) + im.size, fill=128)
draw.line(((0,0),(20,140)), fill=128)


root = tk.Tk()
pi = ImageTk.PhotoImage(im)
label = tk.Label(root, image=pi)
label.pack()
root.mainloop()

Peter
My initial quest was to do it in PIL. That seems impossible, and the way out 
is Tkinter. I'm not yet savvy enough with Pythons graphics. I was definitely 
leaning towards PhotoImage as the way out. What module is show in?


Repairing my (0,0), ... to (0,0)+, and. replacing arg with ImageOPen, 
produces a correct solution.


My NM Tech pdf misses the boat on PhotoImage. I've seen your reference 
before, but never looked at PhotoImage. I'll bookmark it. I sure wish it was 
in pdf format.


Thanks.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Tkinter w.pack()?

2009-01-28 Thread W. eWatson
Where in the world is a description of pack() for Tkinter widgets? Is it 
some sort of general method for all widgets? I'm looking in a few docs that 
use it without ever saying where it is described. For one, 
http://effbot.org/tkinterbook/label.htm. In the NM Tech pdf on Tkinter, 
it's not found anywhere. I see Universal methods for widgets, but no mention 
of pack(). package, packed, but no pack.


While I'm at it, what is w in the result of w = Label(parent, image=photo)? 
Just a widget pointer, address?

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter w.pack()?

2009-01-28 Thread W. eWatson

r wrote:

On Jan 28, 10:12 pm, W. eWatson notval...@sbcglobal.net wrote:

Where in the world is a description of pack() for Tkinter widgets? Is it
some sort of general method for all widgets? I'm looking in a few docs that
use it without ever saying where it is described. For one,
http://effbot.org/tkinterbook/label.htm. In the NM Tech pdf on Tkinter,
it's not found anywhere. I see Universal methods for widgets, but no mention
of pack(). package, packed, but no pack.


did you try here :)
http://effbot.org/tkinterbook/pack.htm
Thanks. I have the site bookmarked, but it's hard to search. I posted a 
comment to them that they should have it in pdf form.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Tkinter w.pack()?

2009-01-28 Thread W. eWatson

r wrote:

To expand on this there exists three geometry mangers [grid, pack,
place]. I personally use pack() the most, grid() almost never, and
place -- well never. But each one has it's strengths and weaknesses.

w.grid()
http://effbot.org/tkinterbook/grid.htm

w.place()
http://effbot.org/tkinterbook/place.htm



There seems to be a pattern here. :-)

Everything you need to know about Tkinter exists here:
http://effbot.org/tkinterbook/

and at the NMT site i showed you before

The word pack doesn't exist on the NMT pdf. Maybe there's a newer one?

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Drawing and Displaying an Image with PIL

2009-01-27 Thread W. eWatson

Here's my program:

# fun and games
import Image, ImageDraw

im = Image.open(wagon.tif) # it exists in the same Win XP
# folder as the program
draw = ImageDraw.Draw(im)
draw.line((0, 0) + im.size, fill=128)
draw.line((0,0),(20,140), fill=128)

# How show this final image on a display?

root.mainloop()

It has two problems. One is it crashes with:
draw.line((0,0),(20,140), fill=128)
TypeError: line() got multiple values for keyword argument 'fill'

Secondly, it has no way to display the image drawn on. Is it possible, or do 
I have to pass the image off to another module's methods?



--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Drawing and Displaying an Image with PIL

2009-01-27 Thread W. eWatson

r wrote:

On Jan 27, 9:15 pm, W. eWatson notval...@sbcglobal.net wrote:

Here's my program:

# fun and games
import Image, ImageDraw

im = Image.open(wagon.tif) # it exists in the same Win XP
# folder as the program
draw = ImageDraw.Draw(im)
draw.line((0, 0) + im.size, fill=128)
draw.line((0,0),(20,140), fill=128)

# How show this final image on a display?

root.mainloop()

It has two problems. One is it crashes with:
 draw.line((0,0),(20,140), fill=128)
TypeError: line() got multiple values for keyword argument 'fill'

Secondly, it has no way to display the image drawn on. Is it possible, or do
I have to pass the image off to another module's methods?

--
W. eWatson

  (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
   Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

 Web Page: www.speckledwithstars.net/


I have not tried your code but i think you need to put your coodinates
in one tuple. Here is an example from the docs

Example
Example: Draw a Grey Cross Over an Image
import Image, ImageDraw
im = Image.open(lena.pgm)
draw = ImageDraw.Draw(im)
draw.line((0, 0) + im.size, fill=128)
draw.line((0, im.size[1], im.size[0], 0), fill=128)
del draw
# write to stdout
im.save(sys.stdout, PNG)

Hope that helps
That's pretty much the code I used. In fact, I borrowed it from the pdf. I 
just tried it, and it output %PNG.


I'd like to see this displayed in a window. If the fine had written 
properly, I could see whether it really drew the lines. It did not fail on 
the same draw stmts in my program.


I see my problem, , instead of + between the tuples. I thought I'd seen 
another example where the 2-d tuples could be separated.


I see a ImageFile module, but it's not for writing image files simply.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: What is intvar? [Python Docs]

2009-01-26 Thread W. eWatson

r wrote:

W. eWatson,

I contacted the author of New Mexico Techs Introduction to Tkinter a
couple of weeks ago. He is going to update the reference material with
a few missing widgets and some info on Photo and Bitmap classes. I
really love the NMT layout and use it quite often. Fredricks
Tkinterbook is more detail but lacking in navigation. I swing back and
forth between both sites.





Good. Thanks. I think Lundh might have taken his material to book form.

I might be repeating myself here, but If anyone has pdf experience, and 
could provide page numbers and maybe a TOC for some of Lundh's 
contributions, that would be helpful.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: What is intvar?

2009-01-25 Thread W. eWatson

Steve Holden wrote:

W. eWatson wrote:

W. eWatson wrote:

r wrote:

here is a good explanation of control vars:
http://infohost.nmt.edu/tcc/help/pubs/tkinter/control-variables.html

Here are 3 great Tkinter refernces in order:
http://infohost.nmt.edu/tcc/help/pubs/tkinter/
http://effbot.org/tkinterbook/
http://www.pythonware.com/library/tkinter/introduction/

Thanks to all for the reference and tips.


tkinterbook is easy to follow, but it seems to have been abandoned in
2005. Did it appear in another guise somewhere else?


There hasn't been a lot of development on Tkinter in the intervening
period. It's a mature system, so there has been no need to update the
documentation.

regards
 Steve
Unfortunately, the author seems to have stopped mid-stream. I see a fair 
number of FIXMEs in it. It looks like the New Mexico pdf is a fitting 
replacement. Perhaps Intro to Tkinter should be scrapped?


Another of the author's writings, on PIL, looks good as a pdf, but is 
missing a TOC. Maybe some pdf knowledgeable person knows how to generate one 
easily.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: What is intvar?

2009-01-24 Thread W. eWatson

W. eWatson wrote:

r wrote:

here is a good explanation of control vars:
http://infohost.nmt.edu/tcc/help/pubs/tkinter/control-variables.html

Here are 3 great Tkinter refernces in order:
http://infohost.nmt.edu/tcc/help/pubs/tkinter/
http://effbot.org/tkinterbook/
http://www.pythonware.com/library/tkinter/introduction/

Thanks to all for the reference and tips.

tkinterbook is easy to follow, but it seems to have been abandoned in 2005. 
Did it appear in another guise somewhere else?


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: What is intvar?

2009-01-23 Thread W. eWatson

r wrote:

here is a good explanation of control vars:
http://infohost.nmt.edu/tcc/help/pubs/tkinter/control-variables.html

Here are 3 great Tkinter refernces in order:
http://infohost.nmt.edu/tcc/help/pubs/tkinter/
http://effbot.org/tkinterbook/
http://www.pythonware.com/library/tkinter/introduction/

Thanks to all for the reference and tips.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


What is intvar?

2009-01-22 Thread W. eWatson
I'm looking at someone's code in which invar() is used fairly often. 
Apparently, it's a Tkinter method. Here's a use:

def body(self,master):
self.title(Display Settings)

self.colorVar = IntVar()
Radiobutton( master, text=Gray Scale,
 value=1, variable=self.colorVar).grid(row=0, sticky=W)
Radiobutton( master, text=Pseudo Color,
 value=2, variable=self.colorVar).grid(row=1, sticky=W)
...

What is the need for this use? It looks like some sort of initialization for 
a widget.


I've scoured the internet with Google, and have yet to find a simple 
explanation of what it's used for.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: ActiveState Python Together with Regular Python) ((DLE)

2009-01-12 Thread W. eWatson

John Machin wrote:

On Jan 12, 2:00 pm, W. eWatson notval...@sbcglobal.net wrote:

I installed Python 2.5 a few months ago with IDLE, and decided I'd like to
try windowpy from ActiveState. Is having both of these installed going to
cause me trouble?


What is windowpy from ActiveState? If you mean you wanted to try the
PythonWin IDE instead of IDLE, all you needed to do was go to
http://sourceforge.net/projects/pywin32/ hit the big download button
and make sure you get the 2.5 version (it's the default atm) and
install it.


Yes, I want to try the PythonWin IDE instead of IDLE. (DLE was a typo.

Is it possible to just disable the vanilla (IDLE) version? I may want to 
switch between the two. Most users of the program I'm about to modify use 
the vanilla version. At some point, I may want to go back to it to verify 
that in their world all is OK.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: ActiveState Python Together with Regular Python) ((DLE)

2009-01-12 Thread W. eWatson

John Machin wrote:

On Jan 12, 9:16 pm, W. eWatson notval...@sbcglobal.net wrote:

John Machin wrote:

On Jan 12, 2:00 pm, W. eWatson notval...@sbcglobal.net wrote:

I installed Python 2.5 a few months ago with IDLE, and decided I'd like to
try windowpy from ActiveState. Is having both of these installed going to
cause me trouble?

What is windowpy from ActiveState? If you mean you wanted to try the
PythonWin IDE instead of IDLE, all you needed to do was go to
http://sourceforge.net/projects/pywin32/hit the big download button
and make sure you get the 2.5 version (it's the default atm) and
install it.

Yes, I want to try the PythonWin IDE instead of IDLE. (DLE was a typo.

Is it possible to just disable the vanilla (IDLE) version? I may want to
switch between the two. Most users of the program I'm about to modify use
the vanilla version. At some point, I may want to go back to it to verify
that in their world all is OK.


I'll try again. All you need is (a) the official distribution of
Python 2.5 for Windows from http://www.python.org (b) the pywin32
package from the URL I gave you. Install both. Click on Start / All
Programs/ Python 2.5 and will find *BOTH* IDLE and PythonWin. You and/
or your users can use IDLE or PythonWin, only one copy of Python, no
conflicts. Why do you think you need to disable IDLE? Just don't use
it.

Once upon a time, six months ago, I asked a similar question and the answer 
was more complex. I decided to put this off until I truly needed it.


Even better than Start, for me, is that I can choose PythonWin or IDLE from 
the right-click menu which I want. I do see a choice there of Open With- 
Python. I can see it executed properly, but which 2.5 did it use?


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Where Find Activestate Python 2.5?

2009-01-11 Thread W. eWatson
I went to their site and the only choice seems 2.6. I looked around and 
found no other choices. Is it possible to get 2.5?

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Where Find Activestate Python 2.5?

2009-01-11 Thread W. eWatson

John Machin wrote:

On Jan 12, 9:55 am, W. eWatson notval...@sbcglobal.net wrote:

I went to their site and the only choice seems 2.6. I looked around and
found no other choices. Is it possible to get 2.5?


What do you see when you go to 
http://www.activestate.com/activepython/downloads/
and scroll down? I see 3.0, 2.6.1, 2.6, 2.5.2.
That's correct. If I try to get there (downloads) via starting with the home 
page (click Python tab), select ActivePython in the Community, then I see 
http://www.activestate.com/activepython/ one large icon button that takes 
me to 2.6. If instead of using the button, I select ActiveState Downloads, 
then I get to http://www.activestate.com/downloads/. I see ActivePython 
among the Developer Tools. Using that gets me to 
http://www.activestate.com/activepython/, the big download 2.6 button 
again. Nowhere did I get your url. An interesting maze.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


ActiveState Python Together with Regular Python) ((DLE)

2009-01-11 Thread W. eWatson
I installed Python 2.5 a few months ago with IDLE, and decided I'd like to 
try windowpy from ActiveState. Is having both of these installed going to 
cause me trouble?

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: WinMerge--B/W Shading of Printed Copy to Show Differences?

2008-12-17 Thread W. eWatson

W. eWatson wrote:

Jason Scheirer wrote:

On Dec 16, 3:56 pm, W. eWatson notval...@sbcglobal.net wrote:
Is there a way to highlight differences between the two files when 
printing
in b/w? Help suggests there may be some texturing, but all I see is 
color

choices.
--
W. eWatson

  (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
   Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

 Web Page: www.speckledwithstars.net/


WinMerge is written in C++ and not even remotely related to Python.
Well, yes, but it has applicability to Python (and maybe other 
languages) in that I can use it to find differences between two sets of 
code.


If not here, where? comp.lang.??? ?

Hmm, I guess no one here uses it. I did find a winmerge mailing list, so 
will work it out there.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


WinMerge--B/W Shading of Printed Copy to Show Differences?

2008-12-16 Thread W. eWatson
Is there a way to highlight differences between the two files when printing 
in b/w? Help suggests there may be some texturing, but all I see is color 
choices.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: WinMerge--B/W Shading of Printed Copy to Show Differences?

2008-12-16 Thread W. eWatson

Jason Scheirer wrote:

On Dec 16, 3:56 pm, W. eWatson notval...@sbcglobal.net wrote:

Is there a way to highlight differences between the two files when printing
in b/w? Help suggests there may be some texturing, but all I see is color
choices.
--
W. eWatson

  (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
   Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

 Web Page: www.speckledwithstars.net/


WinMerge is written in C++ and not even remotely related to Python.
Well, yes, but it has applicability to Python (and maybe other languages) in 
that I can use it to find differences between two sets of code.


If not here, where? comp.lang.??? ?

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python and Its Libraries--Who's on First?

2008-11-17 Thread W. eWatson

Chris Rebert wrote:

On Sun, Nov 16, 2008 at 9:25 PM, W. eWatson [EMAIL PROTECTED] wrote:

Is there some repository that says something like for Python 2.5 it works
with:

Win OSes: W2K, XP, Vista


For the supported OSes, check the links for the versions on
http://python.org/download/ and see whether downloads are offered for
that OS (version).


numpy vers y, matplotlib vers x. scipy z, etc.


For arbitrary third-party packages, check their websites to see which
versions are compatible with which versions of Python.

No one makes some centralized compatibility matrix for the cartesian
product of python, OS, and third-party library versions.
Probably because, as you can imagine, it would be enormously tedious.
Also, I doubt it would even be all that useful to most developers as
they simply go with whatever version of Python their package's
specific third-party libraries require, with OS compatibility being a
non-issue.

Cheers,
Chris

Thanks.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python and Its Libraries--Who's on First?

2008-11-17 Thread W. eWatson

Ben Finney wrote:

W. eWatson [EMAIL PROTECTED] writes:


Is there some repository that says something like for Python 2.5 it works with:

Win OSes: W2K, XP, Vista
numpy vers y, matplotlib vers x. scipy z, etc.


I don't understand the question.

Do you have some question about the operating system requirements of
Python? Those are documented on the Python website's About page
URL:http://www.python.org/about/.

Do you have some question about the additional requirements of some
third-party Python work? It's best to query the resources for that
specific work, e.g. its specific project website.

If you were asking about something else, it might be best to phrase it
more carefully and explicitly.


See the post by Chris R.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Win 98 with Python 2.5--matplotlib and Numpy problem

2008-11-17 Thread W. eWatson

Tino Wildenhain wrote:

W. eWatson wrote:
I'm trying to figure out why an application that both myself and a 
colleague  use gives errors when he uses it under W98. I'm using XP. 
Py 2.5 is installed on each of our machines. His first problem came with 

...


Clearly things have gone astray. Is numpy somehow not compatible with 
PY 2.5?


numpy when compiled against python2.5 is perfectly compatible with 
python2.5. However this does not tell you anything if you run an 
application compiled on recent windows on a very old one.


I guess this could be worked out but I don't know if the user base
with win98 is large enough to justify this. If you feel desperate,
you could always get the compiler and try your luck.

Otoh you collegue could just abhore the windows and use something
different on his hardware :-) With fvwm98 it would even look like :-)

HTH
Tino



Yes, taking win98 out of the picture would help. That'll likely be my next 
step in trying to solve his problem. I'm just trying to clear the air that 
it isn't the OS.


Unfortunately, when this free' app became available 2-3 years ago, they 
made the claim, simplicity or explicitly, that it would run on any Win OS. 
They really don't have the resources to keep looking back to some ancient 
win OSes. The users became driven by buying old PCs for this, and now I 
think this colleague is stuck with a problem.


Not only is the OS possibly a culprit, but buying a new OS will likely cost 
him bucks, and others. It probably gets worse for some who use this appl 
regularly. They can't update to new features as they come along. It's quite 
probably a new feature (and Win 98) are the problem. It's the first time 
they've tried to use matplotlib.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python and Its Libraries--Who's on First?

2008-11-17 Thread W. eWatson

George Sakkis wrote:

On Nov 17, 12:25 am, W. eWatson [EMAIL PROTECTED] wrote:

Is there some repository that says something like for Python 2.5 it works with:

Win OSes: W2K, XP, Vista
numpy vers y, matplotlib vers x. scipy z, etc.


http://www.catb.org/~esr/faqs/smart-questions.html#writewell
If I might state that what I like about posts like yours, is that invariably 
they are followed by someone who actually understand the question. Such is 
the case again here. See the Chris R. post.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python and Its Libraries--Who's on First?

2008-11-17 Thread W. eWatson

Let me add one more observation about your remarks.

Yesterday I had to rent a roto-tiller to put in a new section of lawn. As I 
was about to get started my neighbor dropped over and we began to chat about 
what I was doing. Finally, I said, I think it's time for me start the tiller 
up. He said, Oh, let me help. I've been working on some of these gas 
powered machines on my property for some time. He then reached down and 
started manipulating the choke, fuel and so on. 15 minutes later he still 
hadn't gotten it started. I politely said, let me call the store and see if 
they can give me instructions. He agreed, saying, Yeah, probably there's 
something wrong elsewhere.


When I came back 10 minutes later with the settings they had made, it 
started immediately. Here's my point. Sometimes misguided remarks only delay 
the solution. Sometimes they can almost stop it completely.



--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python and Its Libraries--Who's on First?

2008-11-17 Thread W. eWatson

Aahz wrote:

In article [EMAIL PROTECTED],
W. eWatson [EMAIL PROTECTED] wrote:

George Sakkis wrote:

On Nov 17, 12:25 am, W. eWatson [EMAIL PROTECTED] wrote:

Is there some repository that says something like for Python 2.5 it works with:

Win OSes: W2K, XP, Vista
numpy vers y, matplotlib vers x. scipy z, etc.

http://www.catb.org/~esr/faqs/smart-questions.html#writewell

If I might state that what I like about posts like yours, is that
invariably they are followed by someone who actually understand the
question. Such is the case again here. See the Chris R. post.


The fact that someone happened to understand your question does not
remove the onus upon you to write clearly.  You may not be so lucky next
time.

Look up the word dialectic.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Win98, Python 2.5 and plotmatlib

2008-11-16 Thread W. eWatson

W. eWatson wrote:
Has anyone gotten the combination of items in the Subject to work 
together? The pylab line here fails:


from Tkinter import *
from numpy import *
import Image
import ImageChops
import ImageTk
import time
import binascii
import tkMessageBox
import tkSimpleDialog
from pylab import plot, xlabel, ylabel, title, show, xticks, bar

It works fine in XP Pro, Py 2.5


OK, I guess no one has used pylab and Py 2.5 together, so how about just Py 
2.5 on a Win 98 machine?


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Win 98 --Is 2.4.x The last version of Python for It?

2008-11-16 Thread W. eWatson


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Win 98 with Python 2.5--matplotlib and Numpy problem

2008-11-16 Thread W. eWatson
I'm trying to figure out why an application that both myself and a colleague 
 use gives errors when he uses it under W98. I'm using XP. Py 2.5 is 
installed on each of our machines. His first problem came with matplotlib 
that pointed to the from pylab ... line below. The message ended with

 ... from matplotlib.path: import affine_transform.
Import Error. One of the library functions needed to run this application 
could not be found.


I told him to remark the line
   from pylab import plot, xlabel, ylabel, title, show, xticks, bar

My thinking was that he need not use any of the new plot facilities in the 
app. That seemed to do the trick, but then he encountered a msg that said:


Assertion failed in PROGRAN 2008/NUMPY-1.20-Win32K Superpack
...
Press Retry to Debug the application. JT must be enabled.

Clearly things have gone astray. Is numpy somehow not compatible with PY 2.5?

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Python and Its Libraries--Who's on First?

2008-11-16 Thread W. eWatson

Is there some repository that says something like for Python 2.5 it works with:

Win OSes: W2K, XP, Vista
numpy vers y, matplotlib vers x. scipy z, etc.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Win98, Python 2.5 and plotmatlib

2008-11-13 Thread W. eWatson
Has anyone gotten the combination of items in the Subject to work together? 
The pylab line here fails:


from Tkinter import *
from numpy import *
import Image
import ImageChops
import ImageTk
import time
import binascii
import tkMessageBox
import tkSimpleDialog
from pylab import plot, xlabel, ylabel, title, show, xticks, bar

It works fine in XP Pro, Py 2.5
--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Convertimg a Sequence of Images to an AVI File

2008-10-17 Thread W. eWatson
I have a file of images shot at a frame rate of 1/30th of a second. They are 
640 by 480 bytes followed immediately by up to 200 smaller images 128x128 
pixels. The software I'm using will convert this into a mov file. I'd like 
to simply take the large images out of the file and make an avi file from 
them. What in Python will help me do that?

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Convertimg a Sequence of Images to an AVI File

2008-10-17 Thread W. eWatson

W. eWatson wrote:
I have a file of images shot at a frame rate of 1/30th of a second. They 
are 640 by 480 bytes followed immediately by up to 200 smaller images 
128x128 pixels. The software I'm using will convert this into a mov 
file. I'd like to simply take the large images out of the file and make 
an avi file from them. What in Python will help me do that?

It looks like the ticket is http://pymedia.org/index.html

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Anyone Have (XP) 2.4.4 Installed and Can Check This Simple matplotlib Program?

2008-10-15 Thread W. eWatson

[EMAIL PROTECTED] wrote:

On Oct 15, 6:38 am, W. eWatson [EMAIL PROTECTED] wrote:

I'm going to try another stab at this problem again. I'd like someone with
2.4.4 and  matplotlib-0.98.3.win32-py2.4exe to try it (below).


IMHO an important detail of your configuration is missing. What's your
numerical library? Did you install a Win32 distribution including a
numerical library (which?), or which package do you have installed
separately?

In general I've used matplotlib with every Python version between 2.2
and 2.5 (inclusive) on Win32 without problem, but the separate
installation
was sometimes a problem.

Regards,
Peter

I'm pretty new to Python, so how do I find the versions? I see IDLE provides 
a path browser. Can it tell me? I see various items in a tree: scipy PIL, 
Numeric_headers:package, LibearAlgebra.py, numpy etc. Under 
numeric_version.py, it shows 2.4.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Installing Python 2.4 over 2.4?

2008-10-14 Thread W. eWatson

Terry Reedy wrote:

Steve Holden wrote:

W. eWatson wrote:

I suspect something has been corrupted in Python 2.4. Can I just
re-install on top of it, and still expect to have scipy and other pkgs
I've installed?


On Windows, certainly - you can even uninstall and reinstall and retain
your installed libraries. On Linux I am pretty sure the same is true,
but caveat emptor.


In Windows, at least, micro version upgrades are handled exactly this 
way.  When 2.5.3 comes out, for instance, the installer will replace 
python files as needed in the current directories but leave 
Python25/Lib/Site-Packages and any user-added directories alone.



That's good news. I was worried about libraries I had set up.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Installing Python 2.4 over 2.4?

2008-10-14 Thread W. eWatson

Martin v. Löwis wrote:

W. eWatson wrote:

I suspect something has been corrupted in Python 2.4. Can I just
re-install on top of it


On Windows, you shouldn't reinstall, but instead run the repair
installation, from Add and remove programs.

Regards,
Martin

Do you mean on the Win Control Panel? This is, Remove and Add?

Where do I get a repair installation?

I want to stick with the same version I have. I use Python for a program 
whose last update was for the version I have. It's since been bumped up to 
2.5, but I'm not ready for it yet.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDLE and Access Denied

2008-10-14 Thread W. eWatson

W. eWatson wrote:

Dennis Lee Bieber wrote:

On Mon, 13 Oct 2008 19:07:06 -0700, W. eWatson
[EMAIL PROTECTED] declaimed the following in comp.lang.python:

I had just finished working with IDLE, and tried to double-click on a 
py file. It produced an OK dialog with the path to the file and the 
msg access denied. All my py files act that way. I rebooted and the 
same thing continues. I copied one py program to another computer, 
and accessed it there. Python 2.4. Suggestions?


Off-hand, I'd suspect some of your mistakes in trying to get a
console to run Python programs has left the association between .py and
the Python interpreter in a mess.

Go back to the console and enter

ftype python.file

exactly -- nothing else, and see what it displays. If it looks anything
other than (change the E: to whatever your installation uses)

C:\Documents and Settings\Dennis Lee Bieberftype python.file
python.file=E:\Python24\python.exe %1 %*

then you'll need to change it... (again ensure the path is correct)

ftype python.file=E:\Python24\python.exe %1 %*


The other place to explore would be from a directory window:
Tools/Folder Options/File Types

Find PY, click [advanced], select open, click [edit]

In the Application used... box, you should see (again, adjust for
your path)

E:\Python24\python.exe %1 %* [x] use DDE
Application: Python
Topic: System

(Hmmm, I don't recall if DDE is really applicable, but that's what mine
shows).


Thanks, again, but this one mysteriously disappeared. I managed to open 
my py file into IDLE and saved it to see if that would work. It did and 
all is well.


Well, the story isn't quite over. I discovered the message appears only 
outside of Idle. However, within Idle it can read and save the file. My 
guess is that it's more likely the matplotlib install went haywire, or a 
week before this a disk failure caused the problem. By pure luck, I managed 
to restore the drive. In any case, I can still proceed.



--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Installing Python 2.4 over 2.4?

2008-10-14 Thread W. eWatson
I suspect something has been corrupted in Python 2.4. Can I just re-install 
on top of it, and still expect to have scipy and other pkgs I've installed?

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Installing Python 2.4 over 2.4?

2008-10-14 Thread W. eWatson

Martin v. Löwis wrote:

On Windows, you shouldn't reinstall, but instead run the repair
installation, from Add and remove programs.

Do you mean on the Win Control Panel? 


Yes.


This is, Remove and Add?


This question I do not understand. *What* is Remove and Add?

I'm talking about the Add or [not and] Remove Programs control
panel item (ARP). You should not remove, then add, Python, but
instead, repair it.


Where do I get a repair installation?


Launch ARP. Seek Python (wait while this list is being populated).
Select Change, then Repair Python 2.4.4.

Regards,
Martin
Ah, I see there about 5 Python parts in the ARP, and one is Python 2.4.4. 
There's a Change/Remove, and clicking on Change brings up a Python window to 
change, remove or repair. What is change? A new version?


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-14 Thread W. eWatson

Gabriel Genellina wrote:
En Sun, 12 Oct 2008 23:45:15 -0300, W. eWatson [EMAIL PROTECTED] 
escribió:


The meat of the matter is the Fatal error msg I copied below. To me it 
indicates a serious error. Maybe some developer can sort it out.


 From above post.
++
Ah, a tiny break through. I got
C:\Python24\python myprogram.py aprog.py. I copied the program to this 
folder.


I don't seem to be able to copy the window, so I see pretty much what 
I had before from a dialog that popped up, except it adds:


Fatal Python error: Pystring_InterInPlace: strings only please! -Meat!

The rest is about the run time error [, and of zippo help].

This (Pystring) seems quite relevant, but I have no idea what.
+++


Python 2.4 is almost four years old now, and unmaintained. Chances are 
the bug is already fixed. With 2.6 already released (and 3.0 soon to be) 
I think it's highly improbable any developer will show interest in this 
- in any case, almost noone will notice unless you file a bug at 
bugs.python.org


Thanks. You're probably right. I'm sort of stuck with this (2.4.4). The 
supplier of the s/w I am working on distributed it under 2.4. There are a 
number of people who are using the program, and aren't python savvy. The 
supplier has moved to 2.5. I'm trying to provide a program that will run for 
them, and probably 2.5. I find it odd though that this simple program on 
the matplotlab never got checked by someone. I suppose it's possible.


I'm giving this one more try (a new post shortly). If not, I'm dragging 
everyone up to 2.5.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Anyone Have (XP) 2.4.4 Installed and Can Check This Simple matplotlib Program?

2008-10-14 Thread W. eWatson
I'm going to try another stab at this problem again. I'd like someone with 
2.4.4 and  matplotlib-0.98.3.win32-py2.4exe to try it (below). It produces a 
runtime error, and python (IDLE) dies. If I use from the console import 
matplotlib or variations (pythonw), it fails.


I think is the final shot on this. If it won't work, I'm off to 2.5, and 
will drag some others with me who use the common program I'm trying to add a 
feature to.


Here's the code I pulled from the matplotlib site. I added finish() to it.

from pylab import *

def finish():
print; print Bye
print
raw_input('Press Enter to Quit')
sys.exit()

t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
plot(t, s, linewidth=1.0)

xlabel('time (s)')
ylabel('voltage (mV)')
title('About as simple as it gets, folks')
grid(True)
show()
finish()


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Python IDLE and Access Denied

2008-10-13 Thread W. eWatson
I had just finished working with IDLE, and tried to double-click on a py 
file. It produced an OK dialog with the path to the file and the msg access 
denied. All my py files act that way. I rebooted and the same thing 
continues. I copied one py program to another computer, and accessed it 
there. Python 2.4. Suggestions?

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Python IDLE and Access Denied

2008-10-13 Thread W. eWatson

Dennis Lee Bieber wrote:

On Mon, 13 Oct 2008 19:07:06 -0700, W. eWatson
[EMAIL PROTECTED] declaimed the following in comp.lang.python:

I had just finished working with IDLE, and tried to double-click on a py 
file. It produced an OK dialog with the path to the file and the msg access 
denied. All my py files act that way. I rebooted and the same thing 
continues. I copied one py program to another computer, and accessed it 
there. Python 2.4. Suggestions?


Off-hand, I'd suspect some of your mistakes in trying to get a
console to run Python programs has left the association between .py and
the Python interpreter in a mess.

Go back to the console and enter

ftype python.file

exactly -- nothing else, and see what it displays. If it looks anything
other than (change the E: to whatever your installation uses)

C:\Documents and Settings\Dennis Lee Bieberftype python.file
python.file=E:\Python24\python.exe %1 %*

then you'll need to change it... (again ensure the path is correct)

ftype python.file=E:\Python24\python.exe %1 %*


The other place to explore would be from a directory window:
Tools/Folder Options/File Types

Find PY, click [advanced], select open, click [edit]

In the Application used... box, you should see (again, adjust for
your path)

E:\Python24\python.exe %1 %* 
[x] use DDE

Application: Python
Topic: System

(Hmmm, I don't recall if DDE is really applicable, but that's what mine
shows).


Thanks, again, but this one mysteriously disappeared. I managed to open my 
py file into IDLE and saved it to see if that would work. It did and all is 
well.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread W. eWatson
I copied the following code from a matplotlib tutorial, and it fails. I'm 
using python 2.4 on Win XP. It's matplotlib-0.98.3.win32-py2.4exe. It fails 
in IDLE with a small window showing a runtime error. Clicking the OK on it 
kills IDLE and the shell. If I double-click on the py file, the console 
briefly appears too quickly to notice any contents. I have read raw to stop 
it. If I execute it from a console window, I'm told the results will be 
available there. I've long forgotten how to get a console window up in Win 
XP. I can strip it all the code way down to the from, and it will fail the 
same way. Bad matplotlib install? Python error?


Here's the code. I added finish() to it.

from pylab import *

def finish():
print; print Bye
print
raw_input('Press Enter to Quit')
sys.exit()

t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
plot(t, s, linewidth=1.0)

xlabel('time (s)')
ylabel('voltage (mV)')
title('About as simple as it gets, folks')
grid(True)
show()
finish()



--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread W. eWatson

Dennis Lee Bieber wrote:

On Sun, 12 Oct 2008 11:24:32 -0700, W. eWatson
[EMAIL PROTECTED] declaimed the following in comp.lang.python:


available there. I've long forgotten how to get a console window up in Win 
XP. I can strip it all the code way down to the from, and it will fail the 
same way. Bad matplotlib install? Python error?



Well, in my case, I always put a copy of the XP Command Prompt
shortcut on the start menu, customized for my tastes (font
size/rows/columns). Lacking that, you should find it under:
start/programs/accessories/command prompt. You could also do start/run
and type cmd.

As for IDLE (which I don't use) -- possibly some conflict between
its graphics system and that of matplotlib...



Here's the code. I added finish() to it.



Runs okay on my system when started from PythonWin, but I'm likely
behind current

PythonWin 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)]
on win32.

ActivePython 2.4.3 Build 12 (ActiveState Software Inc.) based on
Python 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)] on
win32

*** Installation started 2007/03/15 21:31 ***
Source: C:\Documents and Settings\All
Users\Documents\matplotlib-0.90.0.win32-py2.4.exe

Let me archive my site-packages directory, and then locate a newer
matplotlib (hmmm, might need to get a newer numpy too){This is getting
nasty -- my numpy had been an egg, and the new installer is an .exe}

Okay -- matplotlib-0.98.3 and numpy-1.2.0 superpack installed...
Trying your code in a fresh PythonWin

Nope... That runs too (this time the left/right navigation arrows
displayed, but the pop-up help over the buttons wasn't).

And -- I just noticed, it IS using tk for plotting, and IDLE is also
tk; good place for conflicting event loops.


Thanks.

Oddly when I use cmd, it gets me to settings and docs. If I try c:\whatever 
I get a msg, and it remains in the same folder.


I guess PythonWin is a download for another IDE than IDLE. Will modules be 
available like mathplotlib if I install it, or do I have to establish them 
for it? I'll look PythonWin once I get past the cmd operation.




--
http://mail.python.org/mailman/listinfo/python-list


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread W. eWatson

Dennis Lee Bieber wrote:

On Sun, 12 Oct 2008 12:56:26 -0700, W. eWatson
[EMAIL PROTECTED] declaimed the following in comp.lang.python:


Oddly when I use cmd, it gets me to settings and docs. If I try c:\whatever 
I get a msg, and it remains in the same folder.


That's likely the defined home directory on your machine.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Dennis Lee Biebercd c:\bin

C:\bine:

E:\cd UserData\Dennis Lee Bieber\My Documents\Python Progs

E:\UserData\Dennis Lee Bieber\My Documents\Python Progsdir
 Volume in drive E is Data
 Volume Serial Number is 2626-D991

 Directory of E:\UserData\Dennis Lee Bieber\My Documents\Python Progs

08/23/2008  01:26 PMDIR  .
08/23/2008  01:26 PMDIR  ..
08/23/2008  01:26 PM 1,089 azel_interp.py
04/22/2007  04:43 PM 1,622 binadd.py
04/22/2007  06:03 PM 1,485 binadd2.py
12/11/2006  10:21 PM   119,889 BookList.zip
snipped
06/13/2008  08:46 PM 1,929 timing.py
11/03/2007  10:31 PM56 trips.dat
03/31/2006  11:31 PM10 update_log
11/30/2005  10:11 AM   104 ut_00.py
 112 File(s)397,123,218 bytes
   2 Dir(s)  270,550,671,360 bytes free

E:\UserData\Dennis Lee Bieber\My Documents\Python Progs

	NOTE: to change directory you need to enter the command: 
			cd new-directory

Without the cd your entry is being treated as the path to an
executable program -- and directories, of course, are not executable. To
change to a different partition/drive, you do enter just the drive
letter and a colon. And you need to do that separately -- each drive
maintains a current directory

E:\UserData\Dennis Lee Bieber\My Documents\Python Progscd c:\bin

E:\UserData\Dennis Lee Bieber\My Documents\Python Progsdir
 Volume in drive E is Data
 Volume Serial Number is 2626-D991

 Directory of E:\UserData\Dennis Lee Bieber\My Documents\Python Progs

snipped

E:\UserData\Dennis Lee Bieber\My Documents\Python Progsc:

C:\bin

Notice how changing drive to C: put me into the bin directory
specified earlier. If I now enter e:, I'll be back to the Python Progs
directory.

I guess PythonWin is a download for another IDE than IDLE. Will modules be 
available like mathplotlib if I install it, or do I have to establish them 
for it? I'll look PythonWin once I get past the cmd operation.



It comes supplied with the ActiveState Python download (which also
includes the win32 extensions). I believe it can also be obtained as a
stand-alone with the win32 stuff.

The win32 extensions are: 
http://sourceforge.net/project/platformdownload.php?group_id=78018 (just

checked, PythonWin is included)
I worked my way into the folder where the py program is, but couldn't 
executed. Just entering aprog.py, run aprog.py or exec aprog.py didn't work.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread W. eWatson

John Machin wrote:

On Oct 13, 9:07 am, W. eWatson [EMAIL PROTECTED] wrote:


I worked my way into the folder where the py program is, but couldn't
executed. Just entering aprog.py, run aprog.py or exec aprog.py didn't work.


One wouldn't expect the run or the exec to work.

Try these in this order:
python aprog.py
\python24\python aprog.py
c:\python24\python aprog.py

and instead of didn't work, tell us what message you get. Also
consider telling us where your Python 2.4 is installed, and what you
see when you execute the PATH command.

The first one requires a compile program.
The second required a path, probably back to my c-drive
The third one is too ghastly to think about, unless I move aprog.py to the 
python folder.


I think I'll compile it and try.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread W. eWatson

Dennis Lee Bieber wrote:

On Sun, 12 Oct 2008 15:07:57 -0700, W. eWatson
[EMAIL PROTECTED] declaimed the following in comp.lang.python:


I worked my way into the folder where the py program is, but couldn't 
executed. Just entering aprog.py, run aprog.py or exec aprog.py didn't work.


Try:
python aprog.py

If that doesn't work, you'll need to check your environment variable
PATH to make sure the directory with the python interpreter is on it...
(I've added spaces and/or newlines after the ; to make for easier
reading)

Path=E:\Python24\; E:\GNAT\2008\bin; C:\WINDOWS\system32; C:\WINDOWS;
C:\WINDOWS\System32\Wbem; C:\Program Files\SciTE; 
C:\Program Files\Java\jre1.6.0_03\bin; 
C:\Program Files\Java\jdk1.6.0_03\bin; 
C:\Program Files\Common Files\Adobe\AGL; C:\Tcl\bin;

C:\Program Files\Common Files\Roxio Shared\9.0\DLLShared\;
C:\Program Files\Common Files\Roxio Shared\DLLShared\;
C:\PROGRA~1\MySQL\MySQL Server 5.0\bin;
C:\Program Files\TortoiseSVN\bin; E:\GNAT\GtkAda\bin; C:\MSSQL7\BINN;
c:\PROGRA~1\sdb\programs\bin; c:\PROGRA~1\sdb\programs\pgm; c:\Regina;
e:\Python24\Scripts

It IS possible to set an association so that *.py will invoke python
as the processor. Part of is the environment variable pathext...

PATHEXT=.COM;.EXE;.BAT;.pyw;.py;.pyo;.pyc;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.tcl

But I think something else was required... Ah

FTYPE Python.File=E:\Python24\python.exe %1 %*



I entered at the H:\..\python_dev\ prompt
FTYPE Python.File=C:\Python24\python.exe aprog.py
but nothing happened. Nothing at all in the console window other than it 
still shows the folder path in the prompt. Well not quite. It just responded 
with python.exe aprog.py.


Is there some way to copy in and out of the console. A copy/paste seems to 
get nowhere.


It's odd that I cannot widen the console window. It shows --- when I grab 
a side.


Maybe I'll compile the code, as suggested by a poster above. I don't think 
IDLE will do that, but I can probably find something that will.


Ah, I found py2exe and installed it. It shows up nowhere in my Start-All 
Programs. It may be in the list under Python. I see a command line entry off 
that men. I don't think it was there. Off for more exploring.



--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread W. eWatson

Ah, a tiny break through. I got
C:\Python24\python myprogram.py aprog.py. I copied the program to this folder.

I don't seem to be able to copy the window, so I see pretty much what I had 
before from a dialog that popped up, except it adds:
Fatal Pyton error: Pystring_InterInPlace: strings only please! The rest is 
about the run time error.

This (Pystring) seems quite relevant, but I have no idea what.







--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Pylab Fails with Runtime Error on Win XP Under Python 2.4

2008-10-12 Thread W. eWatson
Thanks for the help, but I'm bowing out of this graphics problem. This 
should have been a snap, but has turned into a detour. I'll get back to the 
 python program I was considering for it, and just work without the scatter 
plot. It's easily done. It would just look prettier in a plot.


The meat of the matter is the Fatal error msg I copied below. To me it 
indicates a serious error. Maybe some developer can sort it out.


From above post.
++
Ah, a tiny break through. I got
C:\Python24\python myprogram.py aprog.py. I copied the program to this folder.

I don't seem to be able to copy the window, so I see pretty much what I had 
before from a dialog that popped up, except it adds:


Fatal Python error: Pystring_InterInPlace: strings only please! -Meat!

The rest is about the run time error [, and of zippo help].

This (Pystring) seems quite relevant, but I have no idea what.
+++
--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Correcting for Drift between Two Dates

2008-09-09 Thread W. eWatson

Steven D'Aprano wrote:

On Mon, 08 Sep 2008 21:53:18 -0700, W. eWatson wrote:


I have two dates, ts1, ts2 as below in the sample program. I know the
clock drift in seconds per day. I would like to calculate the actual
date of ts2. See my question at the end of the program.



When faced with a complicated task, break it down into simpler subtasks. 
Functions are your friends. Here you go:




from __future__ import division

from datetime import datetime as DT
from datetime import timedelta

SITE_DRIFT = 4.23  # drift in seconds per day
# negative drift means the clock falls slow
SEC_PER_DAY = 60*60*24  # number of seconds per day


def calc_drift(when, base, drift=SITE_DRIFT):
Return the amount of drift at date when since date base.
x = when - base
days = x.days + x.seconds/SEC_PER_DAY
return drift*days

def fix_date(when, base, drift=SITE_DRIFT):
Return date when adjusted to the correct time.
d = calc_drift(when, base, drift)
delta = timedelta(seconds=-d)
return when + delta


And here it is in action:


fix_date(DT(2008,9,9), DT(2008,9,8))

datetime.datetime(2008, 9, 8, 23, 59, 55, 77)



I leave it to you to convert date/time strings into datetime objects.




Ah, ha. x.days and x.seconds.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list

Re: Syntax Problem with strptime in Python 2.4

2008-09-08 Thread W. eWatson

Diez B. Roggisch wrote:

W. eWatson wrote:


Apparently, use of strptime of datetime needs a workaround in Python 2.4
to work properly. The workaround is d =
datetime.datetime(*(time.strptime(date_string, format)[0:5])). However,
when I try to use it, or even use it the regular way, it fails with
AttributeError: type object 'datetime.datetime' has no attribute
'datetime'.
 From the following code code segment:

format = '%Y%m%d_%H%M%S'
#d=datetime.strptime('20080321_113405', format)-- typical use
print time.strptime('20080321_113405', format)[0:5]
d = datetime.datetime(*time.strptime('20080321_113405', format)[0:5])

Does anyone know how to make this work in 2.4? If not, is there a way to
achieve the same result?


This is not what you think it is. All your problem is that you do

from datetime import datetime

which imports the datetime-class, but then try to access

datetime.datetime

as if you had done

import datetime.


This actually is a wart in the datetime-module - it would be better if the
classes in there would follow PEP-8.

Diez

That's it. Thanks.

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Correcting for Drift between Two Dates

2008-09-08 Thread W. eWatson
I have two dates, ts1, ts2 as below in the sample program. I know the clock 
drift in seconds per day. I would like to calculate the actual date of ts2. 
See my question at the end of the program.


# time differences with addition of drift
from datetime import datetime, timedelta
import time

drift = 4.23 # seconds per day

format = '%Y%m%d_%H%M%S'
ts1 = 20080901_12   # base date-time
ts2 = 20080904_18
d1 = datetime(*(time.strptime(ts1, format)[0:6]))
d2 = datetime(*(time.strptime(ts2, format)[0:6]))
#d += timedelta(seconds=sec)
delta = d2-d1
# delta format is nnn[n] days, hh:mm:ss
# delta is type 'datetime.timedelta'
print delta
# get back to ts2 as a check
d3 = d1+d
print d3
#OK, now I need to add the total drift time between
# d1 and d2, to get the true date-time of d2.

# How do I get at the nnn and hh:mm:ss of delta so that
# I can change nnn to nnn+(fraction of day in hh:mm:ss) to
# days + fraction of day, D. I want to multiple D by drift
# to get seconds of drift in period, then add it to d2.

Results
3 days, 6:00:00
2016-09-04 18:00:00
--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Syntax Problem with strptime in Python 2.4

2008-09-08 Thread W. eWatson
Apparently, use of strptime of datetime needs a workaround in Python 2.4 to 
work properly. The workaround is d = 
datetime.datetime(*(time.strptime(date_string, format)[0:5])). However, when 
I try to use it, or even use it the regular way, it fails with

AttributeError: type object 'datetime.datetime' has no attribute 'datetime'.
From the following code code segment:

format = '%Y%m%d_%H%M%S'
#d=datetime.strptime('20080321_113405', format)-- typical use
print time.strptime('20080321_113405', format)[0:5]
d = datetime.datetime(*time.strptime('20080321_113405', format)[0:5])

Does anyone know how to make this work in 2.4? If not, is there a way to 
achieve the same result?

--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: How Compute # of Days between Two Dates?

2008-09-01 Thread W. eWatson

Grant Edwards wrote:

On 2008-09-01, W. eWatson [EMAIL PROTECTED] wrote:

That's the question in Subject. For example, the difference between 
08/29/2008 and 09/03/2008 is +5. The difference between 02/28/2008 and 
03/03/2008 is 4, leap year--extra day in Feb. I'm really only interested in 
years between, say, 1990 and 2050. In other words not some really strange 
period of time well outside our current era of history.


Does the standard library's datetime module not do what you want?

  http://docs.python.org/lib/module-datetime.html


Yes, it would seem so. This works fine.

date1 = datetime.date(2007, 2, 27)
date2 = datetime.date(2007, 3, 3)

print date1: , date1
print date2: , date2
diff = date2 - date1
print diff: , diff
result:
date1:  2007-02-27
date2:  2007-03-03
diff:  4 days, 0:00:00

I was pondering this in pyfdate, but perhaps missed it or it was not obvious 
to me in the tutorial for some reason. There are few places where it's not 
quite complete. pyfdate has some rules for dealing with length of month 
oddities that started me thinking it would have difficulty with situations 
like the above. However, it would seem any general implementation of time 
and date should be capable of making similar calculations without difficulty.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: How Compute # of Days between Two Dates?

2008-09-01 Thread W. eWatson

Grant Edwards wrote:

On 2008-09-01, W. eWatson [EMAIL PROTECTED] wrote:

Grant Edwards wrote:

On 2008-09-01, W. eWatson [EMAIL PROTECTED] wrote:

That's the question in Subject. For example, the difference between 
08/29/2008 and 09/03/2008 is +5. The difference between 02/28/2008 and 
03/03/2008 is 4, leap year--extra day in Feb. I'm really only interested in 
years between, say, 1990 and 2050. In other words not some really strange 
period of time well outside our current era of history.

Does the standard library's datetime module not do what you want?

  http://docs.python.org/lib/module-datetime.html


Yes, it would seem so. This works fine.


It would probably be worth your while to read through one of
introductory Python books or just browse through the Python
tutorial:

http://docs.python.org/tut/
Oddly, Leaning Python has no mention of datetime (not date or time), at 
least, that I could find. I'm considering the Nutshell book, 2nd ed., as a 
better reference (and cross reference) to various topics.



I was pondering this in pyfdate, but perhaps missed it or it
was not obvious to me in the tutorial for some reason.


Sorry, can't help you there -- I've never heard of pyfdate.  The
timedate module that comes with Python has always done what I
needed to do with dates/times.




--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


How Compute # of Days between Two Dates?

2008-08-31 Thread W. eWatson
That's the question in Subject. For example, the difference between 
08/29/2008 and 09/03/2008 is +5. The difference between 02/28/2008 and 
03/03/2008 is 4, leap year--extra day in Feb. I'm really only interested in 
years between, say, 1990 and 2050. In other words not some really strange 
period of time well outside our current era of history.


--
   W. eWatson

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/

--
http://mail.python.org/mailman/listinfo/python-list


Re: Date Comparison and Manipulation Functions?

2008-08-30 Thread W. eWatson

John Machin wrote:

On Aug 30, 10:41 am, W. eWatson [EMAIL PROTECTED] wrote:


What I'm trying to do is adjust date-time stamped file names for date and
time errors. The software program collects through a period that roughly
coincides with night hours every day and according to the OS clock. It
sometimes happens that a user sets the clock to the wrong day or hour,
possibly both. Possibly even the month or year. I'm trying to allow a user
the opportunity to repair the problem. (Date-time stamp part of the name is
mmdd_hhmmss.) Correcting the date needs to be done easily and
accurately. For example, if on August 25, he mistakenly sets the date to
July 25, and discovers this problem on the real Oct. 5, he should be able to
shift all dates from July 25 through Sept. 5 to Aug. 25 through early Oct.,
allowing for day oddities in a month during the period. (I hope I got those
dates right; otherwise, I think you get the idea. In other words, he needs
to shift about 40 days of data to the correct dates.)


... all of which is absolutely nothing to do with your surprise at the
result of whatever.plus(months=6).
Really? It opened new insights for me. The example above is not the only 
correction I need to deal with. Further, the author is likely to soon 
clarify some of the date rules in the tutorial that were not obvious or 
mentioned there.


So for some period from recorded date X to recorded date Y, the
recorded dates of out of kilter by D days. X = Jul 25 2008, Y Sep 5
2008, and D is 31 (days from Jul 25 to Aug 25). All you have to do is
(pseudocode):

if X = recorded_date = Y:
new_recorded_date  = recorded_date.plus(days=D)

HTH,
John




--
   W. Watson
 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

--
http://mail.python.org/mailman/listinfo/python-list


Re: Date Comparison and Manipulation Functions?

2008-08-30 Thread W. eWatson

W. eWatson wrote:

John Machin wrote:

On Aug 30, 10:41 am, W. eWatson [EMAIL PROTECTED] wrote:

What I'm trying to do is adjust date-time stamped file names for date 
and

time errors. The software program collects through a period that roughly
coincides with night hours every day and according to the OS clock. It
sometimes happens that a user sets the clock to the wrong day or hour,
possibly both. Possibly even the month or year. I'm trying to allow a 
user
the opportunity to repair the problem. (Date-time stamp part of the 
name is

mmdd_hhmmss.) Correcting the date needs to be done easily and
accurately. For example, if on August 25, he mistakenly sets the date to
July 25, and discovers this problem on the real Oct. 5, he should be 
able to
shift all dates from July 25 through Sept. 5 to Aug. 25 through early 
Oct.,
allowing for day oddities in a month during the period. (I hope I got 
those
dates right; otherwise, I think you get the idea. In other words, he 
needs

to shift about 40 days of data to the correct dates.)


... all of which is absolutely nothing to do with your surprise at the
result of whatever.plus(months=6).
Really? It opened new insights for me. The example above is not the only 
correction I need to deal with. Further, the author is likely to soon 
clarify some of the date rules in the tutorial that were not obvious or 
mentioned there.


So for some period from recorded date X to recorded date Y, the
recorded dates of out of kilter by D days. X = Jul 25 2008, Y Sep 5
2008, and D is 31 (days from Jul 25 to Aug 25). All you have to do is
(pseudocode):

if X = recorded_date = Y:
new_recorded_date  = recorded_date.plus(days=D)

HTH,
John





Strange how my post got hooked into this side spur. I'll re-post.

--
   W. Watson
 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

--
http://mail.python.org/mailman/listinfo/python-list


Re: Date Comparison and Manipulation Functions?

2008-08-30 Thread W. eWatson

John Machin wrote:

On Aug 30, 10:41 am, W. eWatson [EMAIL PROTECTED] wrote:


What I'm trying to do is adjust date-time stamped file names for date and
time errors. The software program collects through a period that roughly
coincides with night hours every day and according to the OS clock. It
sometimes happens that a user sets the clock to the wrong day or hour,
possibly both. Possibly even the month or year. I'm trying to allow a user
the opportunity to repair the problem. (Date-time stamp part of the name is
mmdd_hhmmss.) Correcting the date needs to be done easily and
accurately. For example, if on August 25, he mistakenly sets the date to
July 25, and discovers this problem on the real Oct. 5, he should be able to
shift all dates from July 25 through Sept. 5 to Aug. 25 through early Oct.,
allowing for day oddities in a month during the period. (I hope I got those
dates right; otherwise, I think you get the idea. In other words, he needs
to shift about 40 days of data to the correct dates.)


... all of which is absolutely nothing to do with your surprise at the
result of whatever.plus(months=6).
Really? It opened new insights for me. The example above is not the only 
correction I need to deal with. Further, the author is likely to soon 
clarify some of the date rules in the tutorial that were not obvious nor 
mentioned there.


So for some period from recorded date X to recorded date Y, the
recorded dates of out of kilter by D days. X = Jul 25 2008, Y Sep 5
2008, and D is 31 (days from Jul 25 to Aug 25). All you have to do is
(pseudocode):

if X = recorded_date = Y:
new_recorded_date  = recorded_date.plus(days=D)

HTH,
John




--
   W. Watson
 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

--
http://mail.python.org/mailman/listinfo/python-list


Re: Date Comparison and Manipulation Functions?

2008-08-30 Thread W. eWatson

The author has updated the Tutorial and added a flex method.

--
http://mail.python.org/mailman/listinfo/python-list


Re: Tough Guy Competition

2008-08-29 Thread W. eWatson

alex23 wrote:

On Aug 29, 3:45 pm, W. eWatson [EMAIL PROTECTED] wrote:

Something to do on your weekends. [non-related link clipped]


Another thing to do with your weekends would be to -not spam-.


Sorry, misdirected.

--
   W. Watson
 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

--
http://mail.python.org/mailman/listinfo/python-list


Re: Date Comparison and Manipulation Functions?

2008-08-29 Thread W. eWatson

I just tried the following code, and got an unexpected result.

from pyfdate import *
t = Time()

ts = Time(2008, 8, 29,15,20,7)
tnew = ts.plus(months=6)
print new date: , tnew

Result:
new date:  2009-02-28 15:20:07

I believe that should be April 1, 2009. If I use months = 1 and day =31, I 
get Sept. 30, 2008 and not Oct. 1, 2008. Is there a way to get around this?


--
   W. Watson
 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

--
http://mail.python.org/mailman/listinfo/python-list


Re: Lining Up and PaddingTwo Similar Lists

2008-08-29 Thread W. eWatson

castironpi wrote:
...



I don't think that's guaranteed by anything.  I realized that
'dat.sort()' and 'txt.sort()' weren't necessary, since their contents
are moved to a dictionary, which isn't sorted.
Actually, I'm getting the file names from listdir, and they appear to be 
sorted low to high. I tried it on a folder with lots of dissimilar files.


both= set( datD.keys() ) set( txtD.keys() )

This will get you the keys (prefixes) that are in both.  Then for
every prefix if it's not in 'both', you can report it.

Lastly, since you suggest you're guaranteed that 'txt' will all share
the same extension, you can do away with the dictionary and use sets
entirely.  Only if you can depend on that assumption.
Each dat file contains an image, and its description and related parameters 
are in the corresponding txt file.


I took a look at this.  It's probably more what you had in mind, and
the dictionaries are overkill.

...
--
http://mail.python.org/mailman/listinfo/python-list


Re: Date Comparison and Manipulation Functions?

2008-08-29 Thread W. eWatson

John Machin wrote:

On Aug 30, 2:32 am, W. eWatson [EMAIL PROTECTED] wrote:

I just tried the following code, and got an unexpected result.

from pyfdate import *
t = Time()

ts = Time(2008, 8, 29,15,20,7)
tnew = ts.plus(months=6)
print new date: , tnew

Result:
new date:  2009-02-28 15:20:07

I believe that should be April 1, 2009.


Presuming that we are talking about the Gregorian calendar, and not
one of your own invention, you are (one trusts) alone in that belief.
There are SEVEN whole months and a bit between August 29, 2008 and
April 1, 2009. Count the months: Sep, Oct, Nov, Dec, Jan, Feb, Mar.


If I use months = 1 and day =31, I
get Sept. 30, 2008 and not Oct. 1, 2008. Is there a way to get around this?


Because the number of days in a month is not constant, adding a number
of months to a date is capable of more than one interpretation. Most
folk are happy with adding the months on and then ensuring that the
day is not later than the last day of the resultant (year, month)
combination -- this is what the pyfdate routine appears to be doing.
However there are some interesting ideas floating around e.g. IIRC an
eminent personage once asserted in this newsgroup that adding 1 month
to 31 Jan in a non-leap year should produce 3 Mar.

There is also the general question with date intervals of whether the
first day is included in the calculation or not. E.g. work on Monday,
Tuesday, Wednesday: that's 3 days service. Put money into the bank on
Monday, withdraw it on Wednesday: that's likely to attract 2 days
interest.

One needs to understand exactly what calculation is required, and
exactly what calculation is provided by the software that is proposed
to be used.

HTH,

John
What I'm trying to do is adjust date-time stamped file names for date and 
time errors. The software program collects through a period that roughly 
coincides with night hours every day and according to the OS clock. It 
sometimes happens that a user sets the clock to the wrong day or hour, 
possibly both. Possibly even the month or year. I'm trying to allow a user 
the opportunity to repair the problem. (Date-time stamp part of the name is 
mmdd_hhmmss.) Correcting the date needs to be done easily and 
accurately. For example, if on August 25, he mistakenly sets the date to 
July 25, and discovers this problem on the real Oct. 5, he should be able to 
shift all dates from July 25 through Sept. 5 to Aug. 25 through early Oct., 
allowing for day oddities in a month during the period. (I hope I got those 
dates right; otherwise, I think you get the idea. In other words, he needs 
to shift about 40 days of data to the correct dates.) Or:


True calendar period: August 25 to Oct.  5
Recorded calendar period: July   25 to Sept. 5 (roughly 5)

A second function is to correct the time stamp for drift in the clock. For 
this, I'm expecting the user knows the daily drift, +/-, in seconds of the 
clock. When he decides, for example, that he's let the clock drift for more 
than, say, 120 seconds, he may want to adjust the time stamp for all files 
collected since the last time he set the clock properly. About the best 
anyone can hope for is that the data is accurate to within 4 to 5 seconds, 
so over periods of say a month between adjustments this should be OK.  The 
computers used do not have time data other than that provided by the h/w 
clock on the computer. This method is not meant to be a cure all, just to 
get the time stamp within a reasonable value. Personally, I reset the time 
about every 2-3 weeks. Problems that arise here are associated with working 
near midnight. Again, it's possible to set some time or date component 
incorrectly each time one needs to get drift under control.


The OSes involved can be Win XP, Win 2000, or even older Win OSes, varieties 
of Apple and Linux. I don't want to go below the level of the simple h/w 
clock a typical user might have access to through the OS s/w user interface. 
However, I do not need to get into OS details to solve the above problems.


There are of course times when a mistaken setting is caught early, so the 
adjustment becomes easy. Suppose the day is taken as May 3 on May 5, and two 
days later the mistake is noticed. Changing the date for these files is 
pretty easy (with the program).


Well, back to the drawing board for awhile to see how this plays against 
pyfdate.


--
   W. Watson
 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

--
http://mail.python.org/mailman/listinfo/python-list


Python in a Nutshell -- Book vs Web

2008-08-28 Thread W. eWatson
I read an Amazon of Python in a Nutshell. The first edition is supposedly 
much like the web site. What web site? The second edition apparently adds 
more to the book than the web site.

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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wild Card String Comparison

2008-08-28 Thread W. eWatson

Cameron Laird wrote:

In article [EMAIL PROTECTED],
W. eWatson [EMAIL PROTECTED] wrote:
Is it possible to do a search for a wild card string in another string. For 
example, I'd like to find v*.dat in a string called bingo. v must be 
matched against only the first character in bingo, and not simply found 
somewhere in bingo, as might be the case for *v*.dat.

.
.
.
Does this session leave any questions:

  python
  Python 2.4.4c0 (#2, Oct  2 2006, 00:57:46)
  [GCC 4.1.2 20060928 (prerelease) (Debian 4.1.1-15)] on linux2
  Type help, copyright, credits or license for more information.
   import re
   pattern = ^v.*\.dat
   compiled = re.compile(pattern)
   compiled.match(victory.dat)
  _sre.SRE_Match object at 0xb7da2c60
   ms = compiled.match(victory.dat)
   ms.group()
  victory.dat
   compiled.match(avoid.dat)
   # Notice the return value of None.
  ...
   import sys
   sys.exit()

?

Looks good. re = regular expressions.

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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Lining Up and PaddingTwo Similar Lists

2008-08-28 Thread W. eWatson
Maybe there's some function like zip or map that does this. If not, it's 
probably fairly easy to do with push and pop. I'm just checking to see if 
there's not some known simple single function that does what I want. Here's 
what I'm trying to do.


I have a list dat like (assume the items are strings even thought I'm 
omitting quotes.):

[a.dat, c.dat, g.dat, k.dat, p.dat]

I have another list called txt that looks like:
[a.txt, b.txt, g.txt, k.txt r.txt, w.txt]

What I need is to pair up items with the same prefix and use None, or some 
marker, to indicate the absence of the opposite item. That is, in non-list 
form, I want:

a.dat a.txt
None  b.txt
c.dat None
g.dat g.txt
k.dat k.txt
p.dat  None
None  r.txt
None  w.txt

Ultimately, what I'm doing is to find the missing member of pairs.
--
   Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Lining Up and PaddingTwo Similar Lists

2008-08-28 Thread W. eWatson

castironpi wrote:

On Aug 28, 10:50 pm, W. eWatson [EMAIL PROTECTED] wrote:

Maybe there's some function like zip or map that does this. If not, it's
probably fairly easy to do with push and pop. I'm just checking to see if
there's not some known simple single function that does what I want. Here's
what I'm trying to do.

I have a list dat like (assume the items are strings even thought I'm
omitting quotes.):
[a.dat, c.dat, g.dat, k.dat, p.dat]

I have another list called txt that looks like:
[a.txt, b.txt, g.txt, k.txt r.txt, w.txt]

What I need is to pair up items with the same prefix and use None, or some
marker, to indicate the absence of the opposite item. That is, in non-list
form, I want:
a.dat a.txt
None  b.txt
c.dat None
g.dat g.txt
k.dat k.txt
p.dat  None
None  r.txt
None  w.txt

Ultimately, what I'm doing is to find the missing member of pairs.
--
Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

  (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
   Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

 Web Page: www.speckledwithstars.net/


This gets you your list.  What do you mean by 'missing member of
(a.dat, a.txt) is a pair. (None, a.txt) has a.dat missing. I just need to 
issue a msg to the user that one member of a file pair is missing. Both 
files need to be present to make sense of the data.

pairs'?  If you mean, 'set of elements that appear in both' or 'set
that appears in one but not both', you can short circuit it at line
14.

-warning, spoiler-
It looks like you went beyond the call of duty, but that's fine. It looks 
like I have a few new features to learn about in Python. In particular, 
dictionaries. Thanks.


Actually, the file names are probably in order as I pick them up in XP. I 
would think if someone had sorted the folder, that as one reads the folder 
they are in alpha order, low to high.


dat= ['a.dat', 'c.dat', 'g.dat', 'k.dat', 'p.dat']
dat.sort()
txt= ['a.txt', 'b.txt', 'g.txt', 'k.txt', 'r.txt', 'w.txt']
txt.sort()
import os.path
datD= {}
for d in dat:
r,_= os.path.splitext( d )
datD[ r ]= d
txtD= {}
for d in txt:
r,_= os.path.splitext( d )
txtD[ r ]= d
both= sorted( list( set( datD.keys() )| set( txtD.keys() ) ) )

print datD
print txtD
print both

for i, x in enumerate( both ):
both[ i ]= datD.get( x, None ), txtD.get( x, None )

print both

OUTPUT:

{'a': 'a.dat', 'p': 'p.dat', 'c': 'c.dat', 'k': 'k.dat', 'g': 'g.dat'}
{'a': 'a.txt', 'b': 'b.txt', 'g': 'g.txt', 'k': 'k.txt', 'r': 'r.txt',
'w': 'w.t
xt'}
['a', 'b', 'c', 'g', 'k', 'p', 'r', 'w']
[('a.dat', 'a.txt'), (None, 'b.txt'), ('c.dat', None), ('g.dat',
'g.txt'), ('k.d
at', 'k.txt'), ('p.dat', None), (None, 'r.txt'), (None, 'w.txt')]



--
   W. Watson
 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

--
http://mail.python.org/mailman/listinfo/python-list


Tough Guy Competition

2008-08-28 Thread W. eWatson

Something to do on your weekends. http://www.toughguy.co.uk/home.shtml
--
   W. Watson
 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

--
http://mail.python.org/mailman/listinfo/python-list


Re: Date Comparison and Manipulation Functions?

2008-08-27 Thread W. eWatson

John Machin wrote:

On Aug 27, 11:24 am, W. eWatson [EMAIL PROTECTED] wrote:

John Machin wrote:

On Aug 27, 10:21 am, W. eWatson [EMAIL PROTECTED] wrote:

I'm using IDLE for Python 2.4, and put pfydate distribution in
C:\Python24\Lib\site-packages\pfydate, as required by the
ttp://www.ferg.org/pyfdate/download.html page.
How to install pyfdate.
 Save pyfdate.py into your PythonNN/Lib/site-packages directory.
I copied it into C:\Python24\Lib\site-packages\pfydate

If that means that you ended up with
   C:\Python24\Lib\site-packages\pfydate\pyfdate.py
then you have *not* followed the instructions Save pyfdate.py into
your PythonNN/Lib/site-packages directory.
You need to end up with
   C:\Python24\Lib\site-packages\pyfdate.py

None of the folders in C:\Python24\Lib\site-packages\ have py as a suffix
(as seen either by the IDLE path browser or XP). My folder is exactly
C:\Python24\Lib\site-packages\pfydate in XP and it contains about 12 py files.
There are exactly three folders under
C:\Python24\Lib\site-packages\ according to the IDLE path browser. This does
not agree with XP, which has:
Numeric
pfydate
scipy
numpy
PIL


(1) pfydate != pyfdate

typo

(2) The instructions say to put pyfdate.py [that's *ONE* file, not 12
files] in the /site-packages folder, *not* a sub-folder

Got it. Ah, I see upon closer inspection the other files are just 
international versions. Thanks. It works.


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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Wild Card String Comparison

2008-08-27 Thread W. eWatson
Is it possible to do a search for a wild card string in another string. For 
example, I'd like to find v*.dat in a string called bingo. v must be 
matched against only the first character in bingo, and not simply found 
somewhere in bingo, as might be the case for *v*.dat.

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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wild Card String Comparison

2008-08-27 Thread W. eWatson

Timothy Grant wrote:

On Wed, Aug 27, 2008 at 8:49 PM, W. eWatson [EMAIL PROTECTED] wrote:

Is it possible to do a search for a wild card string in another string. For
example, I'd like to find v*.dat in a string called bingo. v must be
matched against only the first character in bingo, and not simply found
somewhere in bingo, as might be the case for *v*.dat.
--
  Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

(121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
 Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

   Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Is this what you're looking for?


What's this?
-

Python 2.5.1 (r251:54863, Jan 17 2008, 19:35:16)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type help, copyright, credits or license for more information.

x = 'the quick brown fox'

--

'the' in x

True

'qui' in x

True

'jumped' in x

False

If that doesn't meet  your needs you may want to look at the re
module. But if you can avoid re's your likely better off.

re module??



There are no wild cards in your examples. * is one wild card symbol? 
begin*end means find begin followed by any string of characters until it 
find the three letters end.


begin here now but end it should find begin here now but end
beginning of the end is the title of a book should find beginning of the end
b egin but end this now should find nothing.


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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Wild Card String Comparison

2008-08-27 Thread W. eWatson

Sean DiZazzo wrote:

On Aug 27, 8:49 pm, W. eWatson [EMAIL PROTECTED] wrote:

Is it possible to do a search for a wild card string in another string. For
example, I'd like to find v*.dat in a string called bingo. v must be
matched against only the first character in bingo, and not simply found
somewhere in bingo, as might be the case for *v*.dat.
--
Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

  (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
   Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

 Web Page: www.speckledwithstars.net/


Check:

http://docs.python.org/lib/string-methods.html
http://docs.python.org/lib/module-re.html
http://docs.python.org/lib/module-glob.html
http://docs.python.org/lib/module-fnmatch.html

~Sean

I'll take a look.

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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Date Comparison and Manipulation Functions?

2008-08-26 Thread W. eWatson

[EMAIL PROTECTED] wrote:

check out Pyfdate: http://www.ferg.org/pyfdate

from pyfdate import *

t = Time().add(hours=14)
print It is now, t.wdt

datestring1 = 2005/10/05 #year,month,day
datestring2 = 2002/09/22 #year,month,day
datestring3 = 2007/11/11 #year,month,day

year,month,day = numsplit(datestring1)  # split into integers
t1 = Time(year,month,day)
for datestring in (datestring2,datestring1,datestring3):
year,month,day = numsplit(datestring)
t2 = Time(year,month,day)

if t1  t2:
print t1.isodate, is later than  , t2.isodate
elif t1 == t2:
print t1.isodate, is the same as , t2.isodate
elif t1  t2:
print t1.isodate, is earlier than, t2.isodate

print

t1 = Time(2000,2,28)
print The date after, t1.d, is, t1.plus(day=1).d
t1 = Time(2001,2,28)
print The date after, t1.d, is, t1.plus(day=1).d
t1 = Time(2004,2,28)
print The date after, t1.d, is, t1.plus(day=1).d

print
datestring1 = 2005/10/05 20:10:08
datestring2 = 2005/10/05 20:10:06
datestring3 = 2005/10/05 20:10:09

t1 = Time(*numsplit(datestring1))
for datestring in (datestring2,datestring1,datestring3):
t2 = Time(*numsplit(datestring))

if t1  t2:
print t1.d, t1.civiltime2, is later than  , t2.d, 
t2.civiltime2
elif t1 == t2:
print t1.d, t1.civiltime2, is the same as , t2.d, 
t2.civiltime2
elif t1  t2:
print t1.d, t1.civiltime2, is earlier than, t2.d, 
t2.civiltime2
I'm using IDLE for Python 2.4, and put pfydate distribution in 
C:\Python24\Lib\site-packages\pfydate, as required by the 
ttp://www.ferg.org/pyfdate/download.html page.

How to install pyfdate.

Save pyfdate.py into your PythonNN/Lib/site-packages directory.
I copied it into C:\Python24\Lib\site-packages\pfydate

Execution in IDLE produced:
-
Traceback (most recent call last):
  File 
C:\Sandia_Meteors\Improved_Sentinel\Sentinel_Playground\date_example.py, 
line 1, in ?

from pyfdate import *
ImportError: No module named pyfdate
-
Looking in the Path Browser, I don't see pyfdate. I see PIL package and 
scipy package.


Comments?

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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Date Comparison and Manipulation Functions?

2008-08-26 Thread W. eWatson

John Machin wrote:

On Aug 27, 10:21 am, W. eWatson [EMAIL PROTECTED] wrote:

I'm using IDLE for Python 2.4, and put pfydate distribution in
C:\Python24\Lib\site-packages\pfydate, as required by the
ttp://www.ferg.org/pyfdate/download.html page.
How to install pyfdate.

 Save pyfdate.py into your PythonNN/Lib/site-packages directory.
I copied it into C:\Python24\Lib\site-packages\pfydate


If that means that you ended up with
   C:\Python24\Lib\site-packages\pfydate\pyfdate.py
then you have *not* followed the instructions Save pyfdate.py into
your PythonNN/Lib/site-packages directory.
You need to end up with
   C:\Python24\Lib\site-packages\pyfdate.py
None of the folders in C:\Python24\Lib\site-packages\ have py as a suffix 
(as seen either by the IDLE path browser or XP). My folder is exactly 
C:\Python24\Lib\site-packages\pfydate in XP and it contains about 12 py files.

There are exactly three folders under
C:\Python24\Lib\site-packages\ according to the IDLE path browser. This does 
not agree with XP, which has:

Numeric
pfydate
scipy
numpy
PIL


If in doubt, get to a command prompt and type
   dir C:\Python24\Lib\site-packages\pfydate*
and tell us what you see.


Execution in IDLE produced:
-
Traceback (most recent call last):
   File
C:\Sandia_Meteors\Improved_Sentinel\Sentinel_Playground\date_example.py,
line 1, in ?
 from pyfdate import *
ImportError: No module named pyfdate
-
Looking in the Path Browser, I don't see pyfdate. I see PIL package and
scipy package.



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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Date Comparison and Manipulation Functions?

2008-08-25 Thread W. eWatson

[EMAIL PROTECTED] wrote:

check out Pyfdate: http://www.ferg.org/pyfdate

from pyfdate import *

t = Time().add(hours=14)
print It is now, t.wdt

datestring1 = 2005/10/05 #year,month,day
datestring2 = 2002/09/22 #year,month,day
datestring3 = 2007/11/11 #year,month,day

year,month,day = numsplit(datestring1)  # split into integers
t1 = Time(year,month,day)
for datestring in (datestring2,datestring1,datestring3):
year,month,day = numsplit(datestring)
t2 = Time(year,month,day)

if t1  t2:
print t1.isodate, is later than  , t2.isodate
elif t1 == t2:
print t1.isodate, is the same as , t2.isodate
elif t1  t2:
print t1.isodate, is earlier than, t2.isodate

print

t1 = Time(2000,2,28)
print The date after, t1.d, is, t1.plus(day=1).d
t1 = Time(2001,2,28)
print The date after, t1.d, is, t1.plus(day=1).d
t1 = Time(2004,2,28)
print The date after, t1.d, is, t1.plus(day=1).d

print
datestring1 = 2005/10/05 20:10:08
datestring2 = 2005/10/05 20:10:06
datestring3 = 2005/10/05 20:10:09

t1 = Time(*numsplit(datestring1))
for datestring in (datestring2,datestring1,datestring3):
t2 = Time(*numsplit(datestring))

if t1  t2:
print t1.d, t1.civiltime2, is later than  , t2.d, 
t2.civiltime2
elif t1 == t2:
print t1.d, t1.civiltime2, is the same as , t2.d, 
t2.civiltime2
elif t1  t2:
print t1.d, t1.civiltime2, is earlier than, t2.d, 
t2.civiltime2

It looks good. Thanks.

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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Filling in Degrees in a Circle (Astronomy)

2008-08-24 Thread W. eWatson

David wrote:



What modules do I need to use pylab? I've installed scipy and numpy.



http://matplotlib.sourceforge.net/

I'm using Python 2.4. The install looks pretty complicated for Windows. It 
doesn't seem like matplotlib is a module.


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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Date Comparison and Manipulation Functions?

2008-08-24 Thread W. eWatson

Are there some date and time comparison functions that would compare, say,

Is 10/05/05 later than 09/22/02?  (or 02/09/22 format, yy/mm/dd)
Is 02/11/07 the same as 02/11/07?

Is 14:05:18 after 22:02:51? (24 hour day is fine)

How about the date after 02/28/04 is 02/29/04, or the date after 09/30/08 is 
10/01/08?


How about is 03/03/04 20:10:08 after 03/07/03 14:00:00? Probably the others 
above will suffice.

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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Filling in Degrees in a Circle (Astronomy)

2008-08-23 Thread W. eWatson

Maric Michaud wrote:

Le Saturday 23 August 2008 01:12:48 W. eWatson, vous avez écrit :

The other night I surveyed a site for astronomical use by measuring the
altitude (0-90 degrees above the horizon) and az (azimuth, 0 degrees north
clockwise around the site to 360 degrees, almost north again) of obstacles,
trees. My purpose was to feed this profile of obstacles (trees) to an
astronomy program that would then account for not sighting objects below
the trees.

When I got around to entering them into the program by a file, I found it
required the alt at 360 azimuth points in order from 0 to 360 (same as 0).
Instead I have about 25 points, and expected the program to be able to do
simple linear interpolation between those.

Is there some simple operational device in Python that would allow me to
create an array (vector) of 360 points from my data by interpolating
between azimuth points when necessary? All my data I rounded to the nearest
integer. Maybe there's an interpolation operator?

As an example, supposed I had made 3 observations: (0,0) (180,45) and
(360,0). I would want some thing like (note the slope of the line from 0 to
179 is 45/180 or 0.25):
alt: 0, 0.25, 0.50, 0.75, ... 44.75, 45.0
az : 0, 1,2,3,  180

Of course, I don't need the az.


Not sure I got it, but is that fulfill your specs ?


[20]: def interpolate(a, b) :

slope = float(b[1] - a[1]) / (b[0] - a[0])
return [ slope * float(i) for i in xrange(b[0]-a[0] + 1) ]
   :


[23]: interpolate((0, 0), (180, 45))

...[23]:
[0.0,
 0.25,
 0.5,
 0.75,

 44.5,
 44.75,
 45.0]


[29]: interpolate((80, 20), (180, 45))

[0.0,
 0.25,
 0.5,
 0.75,
 1.0,
 1.25,
...
 24.5,
 24.75,
 25.0]



Yes, the interpolation part looks right, but the tricky part is to be able 
to go through the list and find where one needs to generate all the missing 
az angles. A chunk of my data is in a post above yours. Here's a more 
revealing set of data where four data points are known:


az el
0 10
4 14 (slope is 1)
12 30 (slope is 2)
15 15 (slope is -5)


16 points need to be generated, 0 to 15, representing 15 degrees around the 
circle.

So, I'm doing this in my head, one would get
0 10 (slope is 1)
1 11
2 12
3 13
4 14
5 16 (slope is 2)
6 18
7 18
...
12 30
13 25
14 20
15 15

I use Python occasionally, and starting up requires some effort, but I've 
finally decided to take a go at this.


I'm working on this now, but my knowledge of python needs refreshing. Right 
now I have a file of all the az,el data I've collected, and I'd like to open 
it with Python for XP. However, Python doesn't like this:


junkfile = open('c:\tmp\junkpythonfile','w')

I get
junkfile = open('c:\tmp\junkpythonfile','w')
IOError: [Errno 2] No such file or directory: 'c:\tmp\\junkpythonfile'

This problematic segment is just a hack of a similar statement which has the 
same problem and a much longer path. I suspect the problem is with the back 
slash.


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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Filling in Degrees in a Circle (Astronomy)

2008-08-23 Thread W. eWatson

Carl Banks wrote:

On Aug 22, 7:12 pm, W. eWatson [EMAIL PROTECTED] wrote:

Is there some simple operational device in Python that would allow me to
create an array (vector) of 360 points from my data by interpolating between
azimuth points when necessary? All my data I rounded to the nearest integer.
Maybe there's an interpolation operator?


There's nothing built in, but see the bisect module.  It is a good way
to determine which interval you are in, and you can interpolate the
points yourself.


Carl Banks
I'll take a look. I just posted above yours with a more insightful set of 
data than the first three pointer. Yes, some way of bisecting, or chopping 
is the trick here. One is just trying to fill in all the gaps with 
interpolation and produce 360 points to feed to the telescope software. It's 
sort of like giving someone, and forgetting interpolation here, the sequence 
20, 30, blank, 60, 70, 80 and asking for the two missing tens between 30 and 
60. 40 and 50, of course.


The fellow above wrote an interpolate function that will probably fit the bill.

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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Filling in Degrees in a Circle (Astronomy)

2008-08-23 Thread W. eWatson

Scott David Daniels wrote:

W. eWatson wrote:

...
I'm working on this now, but my knowledge of python needs refreshing. 
Right now I have a file of all the az,el data I've collected, and I'd 
like to open it with Python for XP. However, Python doesn't like this:


junkfile = open('c:\tmp\junkpythonfile','w')

I get
junkfile = open('c:\tmp\junkpythonfile','w')
IOError: [Errno 2] No such file or directory: 'c:\tmp\\junkpythonfile'

This problematic segment is just a hack of a similar statement which 
has the same problem and a much longer path. I suspect the problem is 
with the back slash.




A standard windows error. note that '\t' is a tab, and I doubt you have
a directory named tab m p.  Get in the habit of _always_ using:
   junkfile = open(r'c:\tmp\junkpythonfile','w')
or
   junkfile = open('c:\\tmp\\junkpythonfile','w')
for file names.

--Scott David Daniels
[EMAIL PROTECTED]


Thanks. r did the job nicely.

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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Total No. of Records in a File?

2008-08-23 Thread W. eWatson
I have an ordinary text file with a CR at the end of a line, and two numbers 
in each line. Is there some way to determine the number of lines (records) 
in the file before I begin reading it?


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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Total No. of Records in a File?

2008-08-23 Thread W. eWatson

Nick Dumas wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Err...you want to know what is in a file before you open it? This could
be done if you keep some external database documenting changes made to
the file. But unless I misunderstand what you're saying, then it's not
possible to know the contents of a file without opening and reading that
file.

W. eWatson wrote:

I have an ordinary text file with a CR at the end of a line, and two
numbers in each line. Is there some way to determine the number of lines
(records) in the file before I begin reading it?


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkiwSZ4ACgkQLMI5fndAv9hXugCeJs5XBkLLne6ljqQggB/MoAVs
SNIAoJxsU04cwcZMrH9QjElAbMD34RdK
=RlmP
-END PGP SIGNATURE-
Maybe. I could see it if the file were truly in a record format. The # of 
records might be kept by the OS. It's conceivable that Python or the OS 
might see a file with a CR as recordized. All unlikely though. Just checkin'.


How about in a slightly different case. Suppose I want to know the number of 
files in a folder? The OS and maybe some Python method might know that.


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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Total No. of Records in a File?

2008-08-23 Thread W. eWatson

Fredrik Lundh wrote:

W. eWatson wrote:

I have an ordinary text file with a CR at the end of a line, and two 
numbers in each line. Is there some way to determine the number of 
lines (records) in the file before I begin reading it?


In the general case, no.  A file is just a bunch of bytes.  If you know 
that all lines have exactly the same length, you can of course fetch the 
file size and divide by the line size, but that doesn't work for 
arbitrary files.


Why do you need to know the number of lines before reading it, btw?

/F

Actually, it was a matter of curiosity, and maybe absent mindedness. I was 
envisioning a program where I might want to run up and down a file a lot, 
sometimes deleting a record interactively at the request of the user. 
However, I wanted to keep him alert to the total number of records 
remaining. However, in retrospect, I more likely do this with files in a 
folder. I also want him to be able to skip around in the Win OS folder by 
saying something like go forward 3 files. I'd like not to have to read all 
the files between the two points. The whole idea needs some more thinking.


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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Filling in Degrees in a Circle (Astronomy)

2008-08-23 Thread W. eWatson
I completed a Win Python program and it has generated the necessary data, 
which I have in turn used successfully with the telescope software. Is there 
some way to turn this into an executable program for people who do not have 
Python?


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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Filling in Degrees in a Circle (Astronomy)

2008-08-23 Thread W. eWatson

tom wrote:

W. eWatson wrote:
The other night I surveyed a site for astronomical use by measuring 
the altitude (0-90 degrees above the horizon) and az (azimuth, 0 
degrees north clockwise around the site to 360 degrees, almost north 
again) of obstacles, trees. My purpose was to feed this profile of 
obstacles (trees) to an astronomy program that would then account for 
not sighting objects below the trees.


When I got around to entering them into the program by a file, I found 
it required the alt at 360 azimuth points in order from 0 to 360 (same 
as 0). Instead I have about 25 points, and expected the program to be 
able to do simple linear interpolation between those.


Is there some simple operational device in Python that would allow me 
to create an array (vector) of 360 points from my data by 
interpolating between azimuth points when necessary? All my data I 
rounded to the nearest integer. Maybe there's an interpolation operator?


As an example, supposed I had made 3 observations: (0,0) (180,45) and 
(360,0). I would want some thing like (note the slope of the line from 
0 to 179 is 45/180 or 0.25):

alt: 0, 0.25, 0.50, 0.75, ... 44.75, 45.0
az : 0, 1,2,3,  180

Of course, I don't need the az.




If I understand you right, I think using interpolation as provided by 
scipy would do what you need.


Here's an example:

from scipy.interpolate.interpolate import interp1d

angles = [0, 22, 47.5, 180, 247.01, 360]
altitudes = [18, 18, 26, 3, 5, 18]

desired_angles = range(0, 361)

skyline = interp1d(angles, altitudes, kind=linear)
vals = skyline(desired_angles)

# that is, vals will be the interpolated altitudes at each of the
# desired angles.

if 1:  # plot this out with matplotlib
import pylab as mx
mx.figure()
mx.plot(angles, altitudes, 'x')
mx.plot(desired_angles, vals)
mx.show()
I decided this morning and roll up my sleeves and write the program. I plan 
to take a deeper plunge in the next month than my so far erratic look over 
the last 18 or more months  It's working.


The above looks like it's on the right track. Is scipy some collection of 
astro programs? mx is a graphics character plot?


I just hauled it into IDLE and tried executing it.
from scipy.interpolate.interpolate import interp1d
ImportError: No module named scipy.interpolate.interpolate

Apparently, something is missing.

I posted a recent msg a bit higher that will probably go unnoticed, so I'll 
repeat most of it. How do I get my py code into some executable form so that 
Win users who don't have python can execute it?



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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Re: Filling in Degrees in a Circle (Astronomy)

2008-08-23 Thread W. eWatson

Dennis Lee Bieber wrote:

On Fri, 22 Aug 2008 23:18:17 -0700, W. eWatson
[EMAIL PROTECTED] declaimed the following in comp.lang.python:


I'll take a look. I just posted above yours with a more insightful set of 
data than the first three pointer. Yes, some way of bisecting, or chopping 
is the trick here. One is just trying to fill in all the gaps with 
interpolation and produce 360 points to feed to the telescope software. It's 
sort of like giving someone, and forgetting interpolation here, the sequence 
20, 30, blank, 60, 70, 80 and asking for the two missing tens between 30 and 
60. 40 and 50, of course.


Presuming the data is an ordered list (in azimuth) of az/el pairs,
AND that the last measurement does not close the circle (eg: (0, 1),
(90, 5), (180, 5), (270, 2) ) the first step would be to append a data
point consisting of the first azimuth data point + 360, but with the
same elevation value. With normalization at the output, this would work
if the first data point was not at 0. Then one would perform repeated
interpolations over pairs of data points, outputting the first pair as
the first value, and stopping when the azimuth reached the second pair.

Something like (watch out for line wrapping):

-=-=-=-=-=-=-
import pprint

def gatherPoints():
pointList = []
while True:
cAz = raw_input(Enter Azimuth in integer degrees (blank line to
exit) : )
cAz = cAz.strip()
if not cAz: break
az = int(cAz)
cEl = raw_input(Enter Elevation in real degrees for azimuth %s
:  % az).strip()
el = float(cEl)
pointList.append( (az, el) )
if pointList:
pointList.append( (pointList[0][0] + 360, pointList[0][1]) )
return pointList

def interpolate(start, end, step):
slope = float(end[1] - start[1]) / (end[0] - start[0])
iPoints = [ (i, (slope * (i - start[0])) + start[1])
for i in range(start[0], end[0], step) ]
return iPoints


if __name__ == __main__:
points = gatherPoints()
output = []
if points:
for s in range(len(points) - 1):
output.extend(interpolate(points[s], points[s+1], 1))
pprint.pprint(output)
-=-=-=-=-=-=-
Close. A nice looking piece of code. Something for me to learn from. I play 
with python on a pretty irregular basis.


The game here is like someone gives you five distinct integer numbers from 1 
to 10 in order, and one needs to write a program to fill in the gaps. In my 
case, the numbers go from 0 to 359, and I have lots of gaps. I gave a pretty 
illustrative example in a post above. 11:10 pm last night. Of course, not 
only the gaps from 0 to 359 need to be filled in, but the interpolated 
values of the related values need to be obtained. Elevation.


As I just posted to the fellow below you. I decided this morning and roll up 
my sleeves and write the program. I plan to take a deeper plunge in the next 
month than my so far erratic look over the last 18 or more months  It's working.



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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


Turning py into an Executable Program for Win?

2008-08-23 Thread W. eWatson
How do I get my py code into some executable form so that Win users who 
don't have python can execute it?


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

 (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
  Obz Site:  39° 15' 7 N, 121° 2' 32 W, 2700 feet

Web Page: www.speckledwithstars.net/
--
http://mail.python.org/mailman/listinfo/python-list


<    1   2   3   4   5   >