thinkle / gourmet

Gourmet Recipe Manager
GNU General Public License v2.0
338 stars 139 forks source link

import causes traceback #462

Closed ockham closed 11 years ago

ockham commented 11 years ago

Converted from SourceForge issue 1216086, submitted by SourceForge user andrewziem on 2005-06-07 00:34:37 UTC.

gourmet-0.8.5.1 installed from your .RPM

When importing http://www.recipesource.com/text/soups/soups/recipe906.txt (saved to disk), this shows up on the terminal:

(Gourmet Recipe Manager:6771): libgnomevfs-CRITICAL **: file gnome-vfs-utils.c: line 749 (gnome_vfs_get_uri_from_local_path): assertion local_full_path[0] == '/'' failed /usr/share/gourmet/reccard.py:1634: GtkWarning: file gtkcomboboxentry.c: line 303 (gtk_combo_box_entry_set_text_column): assertion entry_box->priv->text_column == -1' failed self.keyBox.set_text_column(0) Traceback (most recent call last): File "/usr/share/gourmet/GourmetRecipeManager.py", line 913, in importg self.import_multiple_files(ifiles) File "/usr/share/gourmet/GourmetRecipeManager.py", line 1000, in import_multiple_files import_source=string.join([os.path.split(f)[1] for f in filenames],", ") File "/usr/share/gourmet/GourmetRecipeManager.py", line 1053, in run_import t.start() File "/usr/share/gourmet/GourmetFauxThreads.py", line 42, in start self.target_func() File "/usr/share/gourmet/GourmetFauxThreads.py", line 47, in target_func GourmetThreads.SuspendableThread.target_func(self) File "/usr/share/gourmet/GourmetThreads.py", line 31, in target_func self.c.run() File "/usr/share/gourmet/importers/importer.py", line 289, in run self.iclass.run() File "/usr/share/gourmet/importers/plaintext_importer.py", line 33, in run self.handle_line(l) File "/usr/share/gourmet/importers/mastercook_plaintext_importer.py", line 68, in handle_line if not rcm: rcm = self.look_for_reccol_headers AttributeError: mastercook_importer instance has no attribute 'look_for_reccol_headers'

ockham commented 11 years ago

Submitted by SourceForge user thomas_hinkle on 2005-06-11 13:42:13 UTC.

Logged In: YES user_id=1030390

Closing this bug out. The traceback is fixed (was just at typeout). As to the file you'd like to import -- the best I can ask of Gourmet is to not lose the data and just put the ingredients in the instructions. In this case, it's a question of a badly broken file (which claims to be one type of file (mastercook) but then looks more like another (mealmaster).

ockham commented 11 years ago

Submitted by SourceForge user thomas_hinkle on 2005-06-07 14:59:34 UTC.

Logged In: YES user_id=1030390

Ah -- it looks to be a pretty badly broken mastercook file. It has a mastercook style header, but then mealmaster-style ingredient delimiting.

Usually in mastercook files, those big capitalized headers designate the columns where Amount/Measure/Ingredient are stored.

In the file you pointed to, the columns are completely misaligned. Actually, looking closely shows that 1 1/2 ts Worcestire sauce breaks even the normal mealmaster pattern.

Each release I try to make Gourmet a bit smarter about ingredients. It's a tricky problem because the smartness will inevitably break something. For example, according to gourmet, the ingredients in the linked-to file look just like instructions (i.e. they're not broken into ingredient fields properly). I can of course make Gourmet check all instructions to see if they look like ingredients, but this will inevitably break sometimes. A past version, for example, would sometimes read "Cook at \n 325 degrees celsisus for ...\n45 minutes or until browned" as one line of instructions ("cook at") and two lines of ingredients ("325 degrees...", "45 minutes.").

I've tried to get away from doing too much "smart" processing because the kinds of errors I just mentioned severely break the UI "principle of least astonishment". The kind of ugly import you have is annoying, but at least easily remedied. If you select the ingredients from the instructions and copy them, you can then paste them into ingredient list with the "Paste Ingredient List" button on the toolbar in the ingredient list. (C-v should also work, but I believe it isn't).

Tom

ockham commented 11 years ago

Submitted by SourceForge user andrewziem on 2005-06-07 14:01:48 UTC.

Logged In: YES user_id=500759

There are a set of dashes under the the header. I posted the URL in the original report.

With the fix, it imports the recipe without a traceback, but all the ingredients go in the instructions.

ockham commented 11 years ago

Submitted by SourceForge user thomas_hinkle on 2005-06-07 00:46:26 UTC.

Logged In: YES user_id=1030390

Simple typo -- fixed in CVS. If you want to fix quickly for change look_for_reccol_headers to reccol_headers on line 68 of /usr/share/gourmet/importers/mastercook_plaintext_importer.py

I assume this means, btw, that you have a mastercook file that has

Amount Measure Ingredient

but no


underneath it.