Python calls subprocess no such file or Directory__python

Source: Internet
Author: User

File "./t1.py", line one, in <module>
    oproc=subprocess. Popen (cmd,stdout=subprocess. Pipe,stderr=subprocess. PIPE)
  file "/usr/local/lib/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  file "/usr/ local/lib/python2.7/subprocess.py ", line 1308, in _execute_child
    raise Child_exception oserror
: [Errno 2] No Such file or directory

Python calls subprocess no such file or directory error

At first I thought there was no class library

But the corresponding class library is present.

And then we took a closer look to find out.

Cmd= "/usr/local/redis/bin/redis-cli-h" +sys.argv[1]+ "-P" +sys.argv[2]
Oproc = subprocess. Popen (CMD)

The command called by Popen is an array, and then writes its own string.

The use of a string

And Commands.getoutput's usage for granted.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.