How to fix: “UnicodeDecodeError: ‘ascii’ codec can’t decode byte” in PYQGIS script

While working with data written in various languages presents the error to process in PYQGIS following error I was getting:

 ascii' codec can't decode byte

I got it solved using

# encoding=utf8  
import sys  
reload(sys)  
sys.setdefaultencoding('utf8')

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s