我正在使用 redis 队列在后台运行视频分析代码。这是用于存储输出的文件夹的代码片段 -
parser = argparse.ArgumentParser(
description='Accept input video folder from user')
parser.add_argument('--project_name', '-p', type=str,
help='Name of the project/experiment', default="test")
parser.add_argument('--input_folder_path', '-i', type=str,
help='Path to the input folder', default="./input_videos")
parser.add_argument('--model_save_path', '-o', type=str,
help='Path to the folder for saving checkpoints', default="./checkpoints")
args = parser.parse_args()
project_name = args.project_name
input_folder_path = args.input_folder_path
model_save_path = args.model_save_path
我收到此错误 -
15:39:10 default: myproject.project.train_test.train_test(10) (e7d62c6f-82a7-4868-8163-98542773eef0)
usage: rq [-h] [--project_name PROJECT_NAME]
[--input_folder_path INPUT_FOLDER_PATH]
[--model_save_path MODEL_SAVE_PATH]
rq: error: unrecognized arguments: worker
15:39:14 Traceback (most recent call last):
File "/Users/rohankamath/Desktop/lol/env/lib/python3.7/site-packages/rq/worker.py", line 1008, in perform_job
rv = job.perform()
File "/Users/rohankamath/Desktop/lol/env/lib/python3.7/site-packages/rq/job.py", line 706, in perform
self._result = self._execute()
File "/Users/rohankamath/Desktop/lol/env/lib/python3.7/site-packages/rq/job.py", line 729, in _execute
result = self.func(*self.args, **self.kwargs)
File "./myproject/project/train_test.py", line 46, in train_test
args = parser.parse_args()
File "/Users/rohankamath/opt/anaconda3/lib/python3.7/argparse.py", line 1758, in parse_args
self.error(msg % ' '.join(argv))
File "/Users/rohankamath/opt/anaconda3/lib/python3.7/argparse.py", line 2508, in error
self.exit(2, _('%(prog)s: error: %(message)s\n') % args)
File "/Users/rohankamath/opt/anaconda3/lib/python3.7/argparse.py", line 2495, in exit
_sys.exit(status)
SystemExit: 2
我阅读了文档,但他们没有明确回答。谢谢你。