脚本执行报错问题求助

来源:31-12 品牌和品牌分类接口 (proto同步脚本)

尼克2018

2022-01-19

    def generate(self):
        with cd(self.python_dir):
            files = proto_file_list(self.python_dir)
            print("files:",files)
            subprocess.call("workon mxshop_srv", shell=True)
            for file in files:
                command = f"python -m grpc_tools.protoc --python_out=. --grpc_python_out=. -I. {file}"
                subprocess.call(command)

修改我自己的python和go的路径后,执行脚本报错:
/bin/sh: workon: command not found

    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'python -m grpc_tools.protoc --python_out=. --grpc_python_out=. -I. goods.proto'

写回答

1回答

尼克2018

提问者

2022-01-19

():
    cd(.python_dir):
        files = proto_file_list(.python_dir)
        file files:
            command = filesubprocess.call(command, shell=True)

        py_files = generated_pyfile_list(.python_dir)
        file_name py_files:
            replace_file(file_name)
        (py_files)

    cd(.go_dir):
        files = proto_file_list(.go_dir)
        file files:
            command = filesubprocess.call(command, shell=True)
1.修改老师的代码:subprocess.call(command, shell=True)
2.分别在两个cd方法里调整。


0
2
bobby
回复
尼克2018
赞一个
2022-01-20
共2条回复

Go+Python打造电商系统 自研微服务框架 抓紧高薪机遇

快速转型Go工程师,成为具备双语言后端能力的开发者

515 学习 · 533 问题

查看课程