How to correct the "Incorrect Padding" Error while decoding the binary data in Debian Server

Asked by Pavithra on 2011-10-20

I have created a binary field for file upload option and i need to read and process the data of the uploaded file... When i try to decode the data in the binary file.. I am getting following Error...

ERROR:web-services:Uncaught exception Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 122, in wrapper return f(self, dbname, *args, **kwargs) File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 176, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw) File "/usr/lib/python2.5/site-packages/openerp-server/osv/osv.py", line 167, in execute_cr return getattr(object, method)(cr, uid, *args, **kw) File "/usr/lib/python2.5/site-packages/openerp-server/addons/account_voucher/bank_reconcile.py", line 426, in get_file_data datas = base64.decodestring(data.import_file) File "/usr/lib/python2.5/base64.py", line 321, in decodestring return binascii.a2b_base64(s) Error: Incorrect padding

Can anyone please tell me how to correct it????

Question information

Language:
English Edit question
Status:
Expired
For:
Odoo Web Client Edit question
Assignee:
No assignee Edit question
Last query:
2011-10-20
Last reply:
2011-11-04

Hi,
Hi,

this might be the following bug:

  https://bugs.launchpad.net/openobject-client-web/+bug/670228/

The issue is covered here as well, as a generic python issue:

  http://stackoverflow.com/questions/2941995/python-ignore-incorrect-padding-error-when-base64-decoding

I am personally curious if the following comment on that page does something in your case:

"It is possible that the encoding has been done in an url-safe manner. If this is the case, you will be able to see minus and underscore characters in your data, and you should be able to decode it by using base64.b64decode(data.import_file, '-_')"

By the way, what version are you running?

Good luck,
Stefan

Pavithra (pavithra-lakshmanan) said : #2

Hi Stefan,

        Thanks for your reply.. I am using 6.0 Version.

        I have tried as per your comment to decode my data. But it dint work. Got the same error.
        Is there any other options to solve this issue?????

Launchpad Janitor (janitor) said : #3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

If you are using 6.0.0, upgrade to 6.0.3. If you still have the problem, reopen the bug report.

Pavithra (pavithra-lakshmanan) said : #5

Hi,

       Thanks for your help.. I got it fixed now.