Skip to content

UnicodeDecodeError - pyodbc.cursor.columns #328

Closed
@bergerod

Description

@bergerod

Environment

To diagnose, we usually need to know the following, including version numbers. On Windows, be
sure to specify 32-bit Python or 64-bit:

  • Python: 3.5.1 32bit
  • pyodbc: 4.0.21
  • OS: Windows 7 64 bit
  • DB: MS Access
  • driver: Microsoft Access Driver (*.mdb, *.accdb) 32 bit driver

def build_access_table_list(self):
table_list = list()
# Generate list of tables in access database
for table in self.access_cur.tables():
if table.table_type == "TABLE":
table_list.append(table.table_name)

    return table_list 

def create_fields(self,table):
for column in self.access_cur.columns(table):

It fails randomly at the point of looping through the columns. It does not happen all the time. This process can execute 10 times in a row without a problem, but then it will cause a unicode error. There are no special characters in the access table or column names

Error for the log:
UnicodeDecodeError: 'utf-16-le' codec can't decode bytes in position 84-85: illegal UTF-16 surrogate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions