我想传递变量" NUMBER_CAMS"和我的python脚本中的值到bash环境文件" env_roadrunner"
以下是我写的代码
import subprocess
import os
import sys
import ConfigParser
os.chdir("/home/vasudev/LTECamOrchestrator_docker/tools/")
NUMBER_CAMS=sys.argv[2]
cmd = "xterm -hold -e sudo /home/vasudev/LTECamOrchestrator_docker/tools/create_pcap_replay_encoder " \
" /home/vasudev/LTECamOrchestrator_docker/tools/env_roadrunner"
p = subprocess.Popen([cmd] , shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
以下是我的bash脚本,它带有环境变量
#!/bin/bash
# the name or ip address of the orchestrator
ORCHESTRATOR_IP="192.168.212.131"
# the port of the orchestrator
ORCHESTRATOR_PORT=9000
# password for the admin user
ORCHESTRATOR_PASSWORD='.qoq~^c^%l^U#e~'
# number of cameras to create from this pcap file
NUMBER_CAMS="$N"
# three port numbers that are only used internally but need to be free
我想通过我的python脚本传递值NUMBER_CAMS,但我收到以下错误
Traceback (most recent call last):
File "/home/vasudev/PycharmProjects/Test_Framework/Stream_provider.py", line 19, in <module>
NUMBER_CAMS=sys.argv[2]
IndexError: list index out of range
为什么我的索引超出范围错误
的任何建议