again.
John Ertl
Meteorologist
FNMOC
7 Grace Hopper Ave.
Monterey, CA 93943
(831) 656-5704
[EMAIL PROTECTED]
Classification: UNCLASSIFIED
Caveat (s): FOUO
From: Kent Johnson
Sent: Thu 11/6/2008 7:36 PM
To: Ertl, John C CIV 63134
Cc: tutor@python.org
Subject: Re: [Tutor] How to use function from
Classification: UNCLASSIFIED Caveat (s): FOUO
I have a program that collects weather data from weather models. I originally had a module that contained a bunch of function that I used. So I just added it to the init of the class I was using and inherited the functions. That worked great but
Classification: UNCLASSIFIED
Caveat (s): FOUO
Thanks for the help and I am looking into the pyprocessing but threading is
causing too many headaches (I may have to rewrite things). Lets say I have
something as simple as below:
def takeTime(a):
print "Started %s" % a
time.sleep(10)
Classification: UNCLASSIFIED
Caveat (s): FOUO
All,
I have a program that basically loops through two loops and I wanted to speedup
the stuff inside the second loop so I thought threading would be a good idea
but I am having a hard time getting it to work. All of the examples I have
seen that
Classification: UNCLASSIFIED
Caveat (s): FOUO
All,
I have been writing simple cgi scripts for a long time but have never worried
about the error codes. Now I have been asked to return a specific error and I
have no idea how to do this. I do not even know if I should be returning an
HTTP or
Sent: Thu 6/7/2007 9:30 AM
To: tutor@python.org
Subject: Re: [Tutor] Best way to POST XML to CGI
"Ertl, John C CIV 63134" <[EMAIL PROTECTED]> wrote
> I have a Python program that makes images of data
> and I want to be able to make these via a web interface.
Fair enough
All,
I have a Python program that makes images of data and I want to be able to make
these via a web interface. I want to keep it simple so I thought I would send
an XML file to a cgi program (XML is what I am supposed to use). I have the
parsing of the XML all figured out but the way I am se
All,
I am trying to work an example that I found at
http://bitworking.org/news/132/REST-Tips-URI-space-is-infinite
When I try the code below I get an error and I am not able to figure it out.
Thanks for any and all help. I have two png and a text file (sortzip.txt) in
the same dir as this
@python.org
Subject:Re: [Tutor] trouble with re
Ertl, John wrote:
> I have a file with 10,000 + lines and it has a coma delimited string on
each
> line.
>
> The file should look like:
>
> DFRE,ship name,1234567
> FGDE,ship 2,
> ,sdfsf
>
> The ,sdfsf line is bad
I have a file with 10,000 + lines and it has a coma delimited string on each
line.
The file should look like:
DFRE,ship name,1234567
FGDE,ship 2,
,sdfsf
The ,sdfsf line is bad data
Some of the lines are messed up...I want to find all lines that do not end
in a comma or seven digits and do som
rg
Subject:Re: [Tutor] Halting execution
It would be similar to Perl's die() commmand. But no, in Python the
argument is the error status of your script.
You'd have to do something like
def exitnow(arg):
print arg
#maybe sys has not been imported
import sys
sys
Matthew,
Not sure if ipython is different but have you tried sys.exit("stoping now")
You could also put in a flag to turn the printing on and off so it wont
print it out when you are testing.
John
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Mat
odeAmount)
print "Your memory usage is %s KB and your inode usage is %s" %
(myUse.memTotal,myUse.inodeTotal)
print "Your memory limit is %s KB and your inode limit is %s" %
(myUse.memLimit, myUse.inodeLimit)
if myUse.memLimit < myUse.memTotal or myUse.inodeLimit <
m
Cc: tutor@python.org
Subject:Re: [Tutor] question about run time
Ertl, John wrote:
> Kent,
>
> The files are very small (a few hundred lines). Maybe it is a network
> issue? But then why is it always slow the first time in the morning? I
> don't know network st
EMAIL PROTECTED]
Sent: Tuesday, May 02, 2006 12:06 PM
To: Ertl, John
Cc: tutor@python.org
Subject:Re: [Tutor] question about run time
Ertl, John wrote:
> I have been using python for sometime...and occasionally I noticed
> significant delay before the code would run but unitl now
I have been using python for sometime...and occasionally I noticed
significant delay before the code would run but unitl now I have been able
to write it off to other things. Now I have a short script that I wrote to
check some files and print out a few lines.
I have noticed that usually the fir
Marc,
You can do most system type stuff in Python and it makes it much easier.
import glob
jpgList = glob.glob("*.jpg") # the glob allows you to use wild cards in the
search
jpgCount = len(jpgList)
This gives you a list of all files that end in .jpg. You can then do a
len(jpgList) to get the nu
, 2005 10:01 AM
To: Ertl, John; tutor@python.org
Subject:Re: [Tutor] launching and monitor from make
> The CM team here would like to have the script run each week as part of
> the
> automated rebuilds. The suggestion was to make the execution of the
> scritp
> par
: Ertl, John
Subject:Re: [Tutor] launching and monitor from make
Hi John
Ertl, John wrote:
> All,
>
> I have a very simple python program that reads one file and overwrites
> anouther text file. This workes great from the command line and it has
> error checking b
All,
I have a very simple python program that reads one file and overwrites
anouther text file. This workes great from the command line and it has
error checking but just outputs messages and the like to the screen.
The CM team here would like to have the script run each week as part of the
auto
All,
Well I found the answer...getbox() gave me the bounding box and then I could
just plot that portion of the two images.
Python 2.4, PIL 1.1.5
The simple code I have tried:
import Image
import ImageChops
file1 = Image.open("/home/PT04_RH.2005072300.gif")
file2 = Image.open("/home/PT04_RH.
All,
I have two gif images that should be exactly the same...one static and the
other recreated from the same data. For months this has been working great
but yesterday the "new" image that I made was slightly different. The image
size is 4 bytes different. When I look at the image side by sid
Sorry for that you will have to change the %09 to a %08 to get 8 digits. I
got a bit to fixated on the
John Ertl
-Original Message-
From: Ertl, John
Sent: Friday, August 26, 2005 2:23 PM
To: Alberto Troiano; tutor@python.org
Subject:RE: [Tutor] Generate 8
Alberto
If you don't mind having leading 0 then you could just do the random like
you did then format it to 9 digits.
You could give this a try
num = random.randrange(,)
num8 = "%09i" % num
John Ertl
-Original Message-
From: Byron [mailto:[EMAIL PROTECTED]
Sent:
All,
I have a text file that contains several thousand lines of space delimited
text that contain a ship ID and a ship name. This file is updated every few
months.
I have another file that contains the ship ID and some other info but not
the ship name. I have to append the ship name to the end
Kristiano,
It is sometimes hard to tell the indentions in an email but it looks like
your last line
print "Just right"
has a space in front of it. Python does not know what logical block the
indented part belongs to.
John Ertl
-Original Message-
From: Kristiano Ang [mailto:[EMAIL PR
John,
The 'r' is the mode and is used to indicate you are reading the file. You
could also use 'w' for only writing. See the attached link for more.
http://www.python.org/doc/current/tut/node9.html#SECTION0092
0
John
-Original Message-
From: John Carmona [mailto:[EMA
ljVersion/lib/python2.4/lib-tk/Tkinter.py", line
2075, in _create
return getint(self.tk.call(
_tkinter.TclError: image "pyimage2" doesn't exist
-Original Message-
From: Michael Lange [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 26, 2005 01:58
To: Ertl, John
Sub
I forgot to mention that I am running on a Linux system if that makes any
difference for the TK part.
Thanks,
John Ertl
-Original Message-
From: Ertl, John
Sent: Monday, April 25, 2005 10:24
To: tutor@python.org
Subject: using TK to view an image and then close the window
All,
I
All,
I have been struggling with being able to view an image and most things have
not worked for one reason or another so I am trying to fall back on a way I
used to do it in PERL. Use TK to show the image. I do not know TKInter but
I have two scripts one that gets a list of images and anouther
t manually).
Thanks,
John Ertl
-Original Message-
From: Kent Johnson [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 21, 2005 13:49
Cc: tutor@python.org
Subject: Re: [Tutor] trouble setting the environment
Ertl, John wrote:
> Kent,
>
> Good idea except that the environment that need
, April 21, 2005 13:20
Cc: tutor@python.org
Subject: Re: [Tutor] trouble setting the environment
Ertl, John wrote:
> All,
>
> I have program and init I want to "source" a .ksh file to set some
> environment variables and then use those variables in my program.
>
> Is this
All,
I have program and init I want to "source" a .ksh file to set some
environment variables and then use those variables in my program.
Is this possible? I vaguely remember something about the system env and the
interpreters env being separate after the interpreter starts up.
For instance if I
ailto:[EMAIL PROTECTED]
Sent: Tuesday, April 19, 2005 10:33
Cc: tutor@python.org
Subject: Re: FW: [Tutor] Trying to d0 HTTP GET
Ertl, John wrote:
> All,
>
> I have figured out a bit more. I can get the binary values from the
service
> but I think they come back as a single string. How do
p()
print binvalues
-Original Message-
From: Kent Johnson
Cc: tutor@python.org
Sent: 4/18/05 1:10 PM
Subject: Re: [Tutor] Trying to d0 HTTP GET
Ertl, John wrote:
> All,
>
> I am trying to get some binary data from a web service. None of the
tech
> guys are around so I am hoping you
13:10
Cc: tutor@python.org
Subject: Re: [Tutor] Trying to d0 HTTP GET
Ertl, John wrote:
> All,
>
> I am trying to get some binary data from a web service. None of the tech
> guys are around so I am hoping you might be able to shed some light on
what
> might be happening.
I wou
All,
I am trying to get some binary data from a web service. None of the tech
guys are around so I am hoping you might be able to shed some light on what
might be happening.
Here is part of the email that explained what I needed to do.
- clip ---
If you can do an http "get" from Python, yo
Danny,
Pygame.org...I would not have thought to look there. In my google it did
not pop up. I will definitely take a look and thanks for the example.
John Ertl
-Original Message-
From: Danny Yoo [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 14, 2005 12:25
To: Ertl, John
Cc: Tutor
All,
I have asked this question before, but one more time most have commented
about manipulation but displaying the image has become the big issue. I
want to display png and gif images on a Linux machine using python. I am
using PyNGL to make the images and PIL to manipulate them but I cannot lo
I need to manipulate and view gif and png images. I have PIL installed so I
can do the manipulation but PIL does not let me view the images, because I
do not have xv. What is the recommended python module for viewing gif and
png?
Thanks for the recommendation.
John Ertl
__
gt;>> s='850hPa±'
>> >>> s
>> '850hPa\xb1'
>> >>> import re
>> >>> re.sub('\xb1', '*', s)
>> '850hPa*'
>> >>> import sys
>> >>> sys.stdout.encoding
>>
All
I have a string that has a bunch of numbers with the units attached to them.
I want to strip off the units. I am using a regular expression and sub to
do this. This works great for almost all of the cases.
These are the type of lines:
SigWind: 857hPa, , 21.0C, 20.1C, 210 @ 9
All,
I have an image with a bunch of white space that I need to crop. I would
like to automate the process using python and I was wondering what is the
best module for image manipulation? I have seen PIL and Python magic what
is recommended?
John Ertl
_
indow excluding scrolbars etc.
Shouldn't be too hard to create a window that matches the size of your
map, and convert window co-ords into image co-ords.
Good luck with that, though, Javascript is a funny beast, but there's
some good tutorials out there.
Regards,
Liam Clarke
On Mon, 28
All,
I have been doing Python for a bit now but I am trying to make a clickable
map of the world on a web page that gives me the latitude and longitude of a
location selected. I have done little with HTML beyond forms and have done
no Java script. Is this a problem Python can solve or is this
Danny,
That is great...every time I have a problem someone has already solved
it...the other problem is finding that solution...Thanks again.
John Ertl
-Original Message-
From: Danny Yoo [mailto:[EMAIL PROTECTED]
Sent: Tuesday, February 08, 2005 10:39
To: Ertl, John
Cc: 'tutor@pytho
I have a bit of code that uses
a module and I am trying to get more info on the error.
I am using this bit of code:
try:
rhfill =
Ngl.contour(wks,rhisobar,rh_res)
except:
execType,value,tracebak
= sys.exc_info()[:3]
print execType
prin
are the two files:
lines1 = getCommonPart(file1)
lines2 = getCommonPart(file2)
if lines1 != lines2:
# Do what you need to do in case of a mismatch...
# If you want details of the differences then you might want to use
difflib here
Kent
Ertl, John wrote:
> Kent
>
> What I need to do is
http://docs.python.org/lib/sequencematcher-examples.html
In your case the sequences will be lists of lines rather than strings (which
are sequences of
characters)
Kent
Ertl, John wrote:
> All,
>
> I have two text files that should contain a section of text that is the
> same. Luckily th
All,
I have two text files that should contain a section of text that is the
same. Luckily the section of text has a defined beginning and end. It
looks like the most straightforward thing would be to read the targeted text
from each file (only 50 lines or so) into lists and then compare the lis
That is too easy. I was looking at the examples of how to replace the old
popen and I just did not get it but the page you sent is great.
John
-Original Message-
From: Danny Yoo [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 19, 2005 10:34
To: Ertl, John
Cc: tutor@python.org
I am using the subprocess.Popen from 2.4. I can launch a job from python
and the output from the job goes to the screen but now I would like to have
the output go to a file. I could do the crude
subprocess.Popen("dtg | cat > job.out", shell=True)
But I would think there is a better way built i
Hugo,
That looks like it will work great.
Thanks,
John
-Original Message-
From: Hugo González Monteverde [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 22, 2004 12:41
To: [EMAIL PROTECTED]
Cc: Ertl, John
Subject: Re: [Tutor] Popen? or something else
You may use the 'com
I am trying to do the usual thing of asking for an input and then checking
it to see if it is valid. If the entry is not valid then ask again until
you get the correct answer.
I have come up with this class. I am trying to make a transition from
procedural programming to object oriented. Is th
: [Tutor] Popen? or something else
Rumor has it that Ertl, John may have mentioned these words:
>All,
>
>I hate to ask this but I have just installed 2.4 and I need to get some
info
>from a subprocess (I think that is correct term).
>
>At the Linux command line if I input dtg I
All,
I hate to ask this but I have just installed 2.4 and I need to get some info
from a subprocess (I think that is correct term).
At the Linux command line if I input dtg I get back a string representing a
date time group. How do I do this in Python? I would think Popen but I
just don't see i
...but the
straight forward path might be the best.
Thanks,
John Ertl
-Original Message-
From: Jason Child [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 16, 2004 12:36
Cc: [EMAIL PROTECTED]
Subject: Re: [Tutor] removedirs ?
Ertl, John wrote:
>I am trying to remove a directory t
I am trying to remove a directory that has other directories and files in
it. I thought removedirs was supposed to do a recursive remove of files and
directories.
When I try it I get
>>> os.removedirs("DAF")
Traceback (most recent call last):
File "", line 1, in -toplevel-
os.removedirs(
Very elegant, It makes me feel like "I should have thought of that". Thanks
for the help and the reminder to think of the simplistic approach.
John
-Original Message-
From: Tim Peters [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 15, 2004 12:15
To: Ertl, John
Cc:
I need to take a number and turn it into a formatted string.
The final output needs to look like when the X is the integer
part padded on the left and Y is the decimal part padded on the right.
I figured I could split the number at "." and then use zfill or something
like this (LEVEL
11:26
To: Ertl, John
Cc: [EMAIL PROTECTED]
Subject: Re: [Tutor] maximum value in a Numeric array
On Fri, 10 Dec 2004, Ertl, John wrote:
> I am trying to get the maximum value in a 2-D array. I can use max but
> it returns the 1-D array that the max value is in and I then I need to
> do
All,
I am trying to get the maximum value in a 2-D array. I can use max but it
returns the 1-D array that the max value is in and I then I need to do max
again on that array to get the single max value.
There has to be a more straightforward way...I have just not found it.
>>> b = array([[1,2],
62 matches
Mail list logo