Tobin
Tobin

Reputation: 41

ModuleNotFoundError: No module named 'dns' in Pycharm

I am a newbie at Python and I am trying to insert some data into MySQL. I keep getting an error that I cannot figure out how to fix. I have attempted to import the dns.resolver but I cant find it. The error is stating:

File "C:\Users\Tob\PycharmProjects\cms\window.py", line 3, in import mysql.connector File "C:\Users\Tob\AppData\Local\Programs\Python\Python38\lib\site-packages\mysql\connector_init_.py", line 41, in import dns.resolver ModuleNotFoundError: No module named 'dns'

Here is my code. Any help would be greatly appreciated :)

import tkinter
import mysql
import mysql.connector

top = tkinter.Tk()

def submit():
db = mysql.connector.connect('localhost', 'root', '_______', 'helpdesk')

cursor = db.cursor()

cursor.execute("INSERT INTO users VALUES (:uLogin, :uPassword, :uFirstName, :uLastName, :uEmail)",
{'uLogin': uLogin.get(), 'uPassword': uPassword.get(), 'uFirstName': uFirstName.get(),               'uLastName': uLastName.get(), 'uEmail': uEmail.get()})

cursor.commit()

cursor.close()

submit = tkinter.Button(top, text="Submit", command=submit)
submit.grid(row=5, column=0, columnspan=2, padx=10, pady=10, ipadx=100)

Upvotes: 2

Views: 2654

Answers (1)

JarroVGIT
JarroVGIT

Reputation: 5279

You should do this in a command line window. (see this question!)

git clone https://github.com/rthalley/dnspython
cd dnspython/
python setup.py install

Upvotes: 3

Related Questions