How to solve <type 'exceptions.KeyError'> '\x00' error

100 views
Skip to first unread message

mostwanted

unread,
Nov 30, 2018, 11:46:49 PM11/30/18
to web2py-users

There was a electrical power cut in my area today, it happened while i was working on my application. When the power returned & I tried to continue with my application I got this error:
"'<'type 'exceptions.KeyError'> '\x00'"
Now my application is NOT working! This is not the first time, i have had to start another project from scratch but i cant with this current one because alot has been done on it, i need to know what this error is!


Below is the stack trace to the error:



Traceback

Traceback (most recent call last):
File "C:\Users\.........\Documents\web2py\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
File "C:/Users/........../Documents/web2py/applications/Power_Vault/models/dbcurrentV.py", line 16, in <module>
Field('posted_by', 'reference auth_user', default=auth.user_id, readable=False, writable=False))
File "C:\Users\.......\Documents\web2py\gluon\packages\dal\pydal\base.py", line 590, in define_table
table
= self.lazy_define_table(tablename, *fields, **kwargs)
File "C:\Users\.......\Documents\web2py\gluon\packages\dal\pydal\base.py", line 624, in lazy_define_table
polymodel
=polymodel)
File "C:\Users\......\Documents\web2py\gluon\packages\dal\pydal\adapters\base.py", line 798, in create_table
return self.migrator.create_table(*args, **kwargs)
File "C:\Users\......\Documents\web2py\gluon\packages\dal\pydal\migrator.py", line 296, in create_table
sql_fields_old
= pickle.load(tfile)
File "pickle.py", line 1378, in load
File "pickle.py", line 858, in load
KeyError: '\x00'

If anyone out there knows what this is I could really use your help in resolving it, i am desperate . Thank you!

Val K

unread,
Dec 1, 2018, 4:09:02 AM12/1/18
to web2py-users
It seems that dal-metafiles are broken. Did you try to fix it as the book suggests?

mostwanted

unread,
Dec 1, 2018, 4:29:04 AM12/1/18
to web2py-users
Please refer me, what page, I will be lying if i said i looked it up!

Val K

unread,
Dec 1, 2018, 4:39:18 AM12/1/18
to web2py-users
Chapter 6 Fixing broken migrations

mostwanted

unread,
Dec 1, 2018, 2:12:49 PM12/1/18
to web2py-users
Thanks for that reference Val K, i'm going through it trying to figure out my problem, every problem that is stated in the book that could cause broken migrations involves bad programming habits, thats by understanding anyway, like defining a field as one type and redefining it into another type meanwhile saving information in it. The other involves partial committing of complex transaction. I haven't encountered any of these so i'm still trying to figure out where my error falls & how I can apply the given solutions.

Mostwanted

On Saturday, December 1, 2018 at 11:39:18 AM UTC+2, Val K wrote:
Chapter 6    Fixing broken migrations

Leonel Câmara

unread,
Dec 3, 2018, 5:15:06 AM12/3/18
to web2py-users
You can probably fix this simply by doing a fake migration to rebuild the .table files. Run your app with migrate=True and fake_migrate=True in your DAL.

mostwanted

unread,
Dec 3, 2018, 7:49:35 AM12/3/18
to web2py-users
What concerns me is that I developed a standalone application with web2py & every-time there is a sudden power cut which is an issue in my area, when switching on a computer to continue using the application we find that the application has crushed! Isn't there a away to avoid the application crushing every-time there is a power cut?!

Leonel Câmara

unread,
Dec 4, 2018, 6:02:22 PM12/4/18
to web2py-users
The application should be running with migration disabled in production in which case this won't happen.

mostwanted

unread,
Dec 10, 2018, 1:51:01 AM12/10/18
to web2py-users
Can you please explain further Leonel?

Jon Subscripted

unread,
Jan 8, 2019, 11:13:01 AM1/8/19
to web...@googlegroups.com
Hi Leonel,
Could a PC reboot lead to the same problem Mostwanted reported?
Regards, Jon.

Libre de virus. www.avast.com

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Leonel Câmara

unread,
Jan 15, 2019, 6:36:50 AM1/15/19
to web2py-users
Jonsubs yes it could if for some reason web2py wasn't graciously stopped which can happen depending on the OS and if web2py is taking too long to shutdown. Again don't leave migrations enabled otherwise the pickle files will be being written which if stopped halfway can lead to corrupted pickle files.

Jon Subscripted

unread,
Jan 31, 2019, 10:26:14 AM1/31/19
to web...@googlegroups.com
Thanks!

On Tue, Jan 15, 2019 at 12:36 PM Leonel Câmara <leonel...@gmail.com> wrote:
Jonsubs yes it could if for some reason web2py wasn't graciously stopped which can happen depending on the OS and if web2py is taking too long to shutdown. Again don't leave migrations enabled otherwise the pickle files will be being written which if stopped halfway can lead to corrupted pickle files.

--
Reply all
Reply to author
Forward
0 new messages