[Python] Windows 10 Linux subsystem - Python - String to computer clipboard

Discussão em 'Python' iniciado por Stack, Julho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I have a python script where I want to place a string in the computer's clipboard. I have this working in Linux, Mac, and previously in Windows using cygwin. I had to modify one line of code to get it working in the respective systems. I can't get a string copied to the clipboard on Windows 10's native Linux subsystem. The line below causes error: sh: 1: cannot create /dev/clipboard: Permission denied. Any idea how to modify this line?

    os.system("echo hello world > /dev/clipboard")

    Continue reading...

Compartilhe esta Página