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
相关文章
- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 0: invalid continuation byte
- ride.py中文用户名:UnicodeDecodeError:'utf8'codec can't decode byte 0xb2 in position 9: invalid start byte
- About UnicodeDecodeError: 'utf8' codec can't decode byte 0xa1 in position 157: invalid start byte
- 'utf-8' codec can't decode byte 0xd5 in position XXX: invalid continuation byte问题
- SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xd0 in position 2: invalid continuation byte
- UnicodeDecodeError: 'utf8' codec can't decode byte 0xd1 in position 0: invalid continuation byte问题
- python3 报错:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 201: invalid continuation byte
- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd3 in position 259: invalid continuation byte 问题的解决
- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xef in position 99: invalid continuation byte
- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcd in position 0: invalid continuation byte