__init__.py 文件源码

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

项目:PyPlanet 作者: PyPlanet 项目源码 文件源码
def get_ghost_replay(self, login):
        replay_name = 'dedimania_{}.Replay.Gbx'.format(uuid.uuid4().hex)
        try:
            await self.instance.gbx('SaveBestGhostsReplay', login, replay_name)
        except:
            return None
        try:
            async with self.instance.storage.open('UserData/Replays/{}'.format(replay_name)) as ghost_file:
                return await ghost_file.read()
        except FileNotFoundError as e:
            message = '$f00Error: Dedimania requires you to have file access on the server. We can\'t fetch' \
                      'the driven replay!'
            logger.error('Please make sure we can access the dedicated files. Configure your storage driver correctly! '
                         '{}'.format(str(e)))
            await self.instance.chat(message)
            raise DedimaniaException('Can\'t access replay file')
        except PermissionError as e:
            message = '$f00Error: Dedimania requires you to have file access on the server. We can\'t fetch' \
                      'the driven replay because of an permission problem!'
            logger.error('We can\'t read files in the dedicated folder, your permissions don\'t allow us to read it! '
                         '{}'.format(str(e)))
            await self.instance.chat(message)
            raise DedimaniaException('Can\'t access files due to permission problems')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号