def export_user(self, p_format): try: print("Exporting User") from users.resources import UserResource aresource = UserResource() dataset = aresource.export() tablename = 'User' if p_format == "json": self.save_to_file(a_filename=tablename+'.json', a_content=dataset.json) elif p_format == "csv": self.save_to_file(a_filename=tablename+'.csv', a_content=dataset.csv) except Exception: raise CommandError("User table could not be exported!")