idea

2009-05-07 Thread r-w

Redirect sys.stderr to the log file in ANUGA logging.
This might catch unexpected exceptions.
--
http://mail.python.org/mailman/listinfo/python-list


Re: getting linux distro used...

2009-04-27 Thread r-w

deostroll wrote:

Hi,

I just found that you could use platform.system() to get the
underlying os used. But is there a way to get the distro used...?

--deostroll


platform.dist() returns
('debian', 'lenny/sid', '')
on my Ubuntu box.

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


http://wwwx.cs.unc.edu/~gb/wp/blog/2007/02/04/python-opencv-wrapper-using-ctypes/

2009-04-17 Thread r-w

http://wwwx.cs.unc.edu/~gb/wp/blog/2007/02/04/python-opencv-wrapper-using-ctypes/
--
http://mail.python.org/mailman/listinfo/python-list


Re: pseudo-code

2009-04-07 Thread r-w

r-w wrote:

If no internet connection:
if have files:
run anyway, with warning
else:
ERROR
else:
if error getting hash/files:
if have files:
run anyway, with warning
else:
ERROR
else:
run


Sorry, guys.

This should have gone to work.

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


pseudo-code

2009-04-07 Thread r-w

If no internet connection:
if have files:
run anyway, with warning
else:
ERROR
else:
if error getting hash/files:
if have files:
run anyway, with warning
else:
ERROR
else:
run
--
http://mail.python.org/mailman/listinfo/python-list


Web validation

2009-04-06 Thread r-w

If no internet connection:
if have files:
run anyway, with warning
else:
ERROR
else:
if error getting hash/files:
if have files:
run anyway, with warning
else:
ERROR
else:
run
--
http://mail.python.org/mailman/listinfo/python-list


extending auto_dict

2008-07-02 Thread R W

I'm using the excellent 'auto_dict' 
(http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/537637) but I'd like 
to be able to extend it.

Currently my program has

class auto_dict(dict):
def __getitem__(self, key):
return self.setdefault(key, self.__class__())

daily=auto_dict()
try:
daily['today']['now'].append((1,2))
except AttributeError:
daily['today']['now']=[(1,2)]


Which works OK but I thought it would be easy to supply an 'append' method to 
the auto_dict class that would save me from having all those try/except blocks 
scattered through my code ie I could just say

daily['today']['now'].append((1,2))

and the class would take care of catching the exception and assigning the list.

I tried adding

def append(self,item):
   self=[item]
   return self

to the class definition but it doesnt actually assign the value.  

Can it be done this way?  Some other way?  Or am I stuck using the try/except 
blocks?
 


(please CC me since I'm not subscribed to the list)


  Get the name you always wanted with the new y7mail email address.
www.yahoo7.com.au/mail--
http://mail.python.org/mailman/listinfo/python-list