I'm a noobie to python. So I made this simple script which basically when run it takes 1 argument and then it copies the message associated with that argument to your clipboard. the code -
message = {'available' : 'yeah, come to my office', 'busy' : 'nah, man busy right now', 'hate' : 'i dont like you anymore'}
import sys
import pyperclip
if len(sys.argv) < 2 :
print('Usage:mclip[arg]')
sys.exit()
keyphrase = 'busy'
if keyphrase in message.keys() :
pyperclip.copy(message[keyphrase])
print('{} copyied to clipboard'.format(message[keyphrase]))
else :
print('{} not in registered'.format(keyphrase))
Now, how do I run it from cmd?? I tried running it from the vs code
powershell terminal which is is the same working directory as the file. But I keep getting this error -
python clipboard.py
C:\Users\Kakshipth\AppData\Local\Programs\Python\Python38-32\python.exe: can't open file 'clipboard.py': [Errno 2] No such file or directory
I get a similar error when I try python3 clipboard.py
Please help me out, also tell me how do you guys execute scripts? Like do you make a .bat file or just run the python file.