Apr-05-2020, 11:47 PM
hello,
I wish to run a python script, passing arguments, from command line (powershell core) without the need to write before the script name
I am from windows 10 and I am using anaconda.
I am aware that i can convert the .py to .exe but i am not willing because i need to make changes to it.
the script is in my path.
first from CMD I associated python script to my python.exe (i followed this https://stackoverflow.com/questions/1147...hon-in-cmd):
I try another way and finally it works:
I wish to run a python script, passing arguments, from command line (powershell core) without the need to write before the script name
python
.I am from windows 10 and I am using anaconda.
I am aware that i can convert the .py to .exe but i am not willing because i need to make changes to it.
the script is in my path.
first from CMD I associated python script to my python.exe (i followed this https://stackoverflow.com/questions/1147...hon-in-cmd):
C:\Users\vincenzo>assoc .py .py=Python C:\Users\vincenzo>ftype Python Python="C:\Users\vincenzo\Miniconda3\python.exe" "%1" %*so now i try to run my script (
wrap.py
) from powershell, but it argue that i missed a package:(base) PS C:\Users\vincenzo\Cloud\Hobby\Programmi\bin> ls Directory: C:\Users\vincenzo\Cloud\Hobby\Programmi\bin Mode LastWriteTime Length Name ---- ------------- ------ ---- -a--- 06/03/2020 19:39 16116736 arduino-cli.exe -a--- 10/04/2019 19:13 66999808 ffmpeg.exe -a--- 05/02/2020 16:25 14153454 render_pcb.exe -a--- 06/04/2020 01:01 28 test.py -a--- 06/04/2020 01:29 850 wrap.py (base) PS C:\Users\vincenzo\Cloud\Hobby\Programmi\bin> wrap Traceback (most recent call last): File "C:\Users\vincenzo/Cloud/Hobby/Programmi/bin\wrap.py", line 6, in <module> import pyperclip, click ImportError: No module named pyperclip (base) PS C:\Users\vincenzo\Cloud\Hobby\Programmi\bin> wrap.py Traceback (most recent call last): File "C:\Users\vincenzo/Cloud/Hobby/Programmi/bin\wrap.py", line 6, in <module> import pyperclip, click ImportError: No module named pyperclip (base) PS C:\Users\vincenzo\Cloud\Hobby\Programmi\bin> .\wrap.py Traceback (most recent call last): File "C:\Users\vincenzo\Cloud\Hobby\Programmi\bin\wrap.py", line 6, in <module> import pyperclip, click ImportError: No module named pyperclipas you can see none worked, but i am sure that i have the package:
(base) PS C:\Users\vincenzo\Cloud\Hobby\Programmi\bin> conda list | grep pyperclip pyperclip 1.7.0 py_0 conda-forgeand i was right.
I try another way and finally it works:
(base) PS C:\Users\vincenzo\Cloud\Hobby\Programmi\bin> python wrap.py Usage: / [OPTIONS] WORD Try "/ --help" for help.Can someone help me to make it working this way?
wrap this_is_an_argument