Discussion:
icon support problems again?
joseph schlesinger
2007-01-26 19:42:49 UTC
Permalink
I'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.
Patrick K. O'Brien
2007-01-28 18:16:43 UTC
Permalink
Post by joseph schlesinger
I'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.

---
Patrick K. O'Brien
Orbtech http://www.orbtech.com
Schevo http://www.schevo.org
Patrick K. O'Brien
2007-02-12 22:43:03 UTC
Permalink
Post by Patrick K. O'Brien
Post by joseph schlesinger
I'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
joseph schlesinger
2007-02-13 00:17:06 UTC
Permalink
Thanks very much. It worked perfectly (after I figured out that --app=
needs to be run from a higher level directory than I run --schema=
from, but that's probably documented somewhere).
Post by Patrick K. O'Brien
4. Immediately follow the "inject" command with an "update" command,
schevo db update --app=yourappname filetofix.db
Patrick K. O'Brien
2007-02-13 00:21:54 UTC
Permalink
Post by joseph schlesinger
Thanks very much. It worked perfectly (after I figured out that --
app= needs to be run from a higher level directory than I run --
schema= from, but that's probably documented somewhere).
Great. You could have used --schema as well, I'm just in the habit
of using --app.
--
Patrick K. O'Brien
Orbtech http://www.orbtech.com
Schevo http://www.schevo.org
Loading...