I am trying to create forms for 'user registration' on a website. While trying to import flask_wtf module in Sublime Text 3 using the following input:
import flask_wtf
I am getting the following error:
Traceback (most recent call last):
File "C:\Users\Aadish\Desktop\Python Course Udemy\practice\Flask_blog\forms.py", line 1, in <module>
import flask_wtf
File "C:\Users\Aadish\AppData\Local\Programs\Python\Python39\lib\site-packages\flask_wtf\__init__.py", line 3, in <module>
from .csrf import CSRFProtect, CsrfProtect
File "C:\Users\Aadish\AppData\Local\Programs\Python\Python39\lib\site-packages\flask_wtf\csrf.py", line 11, in <module>
from wtforms import ValidationError
File "C:\Users\Aadish\AppData\Local\Programs\Python\Python39\lib\site-packages\wtforms\__init__.py", line 11, in <module>
from wtforms import validators, widgets
File "C:\Users\Aadish\AppData\Local\Programs\Python\Python39\lib\site-packages\wtforms\validators.py", line 9, in <module>
import email_validator
File "C:\Users\Aadish\AppData\Local\Programs\Python\Python39\lib\site-packages\email_validator\__init__.py", line 6, in <module>
import dns.resolver
File "C:\Users\Aadish\AppData\Local\Programs\Python\Python39\lib\site-packages\dns\resolver.py", line 36, in <module>
import dns.message
File "C:\Users\Aadish\AppData\Local\Programs\Python\Python39\lib\site-packages\dns\message.py", line 24, in <module>
import dns.wire
File "C:\Users\Aadish\AppData\Local\Programs\Python\Python39\lib\site-packages\dns\wire.py", line 7, in <module>
import dns.name
File "C:\Users\Aadish\AppData\Local\Programs\Python\Python39\lib\site-packages\dns\name.py", line 26, in <module>
import idna # type: ignore
ValueError: source code string cannot contain null bytes
It looks like your source files are messed up. Try to reinstall the dns
library. If it does not help, manually edit the file C:\Users\Aadish\AppData\Local\Programs\Python\Python39\lib\site-packages\dns\name.py
to fix the problem.