thinkle / gourmet

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

Import broken in 0.8.0-prerelease? #434

Closed ockham closed 11 years ago

ockham commented 11 years ago

Converted from SourceForge issue 1149635, submitted by SourceForge user nobody on 2005-02-23 08:14:57 UTC.

I'm unable to import recipes in 0.8.0-prerelease, I get different errors depending on how I try to import the recipes.

When importing a test recipe (text format) that has been exported from 0.8.0_prerelease, I get the following error message:

Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/gourmet/GourmetThreads.py", line 26, in target_func self.c.run() File "/usr/lib/python2.3/site-packages/gourmet/importer.py", line 237, in run self.iclass.run() File "/usr/lib/python2.3/site-packages/gourmet/mealmaster_importer.py", line 85, in run self.handle_line(l) File "/usr/lib/python2.3/site-packages/gourmet/mealmaster_importer.py", line 185, in handle_line if self.in_variation: AttributeError: mmf_importer instance has no attribute 'in_variation'

When importing a collection of 5 recipes that have been exported from 0.7.1 in mealmaster format I get the following error: (I get a very similar error when I try to import the same recipes in xml format)

Traceback (most recent call last): File "/usr/lib/python2.3/site-packages/gourmet/GourmetThreads.py", line 26, in target_func self.c.run() File "/usr/lib/python2.3/site-packages/gourmet/importer.py", line 237, in run self.iclass.run() File "/usr/lib/python2.3/site-packages/gourmet/mealmaster_importer.py", line 85, in run self.handle_line(l) File "/usr/lib/python2.3/site-packages/gourmet/mealmaster_importer.py", line 136, in handle_line self.new_rec() File "/usr/lib/python2.3/site-packages/gourmet/mealmaster_importer.py", line 217, in new_rec self.commit_rec() File "/usr/lib/python2.3/site-packages/gourmet/mealmaster_importer.py", line 237, in commit_rec self.parse_inglist() File "/usr/lib/python2.3/site-packages/gourmet/mealmaster_importer.py", line 411, in parse_inglist self.add_item(item) File "/usr/lib/python2.3/site-packages/gourmet/mealmaster_importer.py", line 386, in add_item self.ing['ingkey']=self.km.get_key_fast(key_base) File "/usr/lib/python2.3/site-packages/gourmet/keymanager.py", line 78, in get_key_fast return defaults.kd[str][0] AttributeError: 'module' object has no attribute 'kd'

Also, when using 0.8.0-prerelease, all of my recipes are not in the database. Downgrading to 0.7.1 makes them reappear (this may be intentional behaviour?). This leads to me trying to import them into the new version, with the above results.

Potentially relevant package versions are: python-2.3.5 pygtk-2.4.1 gnome-python-2.6.1 libglade-2.4.1 metakit-2.4.9.3 imaging-1.1.4

ockham commented 11 years ago

Submitted by SourceForge user nobody on 2005-02-24 06:28:27 UTC.

Logged In: NO

After I post that huge error dump, I figure it out.

gourmet-0.7.1 was using 'recipes.mk', but gourmet-0.8.0-prerelease was using 'recipe.mk'. Copying the old database over the new and restarting caused the new version to correctly recognize and convert the database.

In case you are worried that all I have is complaints, I really like the new recipe card interface :)

ockham commented 11 years ago

Submitted by SourceForge user nobody on 2005-02-24 06:22:03 UTC.

Logged In: NO

If I'm the only one having the recipes not found when upgrading problem, it's not a big deal, I have all of five recipes.

I tried (as root, to prevent it from being a permissions issue (I hacked up an ebuild for the 0.8.0-prerelease, which could be causing the problem)) starting from a new database in 0.7.1, adding a test recipe, then uprading to 0.8.0-prerelase, then opening gourmet. The recipe was not present in the newer version. There was no error output, aside from the gconf error I always recieve when running gourmet from a console, which is reproduced below.

(Gourmet Recipe Manager:8022): GConf-CRITICAL **: file gconf-client.c: line 547 (gconf_client_add_dir): assertion `gconf_valid_key (dirname, NULL)' failed {u'category': 'category', u'cuisine': 'cuisine', u'rating': 'rating', u'title': 'title', u'source': 'source', u'ingredient': 'ingredient'}

To be more specific, in case of my regular recipe collection, it wasn't finding some but not all of my recipes, there were no recipes in the new database. Below is the output of 'gourmet -vvv' when run from a console, with a database (of one recipe) that was created in 0.7.1.

DEBUG: /usr/lib/python2.3/site-packages/gourmet/gglobals.py: 40 gourmetdir=/root/.gourmet DATABASE BACKEND = metakit Using metakit DEBUG: /usr/lib/python2.3/site-packages/gourmet/gglobals.py: 105 using GourmetThreads DEBUG: /usr/lib/python2.3/site-packages/gourmet/GourmetRecipeManager.py: 47 No RTF support DEBUG: /usr/lib/python2.3/site-packages/gourmet/GourmetRecipeManager.py: 1112 showing splash screen... DEBUG: /usr/lib/python2.3/site-packages/gourmet/GourmetRecipeManager.py: 59 Debug level: 3 DEBUG: /usr/lib/python2.3/site-packages/gourmet/GourmetRecipeManager.py: 152 Setting splash text: Loading window preferences... DEBUG: /usr/lib/python2.3/site-packages/gourmet/GourmetRecipeManager.py: 152 Setting splash text: Loading graphical interface... DEBUG: /usr/lib/python2.3/site-packages/gourmet/GourmetRecipeManager.py: 67 gladebase is: /usr/share/gourmet DEBUG: /usr/lib/python2.3/site-packages/gourmet/GourmetRecipeManager.py: 152 Setting splash text: Loading recipe database... DEBUG: /usr/lib/python2.3/site-packages/gourmet/GourmetRecipeManager.py: 357 init_recipes (self, xml=None, db=None, mmf=None, defaultxml='recs.xml'): DEBUG: /usr/lib/python2.3/site-packages/gourmet/rmetakit.py: 13 RecData.init() DEBUG: /usr/lib/python2.3/site-packages/gourmet/rmetakit.py: 20 using file: /root/.gourmet/recipe.mk DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 13 setting up tables DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 33 rview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 34 rview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 52 iview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 69 sview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 75 scview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 81 pview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 86 metaview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 92 cdview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 96 cview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 100 cuview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 104 uview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 15 done setting up tables DEBUG: initialize_connection + setup_tables TOOK 0.041464805603 SECONDS DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 388 recipeManager.init() DEBUG: /usr/lib/python2.3/site-packages/gourmet/rmetakit.py: 20 using file: /root/.gourmet/recipe.mk DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 13 setting up tables DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 33 rview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 34 rview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 52 iview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 69 sview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 75 scview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 81 pview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 86 metaview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 92 cdview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 96 cview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 100 cuview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 104 uview DEBUG: /usr/lib/python2.3/site-packages/gourmet/rdatabase.py: 15 done setting up tables DEBUG: initialize_connection + setup_tables TOOK 0.027156829834 SECONDS

(Gourmet Recipe Manager:7987): GConf-CRITICAL **: file gconf-client.c: line 547 (gconf_client_add_dir): assertion `gconf_valid_key (dirname, NULL)' failed DEBUG: /usr/lib/python2.3/site-packages/gourmet/reccard.py: 1538 start setup_comboboxen() DEBUG: /usr/lib/python2.3/site-packages/gourmet/GourmetRecipeManager.py: 152 Setting splash text: Setting up recipe index... {u'category': 'category', u'cuisine': 'cuisine', u'rating': 'rating', u'title': 'title', u'source': 'source', u'ingredient': 'ingredient'} DEBUG: /usr/lib/python2.3/site-packages/gourmet/treeview_extras.py: 220 I don't know about column titled DEBUG: /usr/lib/python2.3/site-packages/gourmet/treeview_extras.py: 220 I don't know about column titled Title DEBUG: /usr/lib/python2.3/site-packages/gourmet/treeview_extras.py: 220 I don't know about column titled Category DEBUG: /usr/lib/python2.3/site-packages/gourmet/treeview_extras.py: 220 I don't know about column titled Cuisine DEBUG: /usr/lib/python2.3/site-packages/gourmet/treeview_extras.py: 220 I don't know about column titled Rating DEBUG: /usr/lib/python2.3/site-packages/gourmet/treeview_extras.py: 220 I don't know about column titled Source DEBUG: /usr/lib/python2.3/site-packages/gourmet/treeview_extras.py: 220 I don't know about column titled Servings DEBUG: /usr/lib/python2.3/site-packages/gourmet/treeview_extras.py: 220 I don't know about column titled Preparation Time DEBUG: /usr/lib/python2.3/site-packages/gourmet/treeview_extras.py: 220 I don't know about column titled Cooking Time DEBUG: /usr/lib/python2.3/site-packages/gourmet/Undo.py: 282 gui_update DEBUG: /usr/lib/python2.3/site-packages/gourmet/Undo.py: 306 Nothing to undo, desensitizing widgets DEBUG: /usr/lib/python2.3/site-packages/gourmet/Undo.py: 268 set_sensitive DEBUG: /usr/lib/python2.3/site-packages/gourmet/Undo.py: 272 <gtk.ImageMenuItem object (GtkImageMenuItem) at 0x418a1644>.set_sensitive succeeded DEBUG: /usr/lib/python2.3/site-packages/gourmet/Undo.py: 268 set_sensitive DEBUG: /usr/lib/python2.3/site-packages/gourmet/Undo.py: 272 <gtk.ImageMenuItem object (GtkImageMenuItem) at 0x418a161c>.set_sensitive succeeded DEBUG: /usr/lib/python2.3/site-packages/gourmet/Undo.py: 268 set_sensitive DEBUG: /usr/lib/python2.3/site-packages/gourmet/Undo.py: 272 <gtk.MenuItem object (GtkMenuItem) at 0x418a166c>.set_sensitive succeeded DEBUG: /usr/lib/python2.3/site-packages/gourmet/GourmetRecipeManager.py: 152 Setting splash text: Done! DEBUG: /usr/lib/python2.3/site-packages/gourmet/GourmetRecipeManager.py: 1149 hiding splash screen.

ockham commented 11 years ago

Submitted by SourceForge user thomas_hinkle on 2005-02-24 04:05:08 UTC.

Logged In: YES user_id=1030390

Just noticed the above:

"Also, when using 0.8.0-prerelease, all of my recipes are not in the database. Downgrading to 0.7.1 makes them reappear (this may be intentional behaviour?). This leads to me trying to import them into the new version, with the above results."

If you run 0.8.0-prerelease from a console, did you see any error output when it tried to translate the old DB to the new? I can't see why it would have managed to get some but not all of your old recipes.

Tom

ockham commented 11 years ago

Submitted by SourceForge user thomas_hinkle on 2005-02-24 03:21:26 UTC.

Logged In: YES user_id=1030390

Thanks for the report.

I'm not sure how the first error didn't show up for me when I was developing/testing this, but so it is -- basically in_variation needs to be defined early -- I'll upload the fix. In the mean time, you can add the following around line 58 of mealmaster_importer.py self.in_variation=False

The second error is the result of a typo:

line 78, in get_key_fast return defaults.kd[str][0] AttributeError: 'module' object has no attribute 'kd'

If you open the file keymanager.py and change "kd" to "keydic" in line 78, it will work properly (I'll also upload a fixed tarball soon).