I am using Python 3 and Django 1.8.
When we upload files. Before you save the file, I can read csv file. And the csv file to see.
def index(request):
    if request.POST and request.FILES:
        csvfile = request.FILES['csv_file']
        dialect = csv.Sniffer().sniff(codecs.EncodedFile(csvfile, "utf-8").read(1024))
        csvfile.open()
        reader = csv.reader(codecs.EncodedFile(csvfile, "utf-8"), delimiter=',', dialect=dialect)
    return render(request, "index.html", locals())
The third line gives the following error:
cannot use a string pattern on a bytes-like object
