Post by Patrick K. O'BrienPost by joseph schlesingerI've recently been getting a qnav "Unable to open <database.db>"
alert box on a database.db that has been worked without problems
for probably a year or so. I get no traceback, but I think it may
be the result of the line for has in the past been used for icon
support: _import('Schevo', 'icon', 1)
because when I run schevo update I get
NameError: name '_import' is not defined.
As always, any guidance would be much appreciated.
I recently removed support for schema _import and _export because
they weren't fully implemented and I don't want to support them
until we've given them more thought. You must have updated Schevo
and now your old database file is temporarily broken. This will be
easy to fix, I just need a little bit of time to think it through.
I will try to find time to do so in the next day or two. Sorry
about the temporary breakage.
Here is the way to fix your existing database:
1. Make a backup copy of the database file in case the following
steps fail.
2. Change your schema file, replacing the line containing "_import
('Schevo', 'identity', 1)" with:
class SchevoIcon(E.Entity):
_hidden = True
name = f.unicode()
data = f.image()
_key(name)
3. From the commandline run "inject", such as:
schevo db inject --app=yourappname filetofix.db
Inject will replace the schema in the database file with the schema
specified on the commandline via the "app" or "schema" option. Make
sure that the _import stuff is the only change you have made to the
schema. Note that this command is also limited to schema_001.py
files, so if you are on schema_002.py or higher let me know and I'll
have to come up with a different workaround.
4. Immediately follow the "inject" command with an "update" command,
such as:
schevo db update --app=yourappname filetofix.db
5. Open the database in the shell or gnav and verify that everything
is okay.
In the future, make sure you aren't using _import() as it has been
removed (of course, you'll get an exception right away if you do try
to use it).
Let me know if that works for you.
--
Patrick K. O'Brien
Orbtech http://www.orbtech.com
Schevo http://www.schevo.org