I've got this python code where I would like to run from Windows Run. However, the cmd displays this message when I try an run it.
C:\Users\myName\AppData\Local\Programs\Python\Python38-32\python.exe: can't find '__main__' module in 'C:\\Users\\myName\\OneDrive'
I am using VS Code to write my program with a python 3.8.3 32-bit virtual enviroment. The python program is called pw.py and the batch file is called pw.bat
pw.py
C:\Users\myName\OneDrive - companyName\04 Programming\01 Visual Studio Code\LearningPython\pw.py
#! python3
# pw.py - An insecure password locker program.
import sys, pyperclip
PASSWORD = {'email': 'F7minlBDDuvMJuxESSKHFhTxFtjVB6',
'blog': 'VmAlvQyKAxiVH5G8vo1if1MLZF3sdt',
'luggage': '12345'}
if len(sys.argv) < 2:
print('Usage: python pw.py [account] - copy account password')
sys.exit()
account = sys.argv[1] # first commmand line arg is the account name
if account in PASSWORD:
pyperclip.copy(PASSWORD[account])
print('Password for ' + account + ' copied to clipboard.')
else:
print('There is no account named ' + account)
pw.bat
C:\Users\myName\MyPythonScripts
@py.exe C:\Users\myName\OneDrive - companyName\04 Programming\01 Visual Studio Code\LearningPython\pw.py %*
@pause