Main index > Python programming > ADESKLETSError

By GoLDie (Desklet Author), on Mon May 1 07:38:51 2006: ADESKLETSError.

I've run into problems.
Becuace I'm extending the photo desklet for loading whole dirs into a list, the script must check if these files in a dir are images. ( http://adesklets.sourceforge.net/forum/viewtopic.php?t=214 )

Code:


try:
 pic = adesklets.load_image(self.photo_desklet.actfile())
 ...
except adesklets.ADESKLETSError, (errno, strerror):
 print str(errno) + ": " + strerror
 self.photo_desklet._all_ok = strerror

adesklets.content_set_image(self._buffer)


I load "Thumbs.db", becuase I share this dir with Windows - it is not an image.
"except" works but after that I've got (content_set_image self._buffer):

Code:

adesklets.error_handler.ADESKLETSError: adesklets command error - could not load image '/path/to/image/Thumbs.dbcontent_set_image 2' - file does not exist

Is there a way to "clean" the error? What am I doing wrong?
The alpha version is there: http://www.drama.pl/~goldie/photo/photo-0.0.6-alpha.tar.bz2
sample files.list:

Code:

/path/to/images
/path/to/other_images/im1.jpg
/path/to/other_images/im2.jpg

By syfou (Core Developer & Desklet Author), on Mon May 1 13:53:16 2006.

Hi Lukasz,

You did absolutely nothing wrong; it is me that imposed an artificial restriction (no recovery from command error) on the adesklets Python module, in a time when a knew a lot less about Python. Here is a changeset to lift it -- I still have to test it for a while just to check it doesn't break anything, but expect it to be included in incoming adesklets 0.6.2 (due next Friday in the worst case scenario).

Just a detail: don't forget to check return value from adesklets.version_check('0.6.2') on your final released code, just to avoid a lot of frustrations from your users. Yours,

By syfou (Core Developer & Desklet Author), on Mon May 1 15:44:53 2006.

Hi again Lukasz,

just for the fun, here is how command error recovery could be implemented on all already distributed adesklets >= 0.3.0 without altering those packages: Oh the joy of dynamic languages. :-) Yours,


adesklets is proud to be hosted on:

SourceForge.net Logo

Back to adesklets.sf.net.