Grocery list / Pantry function crashes

Bug #1474429 reported by Harald Franzen

This bug report was converted into a question: question #269216: Grocery list / Pantry function crashes.

6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gourmet
Invalid
Undecided
Unassigned

Bug Description

Running Gourmet 0.17.4 from PPA under Ubuntu 14.04 LTS (both 32bit and 64bit) with all current updates.
The recipes stored in a centralized mySQL database, accessed using connect string Exec=gourmet --database-url=mysql://user:password@servername/gourmetrecipe in /usr/share/applications/gourmet.desktop

Recently, the grocery list / pantry function crashes upon adding a recipe to it. This may be at the first recipe, but usually it happens after adding several recipes.

When the error occurs, when clicking the "Add to grocery list" button, nothing happens, the grocery list (when it was closed) is no longer opened and cannot be retrieved in any way. If the grocery list had remained open, the recipe added by clicking the button is not added to the grocery list.

I tried to establish whether there are errors in the recipes I am trying to add, but it seems that a recipe that "works" (is added to the grocery list correctly without error), might later be the recipe that "breaks" the grocery list - the error seems not to be caused by specific recipes.

Once the error has occurred, any subsequent recipe opened and added to the grocery list yields the same behavior and error message.

This is the verbose report Gourmet yields when the error occurs (the first few lines are recipes being opened to be added to the grocery list, being added before the error occurs):

[code]
<gourmet.reccard.RecCardDisplay instance at 0x7f2c251d8758> shop_for_recipe_cb
<gourmet.reccard.RecCardDisplay instance at 0x7f2c251f92d8> shop_for_recipe_cb
<gourmet.reccard.RecCardDisplay instance at 0x7f2c251f0830> shop_for_recipe_cb
<gourmet.reccard.RecCardDisplay instance at 0x7f2c251f2560> shop_for_recipe_cb
<gourmet.reccard.RecCardDisplay instance at 0x7f2c2523cd88> shop_for_recipe_cb
<gourmet.reccard.RecCardDisplay instance at 0x7f2c251d8560> shop_for_recipe_cb
<gourmet.reccard.RecCardDisplay instance at 0x7f2c253af518> shop_for_recipe_cb
<gourmet.reccard.RecCardDisplay instance at 0x7f2c252db908> shop_for_recipe_cb
<gourmet.reccard.RecCardDisplay instance at 0x7f2c251f0ef0> shop_for_recipe_cb
<gourmet.reccard.RecCardDisplay instance at 0x7f2c25243e18> shop_for_recipe_cb
<gourmet.reccard.RecCardDisplay instance at 0x7f2c25381878> shop_for_recipe_cb
<gourmet.reccard.RecCardDisplay instance at 0x7f2c27f46050> shop_for_recipe_cb
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/gourmet/reccard.py", line 416, in shop_for_recipe_cb
    self.rg.sl.addRec(self.current_rec,self.mult,d)
  File "/usr/lib/python2.7/dist-packages/gourmet/shopping.py", line 411, in addRec
    self.reset()
  File "/usr/lib/python2.7/dist-packages/gourmet/shopgui.py", line 815, in reset
    self.grabIngsFromRecs(self.recs.values(),self.extras)
  File "/usr/lib/python2.7/dist-packages/gourmet/shopping.py", line 282, in grabIngsFromRecs
    return self.organize_list(self.lst)
  File "/usr/lib/python2.7/dist-packages/gourmet/shopping.py", line 287, in organize_list
    pantry = self.sh.organize(self.sh.mypantry)
  File "/usr/lib/python2.7/dist-packages/gourmet/shopping.py", line 174, in organize
    l[1].sort(self._ing_compare)
  File "/usr/lib/python2.7/dist-packages/gourmet/shopping.py", line 206, in _ing_compare
    inga = inga.lower()
AttributeError: 'NoneType' object has no attribute 'lower'
[/code]

I'll happily add additional info if so required!
Thank you in advance for your help!

Revision history for this message
Harald Franzen (harald-franzen-lotcavediving) wrote :

Further information / change to feature request.

My analysis was wrong. I found two recently added recipes that each had an empty line in the ingredients' list.
Deleting those empty entries resolved the issue.

Proposed workaround:
Using the ingredient key manager, look at the first entry which will in this situation show an empty ingredient key.
Change the empty ingredient key into something you will not eat - I used "uranium".
Search all recipes containing "uranium".
Open these recipes and delete the empty ingredient from the ingredients' list.
Save.

Proposed solution:
a) When saving a recipe, filter for empty lines before storing in database or, alternatively
b) filter for empty lines when adding a recipe to the grocery list.

Revision history for this message
Harald Franzen (harald-franzen-lotcavediving) wrote :

Issue resolved.
Workaround provided.
Feature request remains.

Changed in gourmet:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

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