GVKun编程网logo

子流程引发CalledProcessError异常时检查命令的返回码(子流程的意义)

5

在本文中,我们将给您介绍关于子流程引发CalledProcessError异常时检查命令的返回码的详细内容,并且为您解答子流程的意义的相关问题,此外,我们还将为您提供关于04:Jobfordocker

在本文中,我们将给您介绍关于子流程引发CalledProcessError异常时检查命令的返回码的详细内容,并且为您解答子流程的意义的相关问题,此外,我们还将为您提供关于04: Job for docker.service failed because the control process exited with error code 解决、android – subprocess.CalledProcessError返回非零退出状态1、CalledProcessError:命令'['convert','--version']'返回非零退出状态1、Camunda 嵌套子流程(Embedded Subprocess)示例的知识。

本文目录一览:

子流程引发CalledProcessError异常时检查命令的返回码(子流程的意义)

子流程引发CalledProcessError异常时检查命令的返回码(子流程的意义)

我想stdout在python(3)脚本中捕获shell命令的流,并能够同时检查shell命令的返回代码(如果它返回错误)(即,如果它的返回代码是不为0)。

subprocess.check_output似乎是执行此操作的适当方法。从subprocess的手册页:

check_output(*popenargs, **kwargs)    Run command with arguments and return its output as a byte string.    If the exit code was non-zero it raises a CalledProcessError.  The    CalledProcessError object will have the return code in the returncode    attribute and output in the output attribute.

尽管如此,当失败时,我仍然无法从shell命令获取返回代码。我的代码如下所示:

import subprocessfailing_command=[''ls'', ''non_existent_dir'']try:    subprocess.check_output(failing_command)except:    ret = subprocess.CalledProcessError.returncode  # <- this seems to be wrong    if ret in (1, 2):        print("the command failed")    elif ret in (3, 4, 5):        print("the command failed very much")

这段代码在处理异常本身时引发了一个异常:

Traceback (most recent call last):  File "<stdin>", line 4, in <module>AttributeError: type object ''CalledProcessError'' has no attribute ''returncode''

我承认我不知道我哪里错了。

答案1

小编典典

要同时获取过程输出和返回的代码:

from subprocess import Popen, PIPEp = Popen(["ls", "non existent"], stdout=PIPE)output = p.communicate()[0]print(p.returncode)

subprocess.CalledProcessError是一类。要访问,请returncode使用异常实例:

from subprocess import CalledProcessError, check_outputtry:    output = check_output(["ls", "non existent"])    returncode = 0except CalledProcessError as e:    output = e.output    returncode = e.returncodeprint(returncode)

04: Job for docker.service failed because the control process exited with error code 解决

04: Job for docker.service failed because the control process exited with error code 解决

Job for docker.service failed because the control process exited with error code 解决

 

Job for docker.service failed because the control process exited with error code

这个一般是由于 /etc/docker/daemon.json 里面配置有误

正确配置例子

[root@k8s129 v2]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://aeckruos.mirror.aliyuncs.com"],
"insecure-registries": ["192.168.6.129:5000"]
}

 

逗号不能漏

 

切记切记。。。。。每行是有一个,号作为分隔符。

 

 

android – subprocess.CalledProcessError返回非零退出状态1

android – subprocess.CalledProcessError返回非零退出状态1

在运行kivy时,我收到了这个错误.我已经安装了蚂蚁.

subprocess.CalledProcessError: Command ''[''ant'',''debug'']'' returned non-zero exit status 1

谁能告诉我为什么会出现这个错误?由于Python或蚂蚁或其他任何东西?

解决方法

我收到了这个错误,但真正的错误略高于此:

Buildfile: /Users/rallen/Documents/Devel/python/kivy/python-for-android/dist/default/build.xml

BUILD Failed
/Users/rallen/Documents/Devel/python/kivy/python-for-android/dist/default/build.xml:6: **Source resource does not exist: /Users/rallen/Documents/Devel/python/kivy/python-for-android/dist/default/project.properties**

Total time: 0 seconds
Traceback (most recent call last):
  File "./build.py",line 412,in <module>
    make_package(args)
  File "./build.py",line 336,in make_package
    subprocess.check_call([ANT,arg])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py",line 511,in check_call
    raise CalledProcessError(retcode,cmd)
subprocess.CalledProcessError: Command ''[''ant'',''debug'']'' returned non-zero exit status 1

谷歌搜索了一下,我找到了

https://groups.google.com/forum/#!topic/kivy-users/igYampuxxCU

据说只是创建dist / default / project.properties并放

target=android-14

在那个文件中.我实际上使用了android-19,但这让我超越了这个问题.

CalledProcessError:命令'['convert','--version']'返回非零退出状态1

CalledProcessError:命令'['convert','--version']'返回非零退出状态1

如何解决CalledProcessError:命令''[''convert'',''--version'']''返回非零退出状态1?

从此处获得DLC-GPU.yaml:

incorrect display from custom domain

(base) mona@mona:~/research$ conda env create --name dlc --file=DLC-GPU.yaml
Collecting package Metadata (repodata.json): done
Solving environment: done

Downloading and Extracting Packages
gettext-0.19.8.1     | 2.9 MB    | ################################################################################################################################################################ | 100% 
ipython-7.18.1       | 989 KB    | ################################################################################################################################################################ | 100% 
jupyter_console-6.2. | 26 KB     | ################################################################################################################################################################ | 100% 
qtconsole-4.7.7      | 96 KB     | ################################################################################################################################################################ | 100% 
prompt_toolkit-3.0.7 | 12 KB     | ################################################################################################################################################################ | 100% 
geos-3.8.0           | 961 KB    | ################################################################################################################################################################ | 100% 
pango-1.45.3         | 361 KB    | ################################################################################################################################################################ | 100% 
shapely-1.7.1        | 390 KB    | ################################################################################################################################################################ | 100% 
pyzmq-19.0.2         | 438 KB    | ################################################################################################################################################################ | 100% 
nb_conda_kernels-2.3 | 26 KB     | ################################################################################################################################################################ | 100% 
notebook-6.1.1       | 4.0 MB    | ################################################################################################################################################################ | 100% 
harfbuzz-2.4.0       | 850 KB    | ################################################################################################################################################################ | 100% 
jedi-0.17.2          | 912 KB    | ################################################################################################################################################################ | 100% 
gstreamer-1.14.0     | 3.1 MB    | ################################################################################################################################################################ | 100% 
argon2-cffi-20.1.0   | 46 KB     | ################################################################################################################################################################ | 100% 
pyrsistent-0.17.3    | 89 KB     | ################################################################################################################################################################ | 100% 
ipykernel-5.3.4      | 179 KB    | ################################################################################################################################################################ | 100% 
nb_conda-2.2.1       | 32 KB     | ################################################################################################################################################################ | 100% 
cffi-1.14.3          | 223 KB    | ################################################################################################################################################################ | 100% 
glib-2.65.0          | 2.9 MB    | ################################################################################################################################################################ | 100% 
fribidi-1.0.10       | 103 KB    | ################################################################################################################################################################ | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: \ Enabling nb_conda_kernels...
Status: enabled

/ Config option `kernel_spec_manager_class` not recognized by `EnableNBExtensionApp`.
Enabling notebook extension nb_conda/main...
      - Validating: OK
Enabling tree extension nb_conda/tree...
      - Validating: OK
Config option `kernel_spec_manager_class` not recognized by `EnableServerExtensionApp`.
Enabling: nb_conda
- Writing config: /home/mona/anaconda3/envs/dlc/etc/jupyter
    - Validating...
      nb_conda 2.2.1 OK

done
Installing pip dependencies: / Ran pip subprocess with arguments:
[''/home/mona/anaconda3/envs/dlc/bin/python'',''-m'',''pip'',''install'',''-U'',''-r'',''/home/mona/research/condaenv.i4wb4gx_.requirements.txt'']
Pip subprocess output:
Collecting deeplabcut
  Using cached deeplabcut-2.1.8.2-py3-none-any.whl (400 kB)
Requirement already satisfied,skipping upgrade: certifi in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (2020.6.20)
Collecting matplotlib==3.0.3
  Using cached matplotlib-3.0.3-cp37-cp37m-manylinux1_x86_64.whl (13.0 MB)
Collecting numpy==1.16.4
  Using cached numpy-1.16.4-cp37-cp37m-manylinux1_x86_64.whl (17.3 MB)
Collecting scikit-image
  Downloading scikit_image-0.17.2-cp37-cp37m-manylinux1_x86_64.whl (12.5 MB)
Collecting scikit-learn
  Downloading scikit_learn-0.23.2-cp37-cp37m-manylinux1_x86_64.whl (6.8 MB)
Requirement already satisfied,skipping upgrade: ipython-genutils in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (0.2.0)
Collecting ruamel.yaml~=0.15
  Using cached ruamel.yaml-0.16.12-py2.py3-none-any.whl (111 kB)
Collecting tqdm
  Using cached tqdm-4.49.0-py2.py3-none-any.whl (69 kB)
Requirement already satisfied,skipping upgrade: six in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (1.15.0)
Collecting tables
  Using cached tables-3.6.1-cp37-cp37m-manylinux1_x86_64.whl (4.3 MB)
Collecting tensorpack>=0.9.7.1
  Using cached tensorpack-0.10.1-py2.py3-none-any.whl (291 kB)
Collecting statsmodels
  Downloading statsmodels-0.12.0-cp37-cp37m-manylinux1_x86_64.whl (9.5 MB)
Requirement already satisfied,skipping upgrade: ipython in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (7.18.1)
Requirement already satisfied,skipping upgrade: setuptools in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (49.6.0.post20200814)
Collecting pyyaml>=5.1
  Using cached PyYAML-5.3.1.tar.gz (269 kB)
Collecting intel-openmp
  Using cached intel_openmp-2020.0.133-py2.py3-none-manylinux1_x86_64.whl (919 kB)
Collecting opencv-python~=3.4
  Downloading opencv_python-3.4.11.43-cp37-cp37m-manylinux2014_x86_64.whl (49.1 MB)
Requirement already satisfied,skipping upgrade: python-dateutil in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (2.8.1)
Processing /home/mona/.cache/pip/wheels/db/37/b8/b3785332f8246f1306c2863553860ca65e1824fc4c8251c7f1/moviepy-1.0.1-py3-none-any.whl
Collecting patsy
  Using cached patsy-0.5.1-py2.py3-none-any.whl (231 kB)
Processing /home/mona/.cache/pip/wheels/88/96/68/c2be18e7406804be2e593e1c37845f2dd20ac2ce1381ce40b0/easydict-1.9-py3-none-any.whl
Collecting pandas>=1.0.
  Using cached pandas-1.1.2-cp37-cp37m-manylinux1_x86_64.whl (10.5 MB)
Requirement already satisfied,skipping upgrade: wheel in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (0.35.1)
Collecting click
  Using cached click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting imgaug
  Using cached imgaug-0.4.0-py2.py3-none-any.whl (948 kB)
Collecting chardet
  Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Requirement already satisfied,skipping upgrade: scipy in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (1.5.2)
Requirement already satisfied,skipping upgrade: h5py~=2.7 in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (2.10.0)
Collecting requests
  Using cached requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting kiwisolver>=1.0.1
  Downloading kiwisolver-1.2.0-cp37-cp37m-manylinux1_x86_64.whl (88 kB)
Requirement already satisfied,skipping upgrade: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from matplotlib==3.0.3->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (2.4.7)
Collecting cycler>=0.10
  Using cached cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)
Collecting pillow!=7.1.0,!=7.1.1,>=4.3.0
  Using cached Pillow-7.2.0-cp37-cp37m-manylinux1_x86_64.whl (2.2 MB)
Collecting imageio>=2.3.0
  Using cached imageio-2.9.0-py3-none-any.whl (3.3 MB)
Collecting tifffile>=2019.7.26
  Using cached tifffile-2020.9.22-py3-none-any.whl (153 kB)
Collecting networkx>=2.0
  Using cached networkx-2.5-py3-none-any.whl (1.6 MB)
Collecting PyWavelets>=1.1.1
  Downloading PyWavelets-1.1.1-cp37-cp37m-manylinux1_x86_64.whl (4.4 MB)
Collecting threadpoolctl>=2.0.0
  Using cached threadpoolctl-2.1.0-py3-none-any.whl (12 kB)
Collecting joblib>=0.11
  Using cached joblib-0.16.0-py3-none-any.whl (300 kB)
Collecting ruamel.yaml.clib>=0.1.2; platform_python_implementation == "cpython" and python_version < "3.9"
  Using cached ruamel.yaml.clib-0.2.2-cp37-cp37m-manylinux1_x86_64.whl (547 kB)
Collecting numexpr>=2.6.2
  Using cached numexpr-2.7.1-cp37-cp37m-manylinux1_x86_64.whl (162 kB)
Collecting psutil>=5
  Using cached psutil-5.7.2.tar.gz (460 kB)
Collecting msgpack>=0.5.2
  Downloading msgpack-1.0.0-cp37-cp37m-manylinux1_x86_64.whl (275 kB)
Collecting msgpack-numpy>=0.4.4.2
  Using cached msgpack_numpy-0.4.7-py2.py3-none-any.whl (6.4 kB)
Collecting tabulate>=0.7.7
  Using cached tabulate-0.8.7-py3-none-any.whl (24 kB)
Requirement already satisfied,skipping upgrade: termcolor>=1.1 in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from tensorpack>=0.9.7.1->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (1.1.0)
Requirement already satisfied,skipping upgrade: pyzmq>=16 in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from tensorpack>=0.9.7.1->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (19.0.2)
Requirement already satisfied,skipping upgrade: traitlets>=4.2 in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from ipython->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (4.3.3)
Requirement already satisfied,skipping upgrade: pygments in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from ipython->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (2.7.1)
Requirement already satisfied,skipping upgrade: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from ipython->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (3.0.7)
Requirement already satisfied,skipping upgrade: pexpect>4.3; sys_platform != "win32" in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from ipython->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (4.8.0)
Requirement already satisfied,skipping upgrade: decorator in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from ipython->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (4.4.2)
Requirement already satisfied,skipping upgrade: jedi>=0.10 in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from ipython->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (0.17.2)
Requirement already satisfied,skipping upgrade: pickleshare in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from ipython->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (0.7.5)
Requirement already satisfied,skipping upgrade: backcall in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from ipython->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (0.2.0)
Processing /home/mona/.cache/pip/wheels/12/36/1f/dc61e6ac10781d63cf6fa045eb09fa613a667384e12cb6e6e0/proglog-0.1.9-py3-none-any.whl
Collecting imageio-ffmpeg>=0.2.0; python_version >= "3.4"
  Using cached imageio_ffmpeg-0.4.2-py3-none-manylinux2010_x86_64.whl (26.9 MB)
Collecting pytz>=2017.2
  Using cached pytz-2020.1-py2.py3-none-any.whl (510 kB)
Requirement already satisfied,skipping upgrade: Shapely in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from imgaug->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (1.7.1)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Using cached urllib3-1.25.10-py2.py3-none-any.whl (127 kB)
Collecting idna<3,>=2.5
  Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Requirement already satisfied,skipping upgrade: wcwidth in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from prompt-toolkit!=3.0.0,>=2.0.0->ipython->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (0.2.5)
Requirement already satisfied,skipping upgrade: ptyprocess>=0.5 in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from pexpect>4.3; sys_platform != "win32"->ipython->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (0.6.0)
Requirement already satisfied,skipping upgrade: parso<0.8.0,>=0.7.0 in /home/mona/anaconda3/envs/dlc/lib/python3.7/site-packages (from jedi>=0.10->ipython->deeplabcut->-r /home/mona/research/condaenv.i4wb4gx_.requirements.txt (line 1)) (0.7.0)
Building wheels for collected packages: pyyaml,psutil
  Building wheel for pyyaml (setup.py): started
  Building wheel for pyyaml (setup.py): finished with status ''done''
  Created wheel for pyyaml: filename=PyYAML-5.3.1-cp37-cp37m-linux_x86_64.whl size=44619 sha256=bb81132d4bd4786a05057991336e112ed3ff6dde5653560f264e447e3b2f0e9c
  Stored in directory: /home/mona/.cache/pip/wheels/5e/03/1e/e1e954795d6f35dfc7b637fe2277bff021303bd9570ecea653
  Building wheel for psutil (setup.py): started
  Building wheel for psutil (setup.py): finished with status ''done''
  Created wheel for psutil: filename=psutil-5.7.2-cp37-cp37m-linux_x86_64.whl size=292666 sha256=2b7326dd5f5f648c6f167599c04470dc27949e7d56211052d7231aa9318db886
  Stored in directory: /home/mona/.cache/pip/wheels/2d/43/97/00701864a7bee6d9e1a52dd682537dcbf1d013d0e2e6f0c1f1
Successfully built pyyaml psutil
Installing collected packages: kiwisolver,cycler,numpy,matplotlib,pillow,imageio,tifffile,networkx,PyWavelets,scikit-image,threadpoolctl,joblib,scikit-learn,ruamel.yaml.clib,ruamel.yaml,tqdm,numexpr,tables,psutil,msgpack,msgpack-numpy,tabulate,tensorpack,pytz,pandas,patsy,statsmodels,pyyaml,intel-openmp,opencv-python,proglog,chardet,urllib3,idna,requests,imageio-ffmpeg,moviepy,easydict,click,imgaug,deeplabcut
  Attempting uninstall: numpy
    Found existing installation: numpy 1.19.1
    Uninstalling numpy-1.19.1:
      Successfully uninstalled numpy-1.19.1
Successfully installed PyWavelets-1.1.1 chardet-3.0.4 click-7.1.2 cycler-0.10.0 deeplabcut-2.1.8.2 easydict-1.9 idna-2.10 imageio-2.9.0 imageio-ffmpeg-0.4.2 imgaug-0.4.0 intel-openmp-2020.0.133 joblib-0.16.0 kiwisolver-1.2.0 matplotlib-3.0.3 moviepy-1.0.1 msgpack-1.0.0 msgpack-numpy-0.4.7 networkx-2.5 numexpr-2.7.1 numpy-1.16.4 opencv-python-3.4.11.43 pandas-1.1.2 patsy-0.5.1 pillow-7.2.0 proglog-0.1.9 psutil-5.7.2 pytz-2020.1 pyyaml-5.3.1 requests-2.24.0 ruamel.yaml-0.16.12 ruamel.yaml.clib-0.2.2 scikit-image-0.17.2 scikit-learn-0.23.2 statsmodels-0.12.0 tables-3.6.1 tabulate-0.8.7 tensorpack-0.10.1 threadpoolctl-2.1.0 tifffile-2020.9.22 tqdm-4.49.0 urllib3-1.25.10

done
#
# To activate this environment,use
#
#     $ conda activate dlc
#
# To deactivate an active environment,use
#
#     $ conda deactivate

(base) mona@mona:~/research$ conda activate dlc
(dlc) mona@mona:~/research$ pip install deeplabcut==2.2b8

(dlc) mona@mona:~/research$ ipython
Python 3.7.9 (default,Aug 31 2020,12:42:55) 
Type ''copyright'',''credits'' or ''license'' for more information
IPython 7.18.1 -- An enhanced Interactive Python. Type ''?'' for help.

In [1]: import deeplabcut as dlc
---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
<ipython-input-1-7dc21562c90f> in <module>
----> 1 import deeplabcut as dlc

~/anaconda3/envs/dlc/lib/python3.7/site-packages/deeplabcut/__init__.py in <module>
     36 else:  # standard use [wxpython supported]
     37     mpl.use("WxAgg")
---> 38     from deeplabcut import generate_training_dataset
     39     from deeplabcut import refine_training_dataset
     40     from deeplabcut.generate_training_dataset import (

~/anaconda3/envs/dlc/lib/python3.7/site-packages/deeplabcut/generate_training_dataset/__init__.py in <module>
     16 else:
     17     from deeplabcut.generate_training_dataset.auxfun_drag_label import *
---> 18     from deeplabcut.generate_training_dataset.labeling_toolBox import *
     19     from deeplabcut.generate_training_dataset.multiple_individuals_labeling_toolBox import *
     20     from deeplabcut.generate_training_dataset.frame_extraction_toolBox import *

~/anaconda3/envs/dlc/lib/python3.7/site-packages/deeplabcut/generate_training_dataset/labeling_toolBox.py in <module>
     31 
     32 from deeplabcut.generate_training_dataset import auxfun_drag_label
---> 33 from deeplabcut.utils import auxiliaryfunctions
     34 
     35 # ###########################################################################

~/anaconda3/envs/dlc/lib/python3.7/site-packages/deeplabcut/utils/__init__.py in <module>
      4 from deeplabcut.utils.conversioncode import *
      5 from deeplabcut.utils.frameselectiontools import *
----> 6 from deeplabcut.utils.make_labeled_video import *
      7 from deeplabcut.utils.plotting import *
      8 from deeplabcut.utils.video_processor import *

~/anaconda3/envs/dlc/lib/python3.7/site-packages/deeplabcut/utils/make_labeled_video.py in <module>
     26 import matplotlib.pyplot as plt
     27 import numpy as np
---> 28 from matplotlib.animation import FFMpegWriter
     29 from matplotlib.collections import LineCollection
     30 from skimage.draw import circle,line_aa

~/anaconda3/envs/dlc/lib/python3.7/site-packages/matplotlib/animation.py in <module>
    735 # Combine ImageMagick options with pipe-based writing
    736 @writers.register(''imagemagick'')
--> 737 class ImageMagickWriter(ImageMagickBase,MovieWriter):
    738     ''''''Pipe-based animated gif.
    739 

~/anaconda3/envs/dlc/lib/python3.7/site-packages/matplotlib/animation.py in wrapper(writerClass)
    118         def wrapper(writerClass):
    119             self._registered[name] = writerClass
--> 120             if writerClass.isAvailable():
    121                 self.avail[name] = writerClass
    122             return writerClass

~/anaconda3/envs/dlc/lib/python3.7/site-packages/matplotlib/animation.py in isAvailable(cls)
    728     def isAvailable(cls):
    729         try:
--> 730             return super().isAvailable()
    731         except FileNotFoundError:  # May be raised by get_executable_info.
    732             return False

~/anaconda3/envs/dlc/lib/python3.7/site-packages/matplotlib/animation.py in isAvailable(cls)
    425         Check to see if a MovieWriter subclass is actually available.
    426         ''''''
--> 427         return shutil.which(cls.bin_path()) is not None
    428 
    429 

~/anaconda3/envs/dlc/lib/python3.7/site-packages/matplotlib/animation.py in bin_path(cls)
    722         binpath = super().bin_path()
    723         if binpath == ''convert'':
--> 724             binpath = mpl._get_executable_info(''magick'').executable
    725         return binpath
    726 

~/anaconda3/envs/dlc/lib/python3.7/site-packages/matplotlib/__init__.py in _get_executable_info(name)
    383             raise FileNotFoundError(
    384                 "Failed to find an ImageMagick installation")
--> 385         return impl([path,"--version"],r"^Version: ImageMagick (\S*)")
    386     elif name == "pdftops":
    387         info = impl(["pdftops","-v"],"^pdftops version (.*)",~/anaconda3/envs/dlc/lib/python3.7/site-packages/matplotlib/__init__.py in impl(args,regex,min_ver,ignore_exit_code)
    328                 output = _cpe.output
    329             else:
--> 330                 raise _cpe
    331         match = re.search(regex,output)
    332         if match:

~/anaconda3/envs/dlc/lib/python3.7/site-packages/matplotlib/__init__.py in impl(args,ignore_exit_code)
    323             output = subprocess.check_output(
    324                 args,stderr=subprocess.STDOUT,--> 325                 universal_newlines=True,errors="replace")
    326         except subprocess.CalledProcessError as _cpe:
    327             if ignore_exit_code:

~/anaconda3/envs/dlc/lib/python3.7/subprocess.py in check_output(timeout,*popenargs,**kwargs)
    409 
    410     return run(*popenargs,stdout=PIPE,timeout=timeout,check=True,--> 411                **kwargs).stdout
    412 
    413 

~/anaconda3/envs/dlc/lib/python3.7/subprocess.py in run(input,capture_output,timeout,check,**kwargs)
    510         if check and retcode:
    511             raise CalledProcessError(retcode,process.args,--> 512                                      output=stdout,stderr=stderr)
    513     return CompletedProcess(process.args,retcode,stdout,stderr)
    514 

CalledProcessError: Command ''[''convert'',''--version'']'' returned non-zero exit status 1.

In [2]: 

$ lsb_release -a 
LSB Version:    core-11.1.0ubuntu2-noarch:security-11.1.0ubuntu2-noarch
distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:    20.04
Codename:   focal

为了将来的可重复性,我也在这里转储DLC-GPU.yaml:

# DLC-GPU.yaml

#DeepLabCut2.0 ToolBox (deeplabcut.org)
#© A. & M. Mathis Labs
#https://github.com/AlexEMG/DeepLabCut
#Please see AUTHORS for contributors.

#https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS
#Licensed under GNU Lesser General Public License v3.0
#
# DeepLabCut environment
# FirsT: INSTALL CORRECT DRIVER for GPU,see https://stackoverflow.com/questions/30820513/what-is-the-correct-version-of-cuda-for-my-nvidia-driver/30820690
#
# Suggested by Jan Eglinger see https://github.com/AlexEMG/DeepLabCut/issues/112
#
# install: conda env create -f DLC-GPU.yaml
# update:  conda env update -f DLC-GPU.yaml
name: DLC-GPU
dependencies:
  - python=3.7
  - pip
  - tensorflow-gpu==1.13.1
  - cudnn=7
  - wxpython<4.1.0
  - jupyter
  - nb_conda
  - Shapely
  - pip:
    - deeplabcut

解决方法

matplotlib.animation需要ffmpeg用于保存电影,而ImageMagick需要用于保存动画gif。

请参见https://matplotlib.org/users/installing.html#install-requirements

使用系统软件包管理器安装它们:

sudo apt update
sudo apt install ffmpeg ImageMagick

Camunda 嵌套子流程(Embedded Subprocess)示例

Camunda 嵌套子流程(Embedded Subprocess)示例

       Camunda子流程有两种实现方式:嵌套子流程(Embedded Subprocess和外部子流程(Call Activity)。以下介绍Camunda嵌套子流程(Embedded Subprocess)的实现方式。

一、什么是嵌套子流程

       子流程是包含其他活动、网关、事件等的活动,其本身形成的流程是更大流程的一部分。子流程完全在父流程中定义(这就是为什么它通常被称为嵌入式子流程)。

      嵌套子流程有什么用处?以下是官方的解释:

  • Subprocesses allow hierarchical modeling. Many modeling tools allow that subprocesses can be collapsed, hiding all the details of the subprocess and displaying a high-level, end-to-end overview of the business process.

       子流程允许分层建模。许多建模工具允许折叠子流程,隐藏子流程的所有细节,并显示业务流程的高级端到端概述。

  • A subprocess creates a new scope for events. Events that are thrown during execution of the subprocess can be caught by a boundary event on the boundary of the subprocess, thus creating a scope for that event, limited to the subprocess.

      子流程为事件创建一个新的范围。在子流程执行期间抛出的事件可以由子流程边界上的边界事件捕获,从而为该事件创建一个范围,限制在子流程。

示例流程图:

 

 

上面的流程模型表明: 如果我们被邀请去吃饭,我们会取消我们的烹饪过程。然而,如果我们已经在吃了,我们就不会再对邀请做出反应了。用更专业的术语来说,消息事件的范围是子流程,因此只能在子流程处于活动状态时接收消息。

 

二、流程模拟验证

 

模拟公文处理流程:拟稿人起草公文——》部门会签——》领导签发,其中部门会签通过嵌套子流程实现。

 

第一步、设计流程图

 

 

BPMN流程模型文件:

<?xml version="1.0" encoding="UTF-8"?>

<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0pf7z9i" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">

  <bpmn:process id="Process_0gricxz" name="嵌套子流程" isExecutable="true">

    <bpmn:startEvent id="StartEvent_1">

      <bpmn:outgoing>Flow_0rfd9kh</bpmn:outgoing>

    </bpmn:startEvent>

    <bpmn:sequenceFlow id="Flow_0rfd9kh" sourceRef="StartEvent_1" targetRef="Activity_1grmrle" />

    <bpmn:subProcess id="Activity_01d0fiw" name="部门会签子流程">

      <bpmn:incoming>Flow_1anv3xt</bpmn:incoming>

      <bpmn:outgoing>Flow_1c66957</bpmn:outgoing>

      <bpmn:multiInstanceLoopCharacteristics camunda:collection="assigneeList" camunda:elementVariable="assignee" />

      <bpmn:startEvent id="Event_1lqvv26">

        <bpmn:outgoing>Flow_0e1k6u7</bpmn:outgoing>

      </bpmn:startEvent>

      <bpmn:sequenceFlow id="Flow_0e1k6u7" sourceRef="Event_1lqvv26" targetRef="Activity_1ec2oya" />

      <bpmn:userTask id="Activity_1ec2oya" name="会签" camunda:assignee="${assignee}">

        <bpmn:incoming>Flow_0e1k6u7</bpmn:incoming>

        <bpmn:outgoing>Flow_0e6563y</bpmn:outgoing>

      </bpmn:userTask>

      <bpmn:sequenceFlow id="Flow_0e6563y" sourceRef="Activity_1ec2oya" targetRef="Event_1xjupth" />

      <bpmn:endEvent id="Event_1xjupth">

        <bpmn:incoming>Flow_0e6563y</bpmn:incoming>

      </bpmn:endEvent>

    </bpmn:subProcess>

    <bpmn:sequenceFlow id="Flow_1anv3xt" name="发起会签" sourceRef="Activity_1grmrle" targetRef="Activity_01d0fiw">

      <bpmn:extensionElements>

        <camunda:executionListener event="take">

          <camunda:script scriptFormat="groovy">def userList = ["user1","user2","user3"];

execution.setVariable("assigneeList", userList);</camunda:script>

        </camunda:executionListener>

      </bpmn:extensionElements>

    </bpmn:sequenceFlow>

    <bpmn:endEvent id="Event_1e5cfza">

      <bpmn:incoming>Flow_1l1q3kb</bpmn:incoming>

    </bpmn:endEvent>

    <bpmn:sequenceFlow id="Flow_1l1q3kb" sourceRef="Activity_0rlr3iz" targetRef="Event_1e5cfza" />

    <bpmn:sequenceFlow id="Flow_1c66957" name="会签完成" sourceRef="Activity_01d0fiw" targetRef="Activity_0rlr3iz" />

    <bpmn:userTask id="Activity_1grmrle" name="起草公文" camunda:assignee="demo">

      <bpmn:incoming>Flow_0rfd9kh</bpmn:incoming>

      <bpmn:outgoing>Flow_1anv3xt</bpmn:outgoing>

    </bpmn:userTask>

    <bpmn:userTask id="Activity_0rlr3iz" name="领导签发" camunda:assignee="demo">

      <bpmn:incoming>Flow_1c66957</bpmn:incoming>

      <bpmn:outgoing>Flow_1l1q3kb</bpmn:outgoing>

    </bpmn:userTask>

  </bpmn:process>

  <bpmndi:BPMNDiagram id="BPMNDiagram_1">

    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_0gricxz">

      <bpmndi:BPMNEdge id="Flow_1c66957_di" bpmnElement="Flow_1c66957">

        <di:waypoint x="800" y="190" />

        <di:waypoint x="880" y="190" />

        <bpmndi:BPMNLabel>

          <dc:Bounds x="812.9999999999999" y="173" width="45" height="14" />

        </bpmndi:BPMNLabel>

      </bpmndi:BPMNEdge>

      <bpmndi:BPMNEdge id="Flow_1l1q3kb_di" bpmnElement="Flow_1l1q3kb">

        <di:waypoint x="980" y="190" />

        <di:waypoint x="1042" y="190" />

      </bpmndi:BPMNEdge>

      <bpmndi:BPMNEdge id="Flow_1anv3xt_di" bpmnElement="Flow_1anv3xt">

        <di:waypoint x="340" y="180" />

        <di:waypoint x="420" y="180" />

        <bpmndi:BPMNLabel>

          <dc:Bounds x="353" y="153" width="44" height="14" />

        </bpmndi:BPMNLabel>

      </bpmndi:BPMNEdge>

      <bpmndi:BPMNEdge id="Flow_0rfd9kh_di" bpmnElement="Flow_0rfd9kh">

        <di:waypoint x="188" y="180" />

        <di:waypoint x="240" y="180" />

      </bpmndi:BPMNEdge>

      <bpmndi:BPMNShape id="Activity_1xs84zt_di" bpmnElement="Activity_0rlr3iz">

        <dc:Bounds x="880" y="140" width="100" height="80" />

      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape id="Activity_01n6dcy_di" bpmnElement="Activity_1grmrle">

        <dc:Bounds x="240" y="140" width="100" height="80" />

      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape id="Event_1e5cfza_di" bpmnElement="Event_1e5cfza">

        <dc:Bounds x="1042" y="172" width="36" height="36" />

      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">

        <dc:Bounds x="152" y="162" width="36" height="36" />

      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape id="Activity_01d0fiw_di" bpmnElement="Activity_01d0fiw" isExpanded="true">

        <dc:Bounds x="420" y="80" width="380" height="200" />

      </bpmndi:BPMNShape>

      <bpmndi:BPMNEdge id="Flow_0e1k6u7_di" bpmnElement="Flow_0e1k6u7">

        <di:waypoint x="496" y="180" />

        <di:waypoint x="570" y="180" />

      </bpmndi:BPMNEdge>

      <bpmndi:BPMNEdge id="Flow_0e6563y_di" bpmnElement="Flow_0e6563y">

        <di:waypoint x="670" y="180" />

        <di:waypoint x="732" y="180" />

      </bpmndi:BPMNEdge>

      <bpmndi:BPMNShape id="Event_1lqvv26_di" bpmnElement="Event_1lqvv26">

        <dc:Bounds x="460" y="162" width="36" height="36" />

      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape id="Event_1xjupth_di" bpmnElement="Event_1xjupth">

        <dc:Bounds x="732" y="162" width="36" height="36" />

      </bpmndi:BPMNShape>

      <bpmndi:BPMNShape id="Activity_0xbobyf_di" bpmnElement="Activity_1ec2oya">

        <dc:Bounds x="570" y="140" width="100" height="80" />

      </bpmndi:BPMNShape>

    </bpmndi:BPMNPlane>

  </bpmndi:BPMNDiagram>

</bpmn:definitions>

第二步、发起流程

通过demo用户登录camunda平台http://localhost:8080/camunda/app/tasklist/default/#/login,发起流程:

 

 

 

启动流程后,此时流程在主流程第一个活动节点,点击提交流程。

 

 

第三步、审批流程

 

提交流程后,流程自动进入嵌套子流程,该流程设置了3个用户模拟并行会签,所以收到3个待办任务,这3个任务是并行的,分别通过user1、user2、user3登录后处理,完成子流程会签。

 

 

user1、user2、user3会签完成后,流程自动进入主流程。

 

 

 

 

关于子流程引发CalledProcessError异常时检查命令的返回码子流程的意义的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于04: Job for docker.service failed because the control process exited with error code 解决、android – subprocess.CalledProcessError返回非零退出状态1、CalledProcessError:命令'['convert','--version']'返回非零退出状态1、Camunda 嵌套子流程(Embedded Subprocess)示例的相关信息,请在本站寻找。

本文标签: