Tamogen ZeroDivisionError

Bug #440273 reported by Nadia Alramli
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Phatch
Fix Released
Medium
Juho Vepsäläinen
phatch (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

While running the test suite on the tamogen action I got this error:

ERROR:actionlist: /home/nadia/projects/phatch/tests/output/actionlists/convert_mode_tamogen_Mode=1_FillType=Folder_Rows=1000_Columns=1.phatch generated the following logs:
Error 0:Can not apply action Tamogen on image 'fish.gif' in folder:
/home/nadia/projects/phatch/tests/input

float division

Action:{'fields': {'Canvas Height': '100%',
            'Canvas Width': '100%',
            'Columns': u'1',
            'Fill Folder': '<folder>/<subfolder>',
            'Fill Image': '<path>',
            'Fill Type': u'Folder',
            'Rows': u'1000',
            '__enabled__': 'yes'},
 'label': 'Tamogen'}

Traceback (most recent call last):
  File "/home/nadia/projects/phatch/phatch/core/api.py", line 608, in apply_action_to_photo
    photo = action.apply(photo, read_only_settings, cache)
  File "/home/nadia/projects/phatch/phatch/core/models.py", line 106, in apply
    photo.get_layer().apply_pil(self.pil, **values)
  File "/home/nadia/projects/phatch/phatch/core/pil.py", line 709, in apply_pil
    self.image = function(self.image, *arg, **keyw)
  File "/home/nadia/projects/phatch/phatch/actions/tamogen.py", line 42, in mosaic
    canvas_width, canvas_height, fill_image, fill_folder)
  File "/home/nadia/projects/phatch/phatch/other/tamogen.py", line 81, in mosaic
    fill_img, tone_diff = fill_images.findClosestImageAndToneDiff(bsection)
  File "/home/nadia/projects/phatch/phatch/other/tamogen.py", line 108, in findClosestImageAndToneDiff
    image_avg = sum(Stat(diff_image).mean)
  File "/usr/lib/python2.5/site-packages/PIL/ImageStat.py", line 64, in __getattr__
    v = getattr(self, "_get" + id)()
  File "/usr/lib/python2.5/site-packages/PIL/ImageStat.py", line 120, in _getmean
    v.append(self.sum[i] / self.count[i])
ZeroDivisionError: float division
*

I'm attaching the actionlist and the image to reproduce the error.

Revision history for this message
Nadia Alramli (nadiana) wrote :
Changed in phatch:
assignee: nobody → Juho Vepsäläinen (bebraw)
importance: Undecided → Medium
status: New → Confirmed
milestone: none → 0.2.1
Stani (stani)
Changed in phatch:
milestone: 0.2.1 → 0.2.2
summary: - tamogen ZeroDivisionError
+ Tamogen ZeroDivisionError
Revision history for this message
Juho Vepsäläinen (bebraw) wrote :

Try this:
=== modified file 'phatch/other/tamogen.py'
--- phatch/other/tamogen.py 2009-09-21 04:26:34 +0000
+++ phatch/other/tamogen.py 2009-10-02 05:11:31 +0000
@@ -39,7 +39,7 @@
     assert filltype in FILL_TYPES

     fill_size = (x_pix, y_pix)
- num_squares = (x_squares, y_squares)
+ num_squares = (min(x_squares, x_pix), min(y_squares, y_pix))
     final_img = Image.new(im.mode, fill_size)

     fill_section_size = get_section_size(fill_size, num_squares)

Stani (stani)
Changed in phatch:
status: Confirmed → In Progress
Stani (stani)
Changed in phatch:
status: In Progress → Fix Committed
Changed in phatch (Ubuntu):
status: New → Confirmed
Stani (stani)
Changed in phatch:
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package phatch - 0.2.3-2

---------------
phatch (0.2.3-2) unstable; urgency=low

  * phatch.desktop and menu files are now shipped by phatch package
    (LP: #449210)
    - add lintian overrides for above changes (phatch depends on phatch-cli so
      everything is ok)

phatch (0.2.3-1) unstable; urgency=low

  * Upstream bugfix release (Closes LP: #448845, #446725, #445943)

phatch (0.2.2-1) unstable; urgency=low

  * Upstream bugfix release (Closes LP: #236548, #436595, #437161,
   #437376, #437852, #439108, #439359, #440273, #440956)
  * debian/control: Dropped dependency python-wxgtk2.6

 -- Julien Lavergne <email address hidden> Tue, 13 Oct 2009 18:49:27 +0100

Changed in phatch (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.