voice
voice

Reputation: 880

import pymssql Unicode DecodeError in windows 7

I install pymssql https://pypi.python.org/pypi/pymssql/2.1.1 pymssql-2.1.1.win32-py2.7.exe

import pymssql result:

>>> import pymssql
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_mssql.pxd", line 10, in init pymssql (pymssql.c:11769)
  File "_mssql.pyx", line 87, in init _mssql (_mssql.c:23183)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal
not in range(128)

How to fix it?

Upvotes: 1

Views: 294

Answers (1)

Rocketq
Rocketq

Reputation: 5791

My solution doesn't solve all types of problems, but you have to do this way:

Just add this line before your code. That problems indicates that there is some decode problem, and source of the problem might be that some folder names have non ascii characters:

# -*- coding: cp1251

Unfortunately that problem persists in the pycharm, but solved problem in console and ipython notebook.

Upvotes: 1

Related Questions