0
conn = cx_Oracle.connect('xxx',encoding='GBK')
cursor=conn.cursor()
r= cursor.execute("select * from TB_OBJECT_1063 ")
r.fetchone()

I run r.fetchone() for several times and it suddenly give the error,I want the cursor to jump this location and continue to next one

UnicodeDecodeError Traceback (most recent call last) in () ----> 1 r.fetchone().next()

UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in position 203: illegal multibyte sequence

3
  • this is not a connection problem Commented Sep 13, 2017 at 9:27
  • Your data in at least one row is not in the encoding you are expecting. Commented Sep 13, 2017 at 9:27
  • Yes! There is. So can I jump this row ? Commented Sep 13, 2017 at 9:34

1 Answer 1

0

This sounds like you need try-catch.

try:
  r.fetchone()
except UnicodeDecodeError:
  pass

and then you may replace pass by whatever you need.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.