Skip to content
Advertisement

pynput custom autokey script isn’t working when following video guide

I wanted to create a hotkey but decided to “challenge” myself by using Python instead of AHK.

I wanted the phrase Scheiße! printed out whenever I pressed the key combination Ctrl+Alt+P(or p)

I referred to this video and wrote the following script:

JavaScript

When I execute the script, the following error(s) occurs:

JavaScript

I’ve tried various troubleshooting steps such as removing the German characters, replacing ‘p’ and ‘alt’ with other keys, but the only thing that does is change the output.

Does anyone have a solution for this?

Advertisement

Answer

According to the information you provided, I tested the code in the video in VS Code, and it can be run in VS Code:

enter image description here

Please use the code:

JavaScript

In addition, please reload VS Code to make it recognize the installed modules, and try to run it several times in VS Code.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement