solving <type 'exceptions.KeyError'> '\x00'

171 views
Skip to first unread message

mostwanted

unread,
Jul 31, 2020, 12:16:12 PM7/31/20
to web2py-users
Hi guys, today I encountered this error: <type 'exceptions.KeyError'> '\x00', I think it occured during shut down because wheni rebooted my laptop it was there, in chapter 6 of the book (fixing migrations) it says we should add db.define_table(...., migrate=True, fake_migrate=True) but when I did that the error still persists it doesnt go anywhere, I then added migrate=False alone in the tables that came up in the issued TICKETS and the app was good and running, why is this and what is the difference between
adding db.define_table(...., migrate=True, fake_migrate=True) and just adding
db.define_table(...., migrate=True)?


Regards;


Mostwanted

Jim S

unread,
Jul 31, 2020, 2:12:10 PM7/31/20
to web2py-users
Can you post a more complete traceback?

mostwanted

unread,
Aug 1, 2020, 1:23:04 AM8/1/20
to web...@googlegroups.com
Hey Jim, thats the traceback below:

Traceback


1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
Traceback (most recent call last):
 
File "C:\Users\Maswabi\Desktop\WEB2PY APPLICATIONS\web2py-2.20.4\gluon\restricted.py", line 219, in restricted
   
exec(ccode, environment)
 
File "C:/Users/Maswabi/Desktop/WEB2PY APPLICATIONS/web2py-2.20.4/applications/wah/models/dbmanaq.py", line 54, in <module>
   
format='%(product)s')
 
File "C:\Users\Maswabi\Desktop\WEB2PY APPLICATIONS\web2py-2.20.4\gluon\packages\dal\pydal\base.py", line 657, in define_table
    table
= self.lazy_define_table(tablename, *fields, **kwargs)
 
File "C:\Users\Maswabi\Desktop\WEB2PY APPLICATIONS\web2py-2.20.4\gluon\packages\dal\pydal\base.py", line 698, in lazy_define_table
    polymodel
=polymodel,
 
File "C:\Users\Maswabi\Desktop\WEB2PY APPLICATIONS\web2py-2.20.4\gluon\packages\dal\pydal\adapters\base.py", line 913, in create_table
   
return self.migrator.create_table(*args, **kwargs)
 
File "C:\Users\Maswabi\Desktop\WEB2PY APPLICATIONS\web2py-2.20.4\gluon\packages\dal\pydal\migrator.py", line 323, in create_table
    sql_fields_old
= pickle.load(tfile)
 
File "pickle.py", line 1384, in load
 
File "pickle.py", line 864, in load
KeyError: '\x00'

I really wanna fully understand this error & the best way to solve it because I have encountered it in the past & it always became a struggle, it turned into a nightmare that I started to dread it with every application i developed especially standalone applications which can be affected by sudden powercuts in computers without UPS or laptops with batter batteries!

Jim S

unread,
Aug 1, 2020, 11:08:22 AM8/1/20
to web2py-users
I am definitely not an expert on this, but it looks to me like you have some data in one of your tables that python cannot pickle.  I'm guessing you have some unicode characters that snuck into your db.  Can you write a quick python script to scan through the data in all your tables to see which records won't pickle?

-Jim

mostwanted

unread,
Aug 2, 2020, 2:07:19 AM8/2/20
to web2py-users
Thank you Jim, so much
Reply all
Reply to author
Forward
0 new messages