Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export failure - html and mealmaster formats #372

Open
eliotb opened this issue Aug 18, 2021 · 3 comments
Open

Export failure - html and mealmaster formats #372

eliotb opened this issue Aug 18, 2021 · 3 comments

Comments

@eliotb
Copy link

eliotb commented Aug 18, 2021

Exporting all recipes to Mealmaster or HTML fails.
(Gourmet XML, PDF, plain text, epub, mycookbook mcb succeed)

Note: PDF export also failed until I deleted my old toml configuration files.

Steps to Reproduce

  1. File/Export all recipes
  2. Choose format HTML or Mealmaster
  3. Click OK

Expected Behavior

Export file(s) is created.

Current Behavior

In both cases there is a pale blue info bar in the GUI says Export (format), Cancel and Details buttons.
Cancel button does not work. Details button pops up dialog box.
Traceback is also seen in the terminal.

HTML export:

writing css to /home/eliot/documents/recipes/recipes_html/style.css
Return exporter instance
emit error 1 Error during Exporter Traceback (most recent call last):
File "/home/eliot/src/python/gourmet/src/gourmet/threadManager.py", line 104, in run
self.do_run()
File "/home/eliot/src/python/gourmet/src/gourmet/plugin_loader.py", line 440, in _
retval = f(self,*args,**kwargs)
File "/home/eliot/src/python/gourmet/src/gourmet/exporters/exporter.py", line 576, in do_run
fn = self.generate_filename(r, self.ext, add_id=True)
File "/home/eliot/src/python/gourmet/src/gourmet/exporters/exporter.py", line 610, in generate_filename
for c in title:
TypeError: 'NoneType' object is not iterable

Mealmaster export:

DEBUG: /home/eliot/src/python/gourmet/src/gourmet/plugins/import_export/mealmaster_plugin/mealmaster_exporter.py: 98 write_grouphead called with Dressing
emit error 1 Error during Exporter Traceback (most recent call last):
File "/home/eliot/src/python/gourmet/src/gourmet/threadManager.py", line 104, in run
self.do_run()
File "/home/eliot/src/python/gourmet/src/gourmet/plugin_loader.py", line 440, in _
retval = f(self,*args,**kwargs)
File "/home/eliot/src/python/gourmet/src/gourmet/exporters/exporter.py", line 582, in do_run
e.do_run()
File "/home/eliot/src/python/gourmet/src/gourmet/exporters/exporter.py", line 89, in do_run
elif task=='ings': self.write_ings()
File "/home/eliot/src/python/gourmet/src/gourmet/plugin_loader.py", line 440, in _
retval = f(self,*args,**kwargs)
File "/home/eliot/src/python/gourmet/src/gourmet/exporters/exporter.py", line 190, in write_ings
self.write_ingfoot()
File "/home/eliot/src/python/gourmet/src/gourmet/plugins/import_export/mealmaster_plugin/mealmaster_exporter.py", line 148, in write_ingfoot
self.out.write("-----%s%s%s\r\n"%(left_side * "-",
TypeError: can't multiply sequence by non-int of type 'float'

emit done

Possible Solution

None as yet. A general question: How can I run gourmet from a git checkout inside a debugger?

Environment

  • Operating System: Ubuntu 20.04
  • Version or commit id: ba7b25f
  • Installed as Flatpak or Python package?: From git checkout
  • Deleted .toml config files before running gourmet.
@cydanil
Copy link
Collaborator

cydanil commented Aug 19, 2021

Thanks for the detailed report!

The mealmaster export issue I did not catch, nice!
I suppose I have even title lengths in the recipes I test with...

The solutions is to floor or cast to in the divisions above:

left_side = int(dashes / 2 - 5)
right_side = int(dashes / 2)

You can launch Gourmet in a debugger either by using PyCham (the easiest), or by using pdb.

PyCharm

  • Clone the repo, and install it in a virtual environment as described in contributing.md

  • Open the folder in PyCharm. This should prompt you to create a project.

  • In the project, you can define Run/Debug Configurations:
    image

  • Check the Pycharm Debugger documentation on how to set breakpoints and step through the application.

PDB

  • Clone the repo, and install it in a virtual environment as described in contributing.md

  • Check this RealPython PDB tutorial which is rather exhaustive :)
    You can launch Gourmet by doing python src/gourmet/main.py or python -m gourmet

@eliotb
Copy link
Author

eliotb commented Aug 20, 2021

Thanks for the detailed reply.

Turns out using the debugger is not so straightforward for this problem, because the exceptions are caught for display in the DETAILS dialog. Once this traceback happens, the blue notification bar (does this have a proper name?) cannot be dismissed using the CANCEL button.

For the HTML, I should have paid more attention to the traceback. It turns out I had a recipe with no title in my collection. Once I removed that one, the export worked fine. I'm not sure where that should be validated.

For Mealmaster, I'll admit I'm not personally interested in exporting to that format, once i started checking formats, i did it for completeness.

I notice you link to https://github.com/GourmandRecipeManager/gourmand/ rather than this repo. What should I be using as upstream?

@cydanil
Copy link
Collaborator

cydanil commented Aug 20, 2021

Hey Eliot,
Yes, I decided for fork the project, as the original maintainers are moving on and we cannot squat the Gourmet name.

I'm still going to be active here, but I would prefer to slowly move to Gourmand ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants