hi guy i'm issue to import lib pynput in my linux, my issue pass to use basic code our site.
My python version is 3.5.2
from pynput.keyboard import Key, Listener
def on_press(key):
print('{0} pressed'.format(key))
def on_release(key):
print('{0} release'.format(key))
if key == Key.esc:
# Stop listener
return False
# Collect events until released
with Listener(on_press=on_press, on_release=on_release) as listener:
listener.join()
The problem is:
/usr/bin/python3.5 /home/zirou/hk/programacao/python/python_3.5/mouseclick/pynput.py
Traceback (most recent call last):
File "/home/zirou/hk/programacao/python/python_3.5/mouseclick/pynput.py", line 1, in <module>
from pynput.keyboard import Key, Listener
File "/home/zirou/hk/programacao/python/python_3.5/mouseclick/pynput.py", line 1, in <module>
from pynput.keyboard import Key, Listener
ImportError: No module named 'pynput.keyboard'; 'pynput' is not a package
If you can help me I will be grateful, thank you
sorry my english.
Hi Zirou,
Is the file from which you run your programme named pynput.py? In that case
Python may have difficulties finding the actual pynput package.
Try renaming your main file to something else, like pynput-test.py. if that
doesn't help, please verify that pynput has been successfully installed.
On 18 Sep 2016 03:49, "Zirou" notifications@github.com wrote:
hi guy i'm issue to import lib pynput in my linux, my issue pass to use
basic code our site.
from pynput.keyboard import Key, Listener
def on_press(key):
print('{0} pressed'.format(key))
def on_release(key):
print('{0} release'.format(key))
if key == Key.esc:
# Stop listener
return False
Collect events until released
with Listener(on_press=on_press, on_release=on_release) as listener:
listener.join()
The problem is:
/usr/bin/python3.5 /home/zirou/hk/programacao/python/python_3.5/mouseclick/pynput.py
Traceback (most recent call last):
File "/home/zirou/hk/programacao/python/python_3.5/mouseclick/pynput.py", line 1, in
from pynput.keyboard import Key, Listener
File "/home/zirou/hk/programacao/python/python_3.5/mouseclick/pynput.py", line 1, in
from pynput.keyboard import Key, Listener
ImportError: No module named 'pynput.keyboard'; 'pynput' is not a package
If you can help me I will be grateful, thank you
sorry my english.
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#1, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAjOY6rl2eHT_8gnKR7ZExFZDvJaL6Ebks5qrJirgaJpZM4J_xNZ
hi moses-palmer,
Thank you very much my problema was with you informed, "Is the file from which you run your programme named pynput.py? In that case
Python may have difficulties finding the actual pynput package."
I rename the file the is problem go solved. Thank you.