Forums

Bash Console "cannot connect to X server"

Hello! I'm trying to run some Python code in the bash console. I opened the bash console from my Files page, which includes the Python file (gui.py) and its necessary data files in their respective directories. When I enter "python gui.py", the console immediately exits with "gui.py: cannot connect to X server". The Python app uses OpenCV and PyQt, both of which seem to be included in PythonAnywhere's Python. I'm very new to PythonAnywhere, so any help is appreciated!

Unfortunately PythonAnywhere is a server environment with no GUI, so anything that depends on a graphical interface won't work :-(

Aww! That makes sense, though. It was worth a try! Definitely keeping it in mind for other projects down the line.

OK -- sorry I couldn't give better news!

psql: error: connection to server at "pg.pg4e.com" (3.101.11.254), port 5432 failed: FATAL: password authentication failed for user "pg4e_bd01c8d507" connection to server at "pg.pg4e.com" (3.101.11.254), port 5432 failed: FATAL: password authentication failed for user "pg4e_bd01c8d507"

It sounds like you entered the wrong password when you were trying to connect to that server.

What about pynput keyboard module? It requires a X server as well so does it mean it cannot work

Yes, that's right. Modules like that are designed to be used in code that is running on the computer in front of the user, not on remote servers.

it unable to connect the server

There is no X server for you to connect to.