2👍
try:
file_content = bytes(file.read(10000), 'UTF-8')
sniffdialect = csv.Sniffer().sniff(file_content, delimiters='\t,;')
it is because string
in Python3.x is not the same as in python2.x, you need to cast it with bytes and encode as utf-8
Source:stackexchange.com