0

The code works locally with 2.6 but when I deploy the same code on a server it's giving the following error when downloading my code from mail and then deploying it on server:

File "/usr/lib/python2.6/site-packages/oauth2client/service_account.py", line 276, in from_p12_keyfile private_key_password=private_key_password, scopes=scopes)
File "/usr/lib/python2.6/site-packages/oauth2client/service_account.py", line 244, in _from_p12_keyfile_contents private_key_password) 
File "/usr/lib/python2.6/site-packages/oauth2client/_pure_python_crypt.py", line 167, in from_string key = _from_bytes(key) # pem expects str in Py3 
File "/usr/lib/python2.6/site-packages/oauth2client/_helpers.py", line 87, in _from_bytes if isinstance(value, six.binary_type) else value) 
File "/usr/lib64/python2.6/encodings/utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) 
UnicodeDecodeError: 'utf8' codec can't decode byte 0x82 in position 1: invalid start byte
Andy Balaam
  • 6,423
  • 6
  • 34
  • 37
  • It would be more feasible to help you if you posted your actual code (the relevant part of it). Thanks. – lrnzcig Feb 23 '16 at 14:17
  • def createBigQueryJobInstance(self): http = httplib2.Http(disable_ssl_certificate_validation=True) credentials = ServiceAccountCredentials.from_p12_keyfile(SERVICE_ACCOUNT_EMAIL, os.path.abspath(os.path.dirname(__file__)) + "/conf/test.p12",scopes=['https://www.googleapis.com/auth/bigquery']) self.m_http = credentials.authorize(http) bigquery_service = build('bigquery', 'v2',http=self.m_http) self.m_biqquery_job_inst = bigquery_service.jobs() – Ravikesh Singh Feb 24 '16 at 05:26
  • Issue is fixed , the reason was old crypto library in production. sudo pip install PyOpenSSL – Ravikesh Singh Feb 24 '16 at 09:54
  • I'm having this issue too running dev server on Python 2.7. Does solving this require a specific version of pyopenssl? Installing the latest version still gives me UnicodeDecodeError. – sthomps Mar 20 '16 at 19:01
  • No it was not specific to any version, just try to update it and then try, also copy paste the error what you are facing. – Ravikesh Singh Mar 23 '16 at 05:37

0 Answers0