IDK why but I tried to import public key first and it said "bad private key" too. Re-check what are you trying to import and try
this with addrtype = 138 (line 23). It worked for me. Unfortunately it's not possible to autodetect (wallet doesn't contain addresses, only public keys).
pywallet.py --importprivkey=MXTf98yWq9KEovooAGDSjEWkVbYF5eiFZWKvWL6VX6vhpLZj7m
Address: xt5y9PhK1wnTT4fnf4SLVDaTCyMgAuNPXR
Privkey: MXTf98yWq9KEovooAGDSjEWkVbYF5eiFZWKvWL6VX6vhpLZj7m
Imported successfully
It works, thanks.
However new pywallet can't use this method, still says bad key. Sometimes simple things works better than complex things.