2007/11/17, James G. Sack (jim) <jgsack@san.rr.com>:
I recently fixed bug #1558
  0001358: (CLI) left-over imp_db_path files cause spurious errors in
subsequent CLI testing

I noticed that 2.2.x used a temporary grdb _file_
  imp_db_path = os.path.join(impdir_path,"import_db.grdb")
  (giving in *nix) imp_db_path = "~/.gramps/import/import_db.grdb"
to use for temporary db file when doing an import via command-line
whereas 3.0 used the same name (imp_db_path) for a _directory_
containing multiple db files used for the same temporary purpose.


I would say, remove the import dir if it exists, then create it.
No need for a self written function, you can use (http://docs.python.org/lib/module-shutil.html )

import shutil
shutil.rmtree(self.impdir_path)

that's it.

3.0 no longer works with .grdb files, so this functionality had to change

Upon browsing the buglist I now find some related issues:
==>  0001096: Cannot rewrite on existing .gramps/grampsdb/xxx.gpkg.media
directory

which as rj remarked, duplicates #1378
==>  0001378: import pkg crashes on existing temp dir

This is not the same as you write in your other mail. The bug exists in 2.2. too, and needs to be solved equally in both branches. Media files are stored in correct directory structure, so dirs can appear instead of only files:
WritePkg.py:
            mobject = self.db.get_object_from_handle(m_id)
            filename = str(mobject.get_path())
            if os.path.isfile(filename):
                archive.add(filename)

Well, I did not fully research, but I read it like that.

I kind of ignored this difference between the same name being used as a
2.2.x file and a 3.0 directory, (I suppose) because I was thinking that
only developers would do something silly like bouncing back-and-forth
between running 2.2.x and 3.0.

So not related. However, for 3.0 we will need a big patch to solve the relative path question, which here is important (and probably also on import to have media paths ok)

Perhaps I should have made more noise at the time, eh

Anyway, bug #1096 occurs in plugin code that replicates code in
ArgHandler (that I changed in bugfix #1358) -- that _could_ be changed
to look like the current ArgHandler code

  ==> although maybe there's a better solution to avoid all plugins
  having to duplicate the same code. If this is a problem for other
  plugins, then an additional question what to do here maybe gramps
  should always "cleanup" that temporary workspace on startup? Maybe
  there should be something else for plugins to query for a name to
  use for temporary "import" space.

And bug #1378 is caused by 3.0 making a directory where 2.2.x expects a
file.


Heres what I'd like to get some input about:

==> Should we change the 3.0 code to use a different name for the subdir
so that it doesn't collide with the file used by 2.2.x. Then bouncing
back-and-forth would be harmless (I think -- hmmm, is this right?).

I think it depends from problem to problem, hard  to say what is correct. Eg, in the import grdb case, we can always start with removing the temp dir if it was not clean. For the media path bug, we cannot do that as it is not a temp dir, the media files are stored in it.

Going back and changing 2.2.x code doesn't seem right, but a (another)
3.0 mod seems more tolerable.

but should, preferably,  be possible.

Benny