nameError Tk() is not defined

File “/opt/render/project/src/.venv/lib/python3.11/site-packages/flask/app.py”, line 2528, in wsgi_app
May 16 03:00:23 PM response = self.full_dispatch_request()
May 16 03:00:23 PM ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
May 16 03:00:23 PM File “/opt/render/project/src/.venv/lib/python3.11/site-packages/flask/app.py”, line 1825, in full_dispatch_request
May 16 03:00:23 PM rv = self.handle_user_exception(e)
May 16 03:00:23 PM ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
May 16 03:00:23 PM File “/opt/render/project/src/.venv/lib/python3.11/site-packages/flask/app.py”, line 1823, in full_dispatch_request
May 16 03:00:23 PM rv = self.dispatch_request()
May 16 03:00:23 PM ^^^^^^^^^^^^^^^^^^^^^^^
May 16 03:00:23 PM File “/opt/render/project/src/.venv/lib/python3.11/site-packages/flask/app.py”, line 1799, in dispatch_request
May 16 03:00:23 PM return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
May 16 03:00:23 PM ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
May 16 03:00:23 PM File “/opt/render/project/src/app.py”, line 326, in hello_world
May 16 03:00:23 PM read_user_data()
May 16 03:00:23 PM File “/opt/render/project/src/app.py”, line 224, in read_user_data
May 16 03:00:23 PM root = Tk()
May 16 03:00:23 PM ^^
May 16 03:00:23 PM NameError: name ‘Tk’ is not defined
May 16 03:00:23 PM 127.0.0.1 - - [16/May/2023 09:30:23] “POST / HTTP/1.1” 500 -

I have installed correct libraries and version, after deploying its working on my local environment but not showing error on deployed url

Hey,

It appears that you are attempting to install https://docs.python.org/3/library/tkinter.html, which relies on OS-level dependencies. However, please note that even if you were able to install this library, it would not be usable on Render since we do not support exposing a graphical user interface (GUI).

Regards.
Jérémy, Render Support

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.