UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 140: invalid continuation byte

web阅片系统,遇到dicom文件在文件夹不能正常读取的问题。解决方法如下:


def rep7(request):
file_path = os.path.dirname(__file__) + request.path
with open(file_path, 'rb') as file:
response = HttpResponse(file)
response['Content-Type'] = 'application/dicom'
return response
posted @ 2018-09-03 15:24  路在脚下丶  阅读(976)  评论(0编辑  收藏  举报