Discuss Scratch

-EmeraldThunder-
Scratcher
1000+ posts

Using python keyboard module as non-root user

I'm using Ubuntu 20 and I need to run a .bash file at startup that uses the sudo command.
However, I can't use the sudo command in a bash file as it requires password input.
Is there any way to use the python keyboard module without needing to be a root user?
MagicCrayon9342
Scratcher
1000+ posts

Using python keyboard module as non-root user

-EmeraldThunder- wrote:

I'm using Ubuntu 20 and I need to run a .bash file at startup that uses the sudo command.
However, I can't use the sudo command in a bash file as it requires password input.
Is there any way to use the python keyboard module without needing to be a root user?
what exactly is this module
and also, 20.04 LTS or 20.10
-EmeraldThunder-
Scratcher
1000+ posts

Using python keyboard module as non-root user

MagicCrayon9342 wrote:

(#2)

-EmeraldThunder- wrote:

I'm using Ubuntu 20 and I need to run a .bash file at startup that uses the sudo command.
However, I can't use the sudo command in a bash file as it requires password input.
Is there any way to use the python keyboard module without needing to be a root user?
what exactly is this module
and also, 20.04 LTS or 20.10
20.04
The module allows you to manipuate the keyboard, I'm using it to add shortcuts for accented letters.
I can do this fine on windows but when I switch over to linux (I dual boot) it's a little bit harder to achieve,

Last edited by -EmeraldThunder- (Jan. 9, 2022 15:52:22)

MagicCrayon9342
Scratcher
1000+ posts

Using python keyboard module as non-root user

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#2)

-EmeraldThunder- wrote:

I'm using Ubuntu 20 and I need to run a .bash file at startup that uses the sudo command.
However, I can't use the sudo command in a bash file as it requires password input.
Is there any way to use the python keyboard module without needing to be a root user?
what exactly is this module
and also, 20.04 LTS or 20.10
20.04
The module allows you to manipuate the keyboard, I'm using it to add shortcuts for accented letters.
I can do this fine on windows but when I switch over to linux (I dual boot) it's a little bit harder to achieve,
shortcuts for accent letters already exist. also don't use a python one lmao. install gnome tweaks and look for compose key.

Last edited by MagicCrayon9342 (Jan. 9, 2022 16:11:37)

-EmeraldThunder-
Scratcher
1000+ posts

Using python keyboard module as non-root user

MagicCrayon9342 wrote:

(#4)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#2)

-EmeraldThunder- wrote:

I'm using Ubuntu 20 and I need to run a .bash file at startup that uses the sudo command.
However, I can't use the sudo command in a bash file as it requires password input.
Is there any way to use the python keyboard module without needing to be a root user?
what exactly is this module
and also, 20.04 LTS or 20.10
20.04
The module allows you to manipuate the keyboard, I'm using it to add shortcuts for accented letters.
I can do this fine on windows but when I switch over to linux (I dual boot) it's a little bit harder to achieve,
shortcuts for accent letters already exist. also don't use a python one lmao. install gnome tweaks and look for compose key.
Compose key isn't the sort of thing I want, it's too slow and ugly.
MagicCrayon9342
Scratcher
1000+ posts

Using python keyboard module as non-root user

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#4)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#2)

-EmeraldThunder- wrote:

I'm using Ubuntu 20 and I need to run a .bash file at startup that uses the sudo command.
However, I can't use the sudo command in a bash file as it requires password input.
Is there any way to use the python keyboard module without needing to be a root user?
what exactly is this module
and also, 20.04 LTS or 20.10
20.04
The module allows you to manipuate the keyboard, I'm using it to add shortcuts for accented letters.
I can do this fine on windows but when I switch over to linux (I dual boot) it's a little bit harder to achieve,
shortcuts for accent letters already exist. also don't use a python one lmao. install gnome tweaks and look for compose key.
Compose key isn't the sort of thing I want, it's too slow and ugly.
its never going to be like Windows, now stop trying to run a python module as sudo its unsafe.
-EmeraldThunder-
Scratcher
1000+ posts

Using python keyboard module as non-root user

MagicCrayon9342 wrote:

(#6)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#4)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#2)

-EmeraldThunder- wrote:

I'm using Ubuntu 20 and I need to run a .bash file at startup that uses the sudo command.
However, I can't use the sudo command in a bash file as it requires password input.
Is there any way to use the python keyboard module without needing to be a root user?
what exactly is this module
and also, 20.04 LTS or 20.10
20.04
The module allows you to manipuate the keyboard, I'm using it to add shortcuts for accented letters.
I can do this fine on windows but when I switch over to linux (I dual boot) it's a little bit harder to achieve,
shortcuts for accent letters already exist. also don't use a python one lmao. install gnome tweaks and look for compose key.
Compose key isn't the sort of thing I want, it's too slow and ugly.
its never going to be like Windows, now stop trying to run a python module as sudo its unsafe.
Rather than telling me what I should an shouldn't do please stay on topic and actually help me with my problem,
MagicCrayon9342
Scratcher
1000+ posts

Using python keyboard module as non-root user

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#6)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#4)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#2)

-EmeraldThunder- wrote:

I'm using Ubuntu 20 and I need to run a .bash file at startup that uses the sudo command.
However, I can't use the sudo command in a bash file as it requires password input.
Is there any way to use the python keyboard module without needing to be a root user?
what exactly is this module
and also, 20.04 LTS or 20.10
20.04
The module allows you to manipuate the keyboard, I'm using it to add shortcuts for accented letters.
I can do this fine on windows but when I switch over to linux (I dual boot) it's a little bit harder to achieve,
shortcuts for accent letters already exist. also don't use a python one lmao. install gnome tweaks and look for compose key.
Compose key isn't the sort of thing I want, it's too slow and ugly.
its never going to be like Windows, now stop trying to run a python module as sudo its unsafe.
Rather than telling me what I should an shouldn't do please stay on topic and actually help me with my problem,
I'm not kidding, running a python file as sudo is EXTREMELY dangerous

Last edited by MagicCrayon9342 (Jan. 9, 2022 19:49:09)

-EmeraldThunder-
Scratcher
1000+ posts

Using python keyboard module as non-root user

MagicCrayon9342 wrote:

(#8)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#6)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#4)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#2)

-EmeraldThunder- wrote:

I'm using Ubuntu 20 and I need to run a .bash file at startup that uses the sudo command.
However, I can't use the sudo command in a bash file as it requires password input.
Is there any way to use the python keyboard module without needing to be a root user?
what exactly is this module
and also, 20.04 LTS or 20.10
20.04
The module allows you to manipuate the keyboard, I'm using it to add shortcuts for accented letters.
I can do this fine on windows but when I switch over to linux (I dual boot) it's a little bit harder to achieve,
shortcuts for accent letters already exist. also don't use a python one lmao. install gnome tweaks and look for compose key.
Compose key isn't the sort of thing I want, it's too slow and ugly.
its never going to be like Windows, now stop trying to run a python module as sudo its unsafe.
Rather than telling me what I should an shouldn't do please stay on topic and actually help me with my problem,
I'm not kidding, running a python file as sudo is EXTREMELY dangerous
Then what do you propose I do?
MagicCrayon9342
Scratcher
1000+ posts

Using python keyboard module as non-root user

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#8)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#6)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#4)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#2)

-EmeraldThunder- wrote:

I'm using Ubuntu 20 and I need to run a .bash file at startup that uses the sudo command.
However, I can't use the sudo command in a bash file as it requires password input.
Is there any way to use the python keyboard module without needing to be a root user?
what exactly is this module
and also, 20.04 LTS or 20.10
20.04
The module allows you to manipuate the keyboard, I'm using it to add shortcuts for accented letters.
I can do this fine on windows but when I switch over to linux (I dual boot) it's a little bit harder to achieve,
shortcuts for accent letters already exist. also don't use a python one lmao. install gnome tweaks and look for compose key.
Compose key isn't the sort of thing I want, it's too slow and ugly.
its never going to be like Windows, now stop trying to run a python module as sudo its unsafe.
Rather than telling me what I should an shouldn't do please stay on topic and actually help me with my problem,
I'm not kidding, running a python file as sudo is EXTREMELY dangerous
Then what do you propose I do?
Well first question towards the dev of that keyboard, why must it be ran as root.
-EmeraldThunder-
Scratcher
1000+ posts

Using python keyboard module as non-root user

MagicCrayon9342 wrote:

(#10)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#8)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#6)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#4)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#2)

-EmeraldThunder- wrote:

I'm using Ubuntu 20 and I need to run a .bash file at startup that uses the sudo command.
However, I can't use the sudo command in a bash file as it requires password input.
Is there any way to use the python keyboard module without needing to be a root user?
what exactly is this module
and also, 20.04 LTS or 20.10
20.04
The module allows you to manipuate the keyboard, I'm using it to add shortcuts for accented letters.
I can do this fine on windows but when I switch over to linux (I dual boot) it's a little bit harder to achieve,
shortcuts for accent letters already exist. also don't use a python one lmao. install gnome tweaks and look for compose key.
Compose key isn't the sort of thing I want, it's too slow and ugly.
its never going to be like Windows, now stop trying to run a python module as sudo its unsafe.
Rather than telling me what I should an shouldn't do please stay on topic and actually help me with my problem,
I'm not kidding, running a python file as sudo is EXTREMELY dangerous
Then what do you propose I do?
Well first question towards the dev of that keyboard, why must it be ran as root.
It reads raw device files in areas that require you to be the root user to avoid dependencies.
MagicCrayon9342
Scratcher
1000+ posts

Using python keyboard module as non-root user

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#10)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#8)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#6)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#4)

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#2)

-EmeraldThunder- wrote:

I'm using Ubuntu 20 and I need to run a .bash file at startup that uses the sudo command.
However, I can't use the sudo command in a bash file as it requires password input.
Is there any way to use the python keyboard module without needing to be a root user?
what exactly is this module
and also, 20.04 LTS or 20.10
20.04
The module allows you to manipuate the keyboard, I'm using it to add shortcuts for accented letters.
I can do this fine on windows but when I switch over to linux (I dual boot) it's a little bit harder to achieve,
shortcuts for accent letters already exist. also don't use a python one lmao. install gnome tweaks and look for compose key.
Compose key isn't the sort of thing I want, it's too slow and ugly.
its never going to be like Windows, now stop trying to run a python module as sudo its unsafe.
Rather than telling me what I should an shouldn't do please stay on topic and actually help me with my problem,
I'm not kidding, running a python file as sudo is EXTREMELY dangerous
Then what do you propose I do?
Well first question towards the dev of that keyboard, why must it be ran as root.
It reads raw device files in areas that require you to be the root user to avoid dependencies.
what such files?
-EmeraldThunder-
Scratcher
1000+ posts

Using python keyboard module as non-root user

MagicCrayon9342 wrote:

(#12)

-EmeraldThunder- wrote:

It reads raw device files in areas that require you to be the root user to avoid dependencies.
what such files?
/dev/input/input
MagicCrayon9342
Scratcher
1000+ posts

Using python keyboard module as non-root user

-EmeraldThunder- wrote:

MagicCrayon9342 wrote:

(#12)

-EmeraldThunder- wrote:

It reads raw device files in areas that require you to be the root user to avoid dependencies.
what such files?
/dev/input/input
that sounds like keylogger work lol
god286
Scratcher
1000+ posts

Using python keyboard module as non-root user

Stop asking questions MagicCrayon9342 I think we have enough, you're getting quite offtopic why do you do this all the time?

Here's a StackOverflow answer. You actually can't use the module without root. But apparently there's another module that can do something similar without root. https://stackoverflow.com/a/65862873/

imfh
Scratcher
1000+ posts

Using python keyboard module as non-root user

Would setting up the entire bash script to run as root each start solve your problem? If you are just calling sudo python …, then running the entire script as root sounds like a good option.
-EmeraldThunder-
Scratcher
1000+ posts

Using python keyboard module as non-root user

god286 wrote:

(#15)
Stop asking questions MagicCrayon9342 I think we have enough, you're getting quite offtopic why do you do this all the time?

Here's a StackOverflow answer. You actually can't use the module without root. But apparently there's another module that can do something similar without root. https://stackoverflow.com/a/65862873/

Is there a function similar to keyboard.add_abbreviation in the PyInput Module.

Powered by DjangoBB