thinkle / gourmet

Gourmet Recipe Manager
GNU General Public License v2.0
339 stars 137 forks source link

database error: AttributeError: 'NoneType' object has no att #232

Open ockham opened 11 years ago

ockham commented 11 years ago

Converted from SourceForge issue 3586056, submitted by SourceForge user merlsub on 2012-11-10 17:22:53 UTC.

i am trying to export my database to html (something i do with some frequency). recently, the export started failing with the error stack below.

i'm on ubuntu (precise) running gourmet 0.15.9. if there's any other diagnostic info you'd like, please let me know. happy to provide my db if it will help.

thanks!

Traceback (most recent call last): File "/usr/share/gourmet/gourmet/threadManager.py", line 97, in run self.do_run() File "/usr/share/gourmet/gourmet/pluginloader.py", line 372, in retval = f(self,args,kwargs) File "/usr/share/gourmet/gourmet/exporters/exporter.py", line 555, in do_run self.append_referenced_recipes() File "/usr/share/gourmet/gourmet/exporters/exporter.py", line 529, in append_referenced_recipes 'select \ from ingredients where recipe_id=? and refid is not null',r.id AttributeError: 'NoneType' object has no attribute 'id'

ockham commented 11 years ago

Submitted by SourceForge user enfant_terrible on 2012-12-06 20:24:00 UTC.

Glad to hear you tracked it down yourself!

I will actually leave this bug open as a reminder for implementing a warning as you're suggesting.

ockham commented 11 years ago

Submitted by SourceForge user merlsub on 2012-11-30 19:27:07 UTC.

ALAS, user solved self... thanks to some useful logging... i started gourmet in the terminal... at start-up it reported a very useful error:

Very odd: no match for (2055, 172, 171, u'recipe', 1, None, u'Mango-Cucumber Salsa', u'Mango-Cucumber Salsa', False, None, None, 7, False) refid: 171

so, i went to that recipe, found it referenced a recipe i did not have anymore (probably had deleted it)... i deleted that recipe ingredient, and i'm back to being a happy camper, er, cooker.

i will leave this issue for you to close... for robustness, it would be useful if in this condition, you would throw an error that a referenced recipe ingredient does not exist, so it is more obvious to the user what the data integrity problem is.

thanks!

ockham commented 11 years ago

Submitted by SourceForge user merlsub on 2012-11-30 18:59:19 UTC.

thanks for taking a look at my db bernhard. i wired thomas money mostly in arrears for appreciation of this app... i will wire you more if you can get me a clean export to xml.

ockham commented 11 years ago

Submitted by SourceForge user merlsub on 2012-11-28 07:10:55 UTC.

thanks e_t -- too big to upload here, but you can grab it at http://merl.us/tmp/recipes.db.gz

ockham commented 11 years ago

Submitted by SourceForge user enfant_terrible on 2012-11-26 23:19:27 UTC.

merlsub, could you post your db here as an attachment?

ockham commented 11 years ago

Submitted by SourceForge user merlsub on 2012-11-20 18:27:27 UTC.

thomas, i just sent you $20 for a beer fix... even export to xml is failing with the same error. do you think there is a problem w/ my db? it seems to be when building the list for referenced receipes (i have a few of those). i can send you my db export or anything you need to assist in the fix. thanks for an awesome app!

ockham commented 11 years ago

Submitted by SourceForge user merlsub on 2012-11-18 16:24:12 UTC.

bump. any chance of help on this one thomas? i will send you an e-case of beer.