USDA database import failure
I tried the steps listed on " restart USDA database download". Now, when I try to activate the Nutritional Information plugin, Reading Nutritional Data very quickly reads 7143 entries. But, it then freezes on Reading Weight Data on 0 of 7143 entries.
At this point, the only fix is to delete the ~/.gourmet folder and restore from backup.
Your instructions had the user delete the tables nutrition, nutritionaliases, and nutritionconver
Thanks for your help!
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Gourmet Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Thomas M. Hinkle
- Solved:
- Last query:
- Last reply:
Revision history for this message
![]() |
#1 |
Part of the problem is, the database creates a table named usda_weights_temp, but the python code seems to be looking for usda_weights.
Revision history for this message
![]() |
#2 |
This question was expired because it remained in the 'Open' state without activity for the last 15 days.
Revision history for this message
![]() |
#3 |
This problem still exists. The perl script is looking for a table which
doesn't exist in the database. I tried renaming the temp table with the
permanent table name, but then I get an error that immutable object is
immutable.
Please fix this bug! -- I really need to be able to generate nutritional
information on my recipes.
Thank you!!
> Your question #240599 on Gourmet changed:
> https:/
>
> Status: Open => Expired
>
> Launchpad Janitor expired the question:
> This question was expired because it remained in the 'Open' state
> without activity for the last 15 days.
>
> --
> If you're still having this problem, you can reopen your question either
> by replying to this email or by going to the following page and
> entering more information about your problem:
> https:/
>
> You received this question notification because you asked the question.
>
Revision history for this message
![]() |
#4 |
Sorry for not replying sooner, and for letting this question expire.
I'll certainly look into the nutrition data plugin, which currently seems notoriously buggy -- part of which might be due to it employing multiple threads to gather and process data in order to allow the user continue working with the program. (I've been just a bit busy working on a Windows release lately so I haven't found the time yet.)
Revision history for this message
![]() |
#5 |
Yay! If I can help by testing/etc, let me know. Thank you!
Revision history for this message
![]() |
#6 |
My guess is something went wrong with update code somewhere since this involves a temp table. It looks like the code has an update for the weight version between Gourmet versions < 0.14 and those thereafter. This is probably what broke. Any chance you can reproduce the error running from a terminal and post the output/debug info?
Revision history for this message
![]() |
#7 |
tmk@Freedom ~ $ gourmet
sqlite:
RECREATE USDA WEIGHTS TABLE
Attempting to alter usda_weights <bound method NutritionDataPl
Problem updating plugin <nutritional_
WARNING: PLUGIN FAILED TO LOAD <nutritional_
Traceback (most recent call last):
File "/usr/share/
plugin_
File "/usr/share/
db.
File "/usr/share/
plugin_current = plugin.version,
File "/usr/share/
[name for lname,name,typ in parser_
File "/usr/share/
del self.metadata.
File "/usr/lib/
raise TypeError("%s object is immutable" % self.__
TypeError: immutabledict object is immutable
Grabbing nutrition database!
Error appending {'seq': 1.0, 'ndbno': 1001, 'amount': 1.0, 'unit': u'cup', 'gramwt': 227.0} to usda_weights_table
WARNING: PLUGIN FAILED TO LOAD <nutritional_
Traceback (most recent call last):
File "/usr/share/
plugin_
File "/usr/share/
nutritionGr
File "/usr/share/
dgg.load_db()
File "/usr/share/
self.
File "/usr/share/
os.
File "/usr/share/
self.
File "/usr/share/
self.
File "/usr/share/
return self.do_
File "/usr/share/
result_proxy = insert_
File "/usr/lib/
return e._execute_
File "/usr/lib/
return connection.
File "/usr/lib/
compiled_sql, distilled_params
File "/usr/lib/
context)
File "/usr/lib/
context)
File "/usr/lib/
cursor.
OperationalError: (OperationalError) no such table: usda_weights u'INSERT INTO usda_weights (ndbno, seq, amount, unit, gramwt) VALUES (?, ?, ?, ?, ?)' (1001, 1.0, 1.0, u'cup', 227.0)
Revision history for this message
![]() |
#8 |
Ok -- this is helpful and confirms my suspicion. It looks like the update
code is failing on the line }
del self.metadata.
I see a note in the latest db.py that newer SQLAlchemy versions (>=0.7)
don't allow this syntax, and then I see a line below it fixing it.
I'm not sure what version you're running, but a quick hack to try to fix
your issue might be to open db.py and make the following change:
REMOVE>>> del self.metadata.
INSERT >>> self.metadata.
Tom
On Sun, Jan 5, 2014 at 2:06 PM, Theresa Kehoe <
<email address hidden>> wrote:
> Question #240599 on Gourmet changed:
> https:/
>
> Status: Needs information => Open
>
> Theresa Kehoe gave more information on the question:
> tmk@Freedom ~ $ gourmet
> sqlite:
> RECREATE USDA WEIGHTS TABLE
> Attempting to alter usda_weights <bound method
> NutritionDataPl
> <nutritional_
> 0x28e7b00>> {} ['ndbno', 'seq', 'amount', 'unit', 'gramwt', 'ndata',
> 'stdev']
> Problem updating plugin
> <nutritional_
> 0x28e7b00> nutritondata
> WARNING: PLUGIN FAILED TO LOAD
> <nutritional_
> 0x28e7b00>
> Traceback (most recent call last):
> File "/usr/share/
> plugin_plugin
> plugin_
> File "/usr/share/
> db.update_
> File "/usr/share/
> update_
> plugin_current = plugin.version,
> File
> "/usr/share/
> line 68, in update_version
> [name for lname,name,typ in parser_
> File "/usr/share/
> alter_table
> del self.metadata.
> File "/usr/lib/
> line 38, in _immutable
> raise TypeError("%s object is immutable" % self.__
> TypeError: immutabledict object is immutable
> Grabbing nutrition database!
> Error appending {'seq': 1.0, 'ndbno': 1001, 'amount': 1.0, 'unit':
> u'cup', 'gramwt': 227.0} to usda_weights_table
> WARNING: PLUGIN FAILED TO LOAD
> <nutritional_
> 0x297ac20>
> Traceback (most recent call last):
> File "/usr/share/
> plugin_plugin
> plugin_
> File
> "/usr/share/
> line 13, in activate
> nutritionGrabbe
> File
> "/usr/share/
> line 70, in check_for_db
> dgg.load_db()
> File
> "/usr/share/
> line 39, in load_db
> self.grab_
> File
> "/usr/share/
> line 99, in grab_data
> os.path.
> File
> "/usr/share/
> line 86, in get_weight
> self.parse_
> File
> "/usr/share/
> line 199, in parse_weightfile
> self.db.
> File "/usr/share/
> do_add_fast
> return self.do_
> File "/usr/share/
> result_proxy = insert_
> File "/usr/lib/
> line 2734, in execute
> return e._execute_
> File "/usr/lib/
> 2304, in _execute_
> return connection.
> File "/usr/lib/
> 1538, in _execute_
> compiled_sql, distilled_params
> File "/usr/lib/
> 1646, in _execute_context
> context)
> File "/usr/lib/
> 1639, in _execute_context
> context)
> File "/usr/lib/
> line 330, in do_execute
> cursor.
> OperationalError: (OperationalError) no such table: usda_weights u'INSERT
> INTO usda_weights (ndbno, seq, amount, unit, gramwt) VALUES (?, ?, ?, ?,
> ?)' (1001, 1.0, 1.0, u'cup', 227.0)
>
> --
> You received this question notification because you are a direct
> subscriber of the question.
>
Revision history for this message
![]() |
#9 |
Ok -- this is helpful and confirms my suspicion. It looks like the update code is failing on the line }
del self.metadata.
I see a note in the latest backends/db.py that newer SQLAlchemy versions (>=0.7) don't allow this syntax, and then I see a line below it fixing it.
I'm not sure what version you're running, but a quick hack to try to fix your issue might be to open db.py and make the following change:
REMOVE>>> del self.metadata.
INSERT >>> self.metadata.
See if you can make those changes in your source code and if that fixes things or not.