Python 3.6 - AttributeError: module 'tkinter' has no attribute 'filedialog'

Explicitly import of filedialog can solve the problem. So, you just need to add this line to your codes:

import tkinter.filedialog

You can find more information at Why tkinter module raises attribute error when run via command line but not when run via IDLE?


the following code didn't work for me:

import tkinter as tk
import tkinter.filedialog

But the following did work:

import tkinter
import tkinter.filedialog

and also this:

import tkinter.filedialog
import tkinter as tk

Hope this helps

Note

As mentioned by Vaidøtas I., you can't import filedialog from tkinter. Because you did not import the original tkinter but an aliased version tk.