I have just installed Python 3.4.0 on Windows. PATH is set properly, the trailing slash in C:\Python34\ removed, but I am having trooble running some scripts from an external file.
For example, I have found a hello world script for Tkinter. For argument, the simplest version is:
import tkinter
root = tkinter.Tk()
If I run each line individually in the prompt, it runs fine and it opens the window. If I save it in a file and try to run "python my_file.py" in the prompt, I get the following error:
AttributeError: 'module' object has no attribute 'Tk'
in line 2. I get strange errors trying to do stuff like
from tkinter.constants import *
or even
import sys
but only when I run from a file. Stuff like
print("Hello world")
runs just fine either way, so I think PATH is doing fine. What gives?
AttributeErrors: did you happen to name a program of your owntkinter.py? You can check by doingimport tkinterand thenprint(tkinter.__file__).