[Errno 2] No such file or directory:

Peter Otten __peter__ at web.de
Wed Jul 28 12:20:58 EDT 2021


On 28/07/2021 18:09, joseph pareti wrote:
> The following code fails as shown in the title:
> 
> 
> 
> 
> 
> 
> *import subprocesscmd = 'ls -l
> /media/joepareti54/Elements/x/finance-2020/AI/Listen_attend_spell/VCTK-Corpus/wav48
> | awk "{print  $9 }"'process = subprocess.Popen([cmd],

As a quick fix try

process = subprocess.Popen(
     cmd # no list
     shell=True,
     ... # other args as above
)

>   stdout=subprocess.PIPE, stderr=subprocess.PIPE)stdout, stderr =
> process.communicate()print('stdout ',stdout)print('stderr ',stderr)*
> 
> ----
> 
> Traceback (most recent call last):
>    File "PreProcess_1a.py", line 3, in <module>
>      process = subprocess.Popen([cmd],  stdout=subprocess.PIPE,
> stderr=subprocess.PIPE)
>    File "/home/joepareti54/anaconda3/lib/python3.8/subprocess.py", line 854,
> in __init__
>      self._execute_child(args, executable, preexec_fn, close_fds,
>    File "/home/joepareti54/anaconda3/lib/python3.8/subprocess.py", line
> 1702, in _execute_child
>      raise child_exception_type(errno_num, err_msg, err_filename)
> FileNotFoundError: [Errno 2] No such file or directory: 'ls -l
> /media/joepareti54/Elements/x/finance-2020/AI/Listen_attend_spell/VCTK-Corpus/wav48
> | awk "{print  $9
> 




More information about the Python-list mailing list