AttributeError: module 'virtkey' has no attribute 'press_unicode'
(using python3)
Cannot use virtkey
This module is probably long outdated, but for some reason it is still built for Ubuntu 19.10, so why does it have no proper documentation whatsoever?
Code:
import virtkey
import time
v = virtkey.virtkey
for i in range(1, 10):
v.press_
time.sleep(1)
Error:
Traceback (most recent call last):
File "virtkey.py", line 1, in <module>
import virtkey
File "/home/
v.press_
AttributeError: module 'virtkey' has no attribute 'press_unicode'
VScode gives the error:
Module 'virtkey' has no 'press_unicode' member
What I am trying to do is to press the "v" key ten times.
I have tried using virtkey.
using an example from c. 2007, it also doesn't work
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- virtkey Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Archie Halliwell
- Solved:
- 2020-04-20
- Last query:
- 2020-04-20
- Last reply:
- 2020-04-18
Manfred Hampl (m-hampl) said : | #1 |
Even if there is not much documentation, you still should follow it closely:
You need
v = virtkey.virtkey()
with "()" at the end.
Archie Halliwell (archiolgy) said : | #2 |
Using parentheses creates the error:
Traceback (most recent call last):
File "test.py", line 1, in <module>
import virtkey
File "/home/
v = virtkey.virtkey()
TypeError: 'module' object is not callable
Manfred Hampl (m-hampl) said : | #3 |
Which operating system (including version number if applicable) are you running, how did you install virtkey, which program example do you try to follow?
Manfred Hampl (m-hampl) said : | #4 |
And additionally: You seem to have a conflict between the virtkey python module and your own script, because they both use the same name - virtkey.
Archie Halliwell (archiolgy) said : | #5 |
Running ubuntu 19.10 and installed through apt
Changing the name of the file and deleting virtkey.pyc fixed the issue, so now I can hold the v key all I want
Thanks for pointing out the obvious trap for young players.