Skip to content

Not able to run a tkinter program #146

Open
@yijianli-autra

Description

@yijianli-autra

I am using the bazel/rules_python to compile our python code.
according to the configuration, we are using the
cpython-3.9.13+20220802-x86_64-unknown-linux-gnu-install_only.tar.gz as our python interpreter.
But as we are using the Tkinter, there is a segment fault during the runtime.
the code

import faulthandler
faulthandler.enable()

import tkinter
from tkinter.constants import *
tk = tkinter.Tk()
frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
frame.pack(fill=BOTH,expand=1)
label = tkinter.Label(frame, text="Hello, World")
label.pack(fill=X, expand=1)
button = tkinter.Button(frame,text="Exit",command=tk.destroy)
button.pack(side=BOTTOM)
tk.mainloop()

the stack trace

/tmp/python_interpreter_x86_64-unknown-linux-gnu ❯ ./bin/python3.9 tkinter_test.py                                                                                                                                                                                            
Fatal Python error: Segmentation fault

Current thread 0x00007fe29108ef40 (most recent call first):
  File "/tmp/python_interpreter_x86_64-unknown-linux-gnu/lib/python3.9/tkinter/__init__.py", line 2572 in __init__
  File "/tmp/python_interpreter_x86_64-unknown-linux-gnu/lib/python3.9/tkinter/__init__.py", line 3148 in __init__
  File "/tmp/python_interpreter_x86_64-unknown-linux-gnu/tkinter_test.py", line 9 in <module>
[1]    55139 segmentation fault (core dumped)  ./bin/python3.9 tkinter_test.py

according to other tickets, seems the python interpreter is already linked to the Tkinter.

Update

I was trying to use the debug version to know what happened in the core dump. but it is very strange that I am able to run this with python3.9d. it is very weird.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions