Closed abirabedinkhan closed 1 year ago
I did all of those. Btw, I am trying to use it with ssh.
Thank you for your report.
When you say that you are trying to use it with SSH, do you mean that you intend to control/monitor a remote computer? In that case you must have an X server running remotely, and you must ensure that the DISPLAY
environment variable is correctly set in the remote shell.
The error message, however, appears very strange: "No module named 'tkinter'". This happens when pynput attempts to import pynput._util.xorg
, which does not import Tkinter.
The No module named 'tkinter'
message is probably because on debian there are some parts of the stdlib missing on a default python install. Just apt-get install python3-tk
. Not sure about other distros.
Nothing really to be done on Pynput I think, other than maybe adding a line about it in the docs.
Yeah did install apt-get install python3-tk
before running my script. I encountered this problem before in my VM.apt-get install python3-tk
fixed my problem there. However, when I am trying through ssh it shows the same error whether apt-get install python3-tk
installed or not. How do I set the DISPLAY
environment variable?
did you connect with -X argument? or are you using putty? remember the linux installation must have a display server installed (x org for example). https://www.baeldung.com/linux/forward-x-over-ssh is a good tutorial
El mar, 29 nov 2022 a la(s) 22:48, Abir Abedin Khan - notifications at github.com @.***) escribió:
Yeah did install apt-get install python3-tk before running my script. I encountered this problem before in my VM.apt-get install python3-tk fixed my problem there. However, when I am trying through ssh it shows the same error whether apt-get install python3-tk installed or not. How do I set the DISPLAY environment variable?
— Reply to this email directly, view it on GitHub https://github.com/moses-palmer/pynput/issues/518#issuecomment-1331541464, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUYXVMKRL5CKYGSH3LIEJTWK2W6RANCNFSM6AAAAAASDT3SY4 . You are receiving this because you commented.Message ID: @.***>
It's a armbian desktop.
In that case perhaps there easiest solution would be to open a terminal window in the desktop session and run the command echo $DISPLAY
. Then, when you have SSH'd into the armbian host, launch your program thus: DISPLAY=[output of echo command] python3 app.py
.
FYI the root cause of this exception is here: https://github.com/python-xlib/python-xlib/issues/240
In 0.33 it no longer happens
When I try to run the script