On 2022-08-01 at 18:53:47 +0100, Matthew Barnett <mrabarn...@mrabarnett.plus.com> wrote:
> On 01/08/2022 13:17, Daniel Lee wrote: > > Hello, I my code with tkinter was working before, and now, it has many > > errors in it. I’m not sure what has happened. The results after running are > > below: > > > > "D:\Python Projects\tes\venv\Scripts\python.exe" "D:/Python > > Projects/tes/main.py" > > Traceback (most recent call last): > > File "D:\Python Projects\tes\main.py", line 1, in <module> > > import tkinter as tk > > File > > "C:\Users\Daniel.LAPTOP-6U1MQ9CR\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", > > line 3, in <module> > > import tkinter.messagebox > > File > > "C:\Users\Daniel.LAPTOP-6U1MQ9CR\AppData\Local\Programs\Python\Python310\lib\tkinter\messagebox.py", > > line 25, in <module> > > from tkinter.commondialog import Dialog > > File > > "C:\Users\Daniel.LAPTOP-6U1MQ9CR\AppData\Local\Programs\Python\Python310\lib\tkinter\commondialog.py", > > line 13, in <module> > > from tkinter import Frame, _get_temp_root, _destroy_temp_root > > ImportError: cannot import name 'Frame' from partially initialized module > > 'tkinter' (most likely due to a circular import) > > (C:\Users\Daniel.LAPTOP-6U1MQ9CR\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py) > > > > Process finished with exit code 1 > > The entry: > > File > "C:\Users\Daniel.LAPTOP-6U1MQ9CR\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", > line 3, in <module> > import tkinter.messagebox > > in the traceback does not look right to me. On my PC that file starts with a > long docstring. My tkinter/__init__.py, too. Do you have (and did you create since the last time your code worked) your own module called tkinter? Is line 3 "import tkinter.messagebox"? -- https://mail.python.org/mailman/listinfo/python-list