ExternalService.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:kudubot 作者: namboy94 项目源码 文件源码
def download_executable(self):
        """
        Downloads the executable file

        :return: None
        """
        # noinspection PyBroadException
        try:
            self.logger.info("Downloading executable file")
            with open(self.executable_file, 'wb') as destination:
                data = requests.get(self.define_executable_file_url()).content
                destination.write(data)
            self.logger.info("Download Complete")

            # Set executable permissions
            st = os.stat(self.executable_file)
            os.chmod(self.executable_file, st.st_mode | stat.S_IEXEC)

        except Exception as e:
            self.logger.error(
                "Could not download executable. Disabling Service.")
            self.logger.debug("Cause of download failure: " + str(e))
            if os.path.isfile(self.executable_file):
                os.remove(self.executable_file)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号