【发布时间】:2017-03-16 17:16:40
【问题描述】:
我有一个带有点击装饰器的功能。该函数的全部目的是为 tq_oex_interchange 类所做的工作添加一个 CLI 选项。
@click.command()
@click.option('-input_file', help='The input file to process')
@click.option('-output_file', help='The output file to create')
@click.option('-part_num_col', help='The column containing the part numbers')
@click.option('-summate_cols', help='The columns to summate')
def run(input_file, output_file, part_num_col, summate_cols):
from re import split
summate_cols = [int(i) for i in split(',', summate_cols)]
part_num_col = int(part_num_col)
teek = tq_oex_interchange()
click.echo("Working...")
teek.scan_file(input_file, output_file, part_num_col, summate_cols)
但是,当我使用命令执行我的脚本时
python tq_oex.py -input_file C:\Users\barnej78\Desktop\test_0.csv -output_file C:\Users\barnej78\Desktop\cmd.csv -part_num_col 3 -summate_cols 5,6
什么都没有发生,甚至点击回声都没有执行。
另外,
python tq_oex.py --help
也不做任何事情。
这些命令都没有错误或异常输出。
我做错了什么?
【问题讨论】:
-
这是整个脚本吗?
标签: python python-3.x python-click