Can't import old .mk file

  • acattelan

    acattelan - 2007-04-20

    I'm sorry but I'm again lost with a problem I can't solve. I've been using Gourmet for quite some time now but was never able to start using the new versions with the .db format. I've been stuck with some old version still saving recipes in the .mk format, but today I've installed Ubuntu 7.04 and was looking forward to move on with Gourmet as well.

    Now, the problem, as I said, is that I can't upgrade to this version... Can anybody help me convert the file to the new version or tell me how to do it?


    • tom

      tom - 2007-04-20

      Gourmet should recognize your .mk file and convert it, assuming you still have python-metakit installed and assuming the upgrade works. In your case, it sounds like the upgrade didn't work.

      If the upgrade failed the last time you installed, the first thing I'd do with a fresh install is clear out ~/.gourmet/GOURMET_DATA_DUMP and any other files with similar names. Those files are from Gourmet's first (presumably failed) attempt to convert your DB to the new format. Then make sure you don't have a recipes.db file sitting in ~/.gourmet/ -- if you do, Gourmet will use that and not bother looking for old .mk files.

      Once those things are cleaned out, you can try an upgrade. If you have a ton of data you're worried about preserving, you might make a backup copy of ~/.gourmet/ just to be on the safe side, although Gourmet shouldn't corrupt the file when upgrading.

      Then go ahead and run the latest Gourmet. If you get an error message, please file a bug report with the error message attached. Also, you can e-mail me (the author) your database file if this is the case -- it will help me figure out what broke in the upgrade, and it's likely I'll be able to send you back a converted and working database.

      Finally, as a last resort, you can always export a Gourmet XML file from the old version and then re-import when you start up -- you'll lose shopping categories and other data this way, but it's better than nothing.

    • acattelan

      acattelan - 2007-04-21

      Thanks, you gave me a good hint there! All I needed was to install python-metakit: after installing it, Gourmet updated my recipe database to the latest format and worked perfectly on Ubuntu. I have some problems on Mandriva, though. When I launch Gourmet I get the following error:

      $ gourmet
      Traceback (most recent call last):
        File "/usr/bin/gourmet", line 13, in <module>
          from gourmet.OptionParser import *
      ImportError: No module named gourmet.OptionParser


      • tom

        tom - 2007-04-22

        Glad the upgrade worked! It's tricky to set up because Gourmet doesn't require python-metakit anymore, so I don't want to make it a requirement, but it is required for the upgrade to work.

        The Mandriva error suggests gourmet wasn't properly installed -- OptionParser is the first thing Gourmet happens to try to import from the gourmet namespace. My guess is that gourmet's python files are not in fact installed, though somehow the /usr/bin/gourmet is still around. There are a number of possibilities, among them that gourmet got installed in /usr/local/python2.x/site-packages and mandriva's python isn't set up to look in /usr/local/... by default, or that Gourmet is installed in /usr/local/python2.4/.../ and mandriva has upgraded to python2.5. As I said, there are quite a few ways this could go wrong, but if you look around, it's almost a sure thing that the python source files are not where they should be.

    • acattelan

      acattelan - 2007-04-24

      Gourmet got installed in /usr/bin, or at least that's what I understand from here:

      $ whereis gourmet
      gourmet: /usr/bin/gourmet /usr/share/gourmet

      Python is found here:

      $ whereis python
      python: /usr/bin/python /usr/bin/python2.5 /usr/lib/python2.5 /usr/lib/python2.4 /usr/share/man/man1/python.1.bz2

      Is there any way to tell Gourmet to look for the python libraries where they are?
      Or is there any other way around this issue?


      • tom

        tom - 2007-04-24

        If your python libraries got installed in /usr/share/ (which is the debian style of packaging Gourmet and a simple way to avoid making packages nailed to a single the python version), then gourmet should be finding the libraries -- there's a line at the beginning of /usr/bin/gourmet that adds /usr/share/ to path (so that when gourmet tries to import it's libraries with import it works). You can check if there are any .py files in gourmet or not.

        If there are no .py files in /usr/share/gourmet you should check for a gourmet directory in /usr/lib/python2.x/site-packages/

        It seems likely that what has happened is you've installed gourmet with python2.4 (into /usr/lib/python2.4/site-packages/gourmet/) and now the system default is python2.5.

        When you install gourmet, you can have it put it's .py files into /usr/share (the way debian distributions do) by using the following:

        python install --install-lib /usr/share

    • acattelan

      acattelan - 2007-04-24

      I've installed gourmet using the command:
      # urpmi gourmet
      So the installer did everything for me.

      Now, I've seen that there's a gourmet directory in here:
      $ ls /usr/lib/python2.4/site-packages/
      gourmet/**  PyRTF/

      Mandriva uses python 2.5, though.
      Is there any solution to this or am I better off installing gourmet from your package?

      • tom

        tom - 2007-04-24

        You can change the line at the top of gourmet to use python2.4 or you can install from source into python2.5 (in which case you'll have to take care of any dependency issues on your own)

    • tom

      tom - 2007-04-24

      Sorry -- that wasn't very clear. I mean the line at the top of /usr/bin/gourmet


      can become



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks