我的代码:
from cryptography.fernet import Fernet
错误:
Traceback (most recent call last):
File "C:\Program Files\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "c:\Users\USERNAME\.vscode\extensions\ms-python.python-2022.8.1\pythonFiles\lib\python\debugpy\__main__.py", line 45, in <module>
cli.main()
File "c:\Users\USERNAME\.vscode\extensions\ms-python.python-2022.8.1\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
run()
File "c:\Users\USERNAME\.vscode\extensions\ms-python.python-2022.8.1\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
File "C:\Program Files\Python39\lib\runpy.py", line 267, in run_path
code, fname = _get_code_from_file(run_name, path_name)
File "C:\Program Files\Python39\lib\runpy.py", line 242, in _get_code_from_file
code = compile(f.read(), fname, 'exec')
ValueError: source code string cannot contain null bytes
我不知道原因是什么,我尝试过几种方法,包括重新安装密码学。
发布于 2022-07-03 13:12:34
文件编码不正确,我不得不将其更改为utf-8。
https://stackoverflow.com/questions/72836214
复制相似问题