I'm new to pymysql module and trying to discover it, I have a simple code:
import pymysql
conn=pymysql.connect(host="127.0.0.1",
port=8080,user="root",
passwd="mysql",
db="world",
charset="utf8",
use_unicode=True)
cur=conn.cursor()
cur.execute("SELECT * FROM world.city")
for line in cur:
print(line)
cur.close()
conn.close()
I'm using Python Tools for Visual Studio. When i execute the code, it fails with this error:
Traceback (most recent call last):
File "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensio
ns\Microsoft\Python Tools for Visual Studio\1.5\visualstudio_py_debugger.py", li
ne 1788, in write
self.old_out.write(value)
File "C:\Python32\lib\encodings\cp437.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 6-7: cha
racter maps to <undefined>
Failing line contains city name : ´s-Hertogenbosch
I thought that maybe it's a related problem with cmd output so I've switched to python shell, and my script runs without any error.
So what is the problem I'm facing? How can I solve it?
I really want to use Python Tools for Visual Studio, so answers that enable me to use PTVS will be most welcomed.