0

I'm trying to set up a simple application, where a user downloads a file in excel format. In order to do that, I'm using tkinter so when the users presses a button, it opens the window to select where to save the file. And that works wonders when running the file locally. The problem begins when I try to host my app in a CentOs server, as I get the following error displayed inside the app:

TclError: no display name and no $DISPLAY environment variable

The application is developed using streamlit, but considering the problem only happens when I use a different OS, I'm not sure of this framework being the cause. Regardless, and since my knowledge in this area and on tkinter is quite limited, I've also posted this question in the respective forum.

So, here's a minimum working example to reproduce the error I'm getting:

import tkinter
import streamlit as st

def main():

    st.write(tkinter.TkVersion)
    root = tkinter.Tk()


if __name__ == '__main__':
    main()

And if i run that code in CentOS this is what i get:

enter image description here

I've search online and found this and this but not only am I not using ssh after I update the code access the CentOS server, I'm also not using matplotlib.

Python version: 3.6.8 Streamlit version: 0.58 tkinter version: 8.5

Any help would be appreciated on how to solve this error. And if you have any doubt, please ask.

Márcio Coelho
  • 333
  • 3
  • 11
  • How do you access the CentOS server? Is a desktop environment running in the CentOS server? – acw1668 Apr 27 '20 at 15:06
  • Via PuTTY, and no desktop environment is available, only command-line interface is available. – Márcio Coelho Apr 27 '20 at 15:57
  • If no desktop environment is available, how do you run GUI application? Also mixing a web application (StreamLit seems to be converting the python script to a web app) with GUI application should be avoided. – acw1668 Apr 27 '20 at 16:00
  • I don't know if I understood you correctly, but the script with the web app is run and hosted at the CentOS server, but I don't access via PuTTY, I access remotely via browser. As for the concerns of mixing a web app and a GUI application, I had no idea. Why is that? – Márcio Coelho Apr 27 '20 at 16:16
  • What the error you get in the browser is due to that there is no desktop environment in the CentOS. Even though there is a desktop environment in the CentOS server, how do you expect the GUI application be shown in a browser? – acw1668 Apr 27 '20 at 16:45
  • Ok, but can't I configure the app to use the desktop environment of the user that is accessing it? Same thing happens when I open the app in a browser, no? – Márcio Coelho Apr 27 '20 at 17:26

0 Answers0