__init__ method and raising exceptions

2005-03-31 Thread NavyJay
I have a simple for-loop, which instantiates a class object each
iteration.  As part of my class constructor, __init__(), I check for
valid input settings.  If there is a problem with this iteration, I
want to abort the loop, but equivalently 'continue' on in the for-loop.

I can't use 'break' or 'continue' in a class method, nor can I return a
boolean value from __init__() to check for errors within the for-loop.
How would I be able to stop the current iteration and continue with the
next after reporting an error?

Jay

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


Re: __init__ method and raising exceptions

2005-04-01 Thread NavyJay
Exactly the answer I was looking for!  12 hours of straight programming
tends to fog ones mind.  Thanks for making it clear!

Jay

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


Re: __init__ method and raising exceptions

2005-04-02 Thread NavyJay
Or better yet, define your own string/class exception to catch your
errors.  In my code, things can break in more than a few ways.  In each
case I catch the exception(s) specific to that piece of code, print a
warning message to the user at sys.stdout and raise a new exception to
be caught by my "wrapper" exception clause.

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


Re: Stretching a bitmap

2005-11-17 Thread NavyJay
Try ImageMagik:  http://www.imagemagick.org/

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


Re: XML processing

2005-11-30 Thread NavyJay
I haven't used PyXML extensively, but I have used parts of the Amara
XML Toolkit (http://uche.ogbuji.net/uche.ogbuji.net/tech/4suite/amara/)
and recommend it for elegance.  I can't say, however, which tool is
faster.  There are many other XML modules that people have written for
Python.  Do your research and pick the best one for you.

On a side note, XML has historically been a poor solution for most of
the cases I've seen it used.  You should seriously rethink whether you
"need to do some XML programming" and consider simpler options.  In
most simple cases, a primitive text parser with a delimited format is
your best bet.  You would know best, but this is my 2 cents.

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


Re: Automate decryption using GnuPGInterface

2005-11-30 Thread NavyJay
Are you able to run a dummy Python script using crontabs?  For
troubleshooting purposes, I would verify this before trying to debug my
code.  Check your permissions, paths, etc.

Can you post your entry into cron?  What exactly happens when it "blows
up"?

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


Re: How could I ask Thread B to call B().Method() from inside Thread A's run?

2005-11-30 Thread NavyJay
I agree with jmj's solution, you would want to send a signal of some
sort to Thread B from A when some event occurs in A.  A queue is one
way to do it, but keep in mind that there are numerous ways to
communicate between threads/processes (queue, pipe, exit status,
TCP/UDP message, etc.).  I believe one of the first couple chapters in
O'Reilly's "Programming Python" book discusses most of these methods.
Choose the simplest one that meets your needs.

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


Re: help

2006-04-27 Thread NavyJay
For such a simple task, I would use MATLAB.
http://www.mathworks.com/products/matlab/

However, if you have to do generic programming in addition to this, I
would use Python with the libraries ImageMagick or Python Image Library
(PIL).  Just search for them and you'll have all the examples you need.

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