python: raise child_exception, OSError: [Errno 2] No such file or directory

前端 未结 2 1633
逝去的感伤
逝去的感伤 2020-12-16 12:44

I execute a command in python using subprocess.popen() function like the following:

omp_cmd = \'cat %s | omp -h %s -u %s -w %s -p %s -X -\' %(temp_xml, self.         


        
2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-16 13:05

    This error has also occured for me too with tox scripts, turns out that a virtualenv is created with tox which has an asolute path with length about 96 characters but whenever it takes your absolute 'bin/pip' path to near about 123 chars, there is an invocation error, OSError2.

    'ERROR: invocation failed (errno 2), OSError: [Errno 2] No such file or directory'

    Python: Python 2.7.6 virtualenv:15.1.0 tox: 2.9.1 pip: 9.0.1 ubuntu 14.04 test ran with coverage: django(1.8-1.11) tests with py27, py35 each

    Resolution: I created my virtualenv(with abs path <=(96-100) chars) first where tox is installed, cloned my project to be used with this tox installation and virtualenv, tox creates it own virtualenvs now and it runs fine.

    hope it helps.

提交回复
热议问题