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

When attempting to start a local copy (not installed with python setup.py install), paths are incorrect #867

Closed
brianredbeard opened this issue Jan 1, 2017 · 4 comments · Fixed by #1010

Comments

@brianredbeard
Copy link

Attempting to start gourmet as per the directions in CODING.md, the following error is reached:

$ ./bin/gourmet 
elib.intl failed to load.
IF YOU HAVE TROUBLE WITH TRANSLATIONS, MAKE SURE YOU HAVE THIS LIBRARY INSTALLED.
elib.intl failed to load.
IF YOU HAVE TROUBLE WITH TRANSLATIONS, MAKE SURE YOU HAVE THIS LIBRARY INSTALLED.
No gst player
No windows player
Traceback (most recent call last):
  File "./bin/gourmet", line 17, in <module>
    GourmetRecipeManager.startGUI()
  File "/home/bharrington/Projects/gourmet-src/gourmet/GourmetRecipeManager.py", line 686, in startGUI
    r=RecGui(splash_label=splash.label)
  File "/home/bharrington/Projects/gourmet-src/gourmet/GourmetRecipeManager.py", line 896, in __init__
    GourmetApplication.__init__(self, splash_label=splash_label)
  File "/home/bharrington/Projects/gourmet-src/gourmet/GourmetRecipeManager.py", line 67, in __init__
    self.setup_prefs() # Setup preferences...
  File "/home/bharrington/Projects/gourmet-src/gourmet/GourmetRecipeManager.py", line 89, in setup_prefs
    buttons={'clear_remembered_optional_button':lambda *args: self.forget_remembered_optional_ingredients()}
  File "/home/bharrington/Projects/gourmet-src/gourmet/prefsGui.py", line 60, in __init__
    self.ui.add_from_file(uifile)
glib.GError: Failed to open file '/home/bharrington/Projects/gourmet-src/gourmet/../data/ui/preferenceDialog.ui': No such file or directory

This seems to be because the UI directory thinks it's nested in the data directory which is not how the source code is structured. Changing gourmet/settings.py from ui_base = os.path.join(data_dir, 'ui') to ui_base = os.path.join(base_dir, 'ui') to seems to resolve the issue, but due to processing that the setup.py does, this may have downstream effects (hence why this does not have a PR attached).

@brianredbeard
Copy link
Author

Funny enough, this seems to be a regression in the last commit to that file, ff0db3f.

@ockham
Copy link
Collaborator

ockham commented Jan 1, 2017

@thinkle ^

@Boldie
Copy link

Boldie commented Jan 14, 2017

^^ Run into the same trouble with the ui, reverted the commit for this change and everything works again.

Additionally no plugins were found at my development install, there is a gourmet too much in the path, I thing this was introduced in commit a4a75d9. Hopefully this can be fixed soon, otherwise I am unable to develop.

PATH: ['/home/sven/workspace/gourmet/bin', '/usr/lib/python2.7/dist-packages/gst-0.10', '../..', '/home/sven/workspace/gourmet/bin', '/home/sven/workspace/gourmet', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/local/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client', '/usr/lib/python2.7/dist-packages/wx-3.0-gtk2', '/home/sven/workspace/gourmet/gourmet/../build/share/gourmet/plugins', '/home/sven/workspace/gourmet/gourmet/../gourmet/gourmet/plugins', '/home/sven/workspace/gourmet/gourmet/../gourmet/gourmet/plugins/import_export', '/home/sven/workspace/gourmet/gourmet/../build/share/gourmet/plugins/import_export']
Traceback (most recent call last):
File "/home/sven/workspace/gourmet/gourmet/plugin_loader.py", line 260, in get_module
self._loaded = import(self.module)
ImportError: No module named krecipe_plugin
WARNING: Failed to load plugin krecipe_plugin

@saxon-s
Copy link
Collaborator

saxon-s commented Jul 1, 2018

The Head of Master has 3 run time breakages:

Pull Request #910
Gourmet Version: Head of Master
Host OS: Ubuntu 18.04

1. The head of master fails to launch from source tree bin/ directory

file: ./bin/gourmet

Steps to reproduce issue:

Clean install Gourmet on Ubuntu host.
Get the latest source from master:
$ git clone https://github.com/thinkle/gourmet.git

Build localized and plugin files within build/ directory
$ python setup.py build_i18n -m

Launch gourmet from source tree:
$ bin/gourmet

Traceback (most recent call last):
  File "bin/gourmet", line 16, in <module>
    from gourmet import GourmetRecipeManager
ImportError: No module named gourmet

It appears that commit b865a1a to bin/gourmet* broke the execute path:

   -lib_dir = '.'
11 +lib_dir = '../..'

Resolution:
Reverting commit b865a1a resolves the launch issue, i.e.

   -lib_dir = '../..'
11 +lib_dir = '.'

2. Plugin path has 1 too many 'gourmet/' in path

Module: ./gourmet/ggolbals.py

Steps to reproduce issue:

Launch gourmet from souce tree:
$ bin/gourmet

Click on Settings --> Plugins

No plugins are listed in Plugin dialog.

Examine console log:

WARNING: Plugin module import failed
PATH: ['.', '/home/saxon-s/projects/gourmet/bin', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/home/saxon-s/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/gtk-2.0', './gourmet/../build/share/gourmet/plugins', './gourmet/../gourmet/gourmet/plugins', './gourmet/../gourmet/gourmet/plugins/import_export']
Traceback (most recent call last):
  File "./gourmet/plugin_loader.py", line 271, in get_module
    self._loaded = __import__(self.module)
ImportError: No module named unit_converter
WARNING: Failed to load plugin unit_converter
ERROR:root:
Traceback (most recent call last):
  File "./gourmet/plugin_loader.py", line 99, in load_active_plugins
    self.active_plugins.extend(self.available_plugin_sets[p].plugins)
  File "./gourmet/plugin_loader.py", line 284, in __getattr__
    if attr == 'plugins': return self.get_plugins()
  File "./gourmet/plugin_loader.py", line 290, in get_plugins
    return self.get_module().plugins
AttributeError: 'NoneType' object has no attribute 'plugins'

lib_dir path is incorrectly set to './gourmet/../gourmet/gourmet/' but should be './gourmet/../gourmet/'

Resolution:

Remove 'gourmet' from lib_dir path in ggolbals.py:

   -lib_dir = os.path.join(settings.lib_dir, 'gourmet')
54 +lib_dir = os.path.join(settings.lib_dir)

3. doc_dir path is broken

Module: ./gourmet/settings.py

Steps to reproduce issue:

Launch gourmet from souce tree:
$ bin/gourmet

Click on Help --> About
Examine console log:

IO Error [Errno 2] No such file or directory: './gourmet/../gourmet/LICENSE'
Traceback (most recent call last):
  File "./gourmet/GourmetRecipeManager.py", line 385, in show_about
    about.set_license(license_text)
UnboundLocalError: local variable 'license_text' referenced before assignment

Paths are set as follows:

base_dir  ./gourmet/..
lib_dir  ./gourmet/../gourmet
data_dir  ./gourmet/../data
ui_base  ./gourmet/../ui
doc_base  ./gourmet/../gourmet
locale_base  ./gourmet/../build/mo
plugin_base  ./gourmet/../build/share/gourmet
icon_base  ./gourmet/../data/icons

It appears that committ a4a75d9 to gourmet/settings.py on 2 Jan 2016 introduced the breakage. doc_dir path is set to './gourmet/' but should be set to './'

Resolution:
Remove 'gourmet' from doc_base path in settings.py, i.e.

   -doc_base = os.path.join(base_dir, "gourmet")
11 +doc_base = os.path.join(base_dir)

Verification:
These 3 fixes have been verified on Ubuntu 18.04 only and need to be verified on Windows and Mac platforms (I don't have access to Windows or Mac development environments).

This fix sets the paths as follows:

base_dir  ./gourmet/..
lib_dir  ./gourmet/../gourmet
data_dir  ./gourmet/../data
ui_base  ./gourmet/../ui
doc_base  ./gourmet/..
locale_base  ./gourmet/../build/mo
plugin_base  ./gourmet/../build/share/gourmet
icon_base  ./gourmet/../data/icons

thinkle added a commit that referenced this issue Sep 7, 2018
Fixed broken source tree run time paths (ticket #867)
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

Successfully merging a pull request may close this issue.

4 participants