cmd2 version: 0.9.16
Python version: 3.7.3
OS name and version: WSL
What you did to cause the bug to occur?
I have removed all Windows paths in $PATH in my WSL shell which forbids the access of powershell.exe used by pyperclip. Clipboard capability is tested when importing the cmd2 module in cmd2/clipboard.py but catching only PyperclipException is not enough as FileNotFoundError could be raised.
A traceback of import cmd2 in Python repl looks like this:
Python 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cmd2
Traceback (most recent call last):
File "", line 1, in
File "/mnt/f/cmd2/env/lib/python3.7/site-packages/cmd2/__init__.py", line 15, in
from .cmd2 import Cmd, Statement, EmptyStatement, categorize
File "/mnt/f/cmd2/env/lib/python3.7/site-packages/cmd2/cmd2.py", line 51, in
from .clipboard import can_clip, get_paste_buffer, write_to_paste_buffer
File "/mnt/f/cmd2/env/lib/python3.7/site-packages/cmd2/clipboard.py", line 12, in
_ = pyperclip.paste()
File "/mnt/f/cmd2/env/lib/python3.7/site-packages/pyperclip/__init__.py", line 638, in lazy_load_stub_paste
return paste()
File "/mnt/f/cmd2/env/lib/python3.7/site-packages/pyperclip/__init__.py", line 479, in paste_wsl
close_fds=True)
File "/home/a1696994/miniconda3/lib/python3.7/subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "/home/a1696994/miniconda3/lib/python3.7/subprocess.py", line 1522, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'powershell.exe': 'powershell.exe'
cmd2 version: 0.9.16
Python version: 3.7.3
OS name and version: WSL
What you did to cause the bug to occur?
I have removed all Windows paths in
$PATHin my WSL shell which forbids the access ofpowershell.exeused bypyperclip. Clipboard capability is tested when importing thecmd2module incmd2/clipboard.pybut catching onlyPyperclipExceptionis not enough asFileNotFoundErrorcould be raised.A traceback of
import cmd2in Python repl looks like this:Python 3.7.3 (default, Mar 27 2019, 22:11:17) [GCC 7.3.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cmd2 Traceback (most recent call last): File "", line 1, in File "/mnt/f/cmd2/env/lib/python3.7/site-packages/cmd2/__init__.py", line 15, in from .cmd2 import Cmd, Statement, EmptyStatement, categorize File "/mnt/f/cmd2/env/lib/python3.7/site-packages/cmd2/cmd2.py", line 51, in from .clipboard import can_clip, get_paste_buffer, write_to_paste_buffer File "/mnt/f/cmd2/env/lib/python3.7/site-packages/cmd2/clipboard.py", line 12, in _ = pyperclip.paste() File "/mnt/f/cmd2/env/lib/python3.7/site-packages/pyperclip/__init__.py", line 638, in lazy_load_stub_paste return paste() File "/mnt/f/cmd2/env/lib/python3.7/site-packages/pyperclip/__init__.py", line 479, in paste_wsl close_fds=True) File "/home/a1696994/miniconda3/lib/python3.7/subprocess.py", line 775, in __init__ restore_signals, start_new_session) File "/home/a1696994/miniconda3/lib/python3.7/subprocess.py", line 1522, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'powershell.exe': 'powershell.exe'