Django报错:ValueError: source code string cannot contain null bytes

【原因】:其实是编码问题

【编辑器】:vscode

【过程】:本想操作一些shell 命令【py manage.py shell】,直接就报错【ValueError: source code string cannot contain null bytes】

【解决方法】:打开编辑器最底部的【选择编码】,就是【UTF-16 LE】 (默认)。把它更改为【通过编码保存 Save with encoding】,再选择【UTF-8】,便没有报错了。

猜你喜欢

转载自blog.csdn.net/weixin_44683255/article/details/113799685