3

I wrote the following code

conAcc = pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D:\ThirdTask\Northwind.accdb')
SqlAccess=conAcc.cursor();
SqlAccess.execute(sql.sql_count_record_clients);
CountOfRecords=SqlAccess.fetchone();
conAcc.close();

where there is a line in module sql.py

sql_count_records_clients='''SELECT COUNT(*) FROM "Список клиентов"'''

As a result this line in sql.py gives out an error

Traceback (most recent call last):
  File "D:\ThirdTask\connect.py", line 5, in <module>
    import json,sqlite3,sql
  File "D:\ThirdTask\sql.py", line 48
SyntaxError: Non-ASCII character '\xd1' in file D:\ThirdTask\sql.py on line 48, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

What should be done to make the error disappear?

user1730626
  • 437
  • 1
  • 8
  • 16

1 Answers1

4

Need add in first line code:

# -*- coding: utf-8 -*- 
enter code here

Then problem resolve

Dmitry Kalinin
  • 363
  • 2
  • 11