Saya mengalami kesalahan OUTPUT: Traceback (most recent call last): File…
- User
Saya mengalami kesalahan OUTPUT: Traceback (most recent call last): File /root/feds/feedback/plugins/eval.py , line 40, in evaluation_cmd_t await aexec(prefix, client, message) File /root/feds/feedback/plugins/eval.py , line 71, in aexec return await locals()"__aexec" File , line 2, in aexec Dengan kode tersebut @user.on_message(filters.command("e", prefix) & filters.me) async def evaluation_cmd_t(client: Client, message: Message): user_id = message.from_user.id status_message = await message.edit("Processing eval pyrogram...") try: prefix = message.text.split(" ", maxsplit=1)[1] except IndexError: return await status_message.edit("No evaluate message!") exc = None with io.StringIO() as redirected_output, io.StringIO() as redirected_error: old_stderr, old_stdout = sys.stderr, sys.stdout try: sys.stdout, sys.stderr = redirected_output, redirected_error await aexec(prefix, client, message) except Exception: exc = traceback.format_exc() finally: sys.stdout, sys.stderr = old_stdout, old_stderr stdout = redirected_output.getvalue() stderr = redirected_error.getvalue() evaluation = exc if exc else (stderr if stderr else (stdout if stdout else Success )) final_output = f"OUTPUT:\n{evaluation.strip()}" if len(final_output) > 4096: with open("eval.txt", w+ , encoding="utf8") as out_file: out_file.write(final_output) await status_message.reply_document( document="eval.txt", caption=prefix[: 4096 // 4 - 1], disable_notification=True, ) os.remove("eval.txt") await status_message.delete() else: await status_message.edit_text(final_output) async def aexec(code, client, message): exec( async def aexec(client, message): + .join(f"\n {l}" for l in code.split("\n")) ) return await locals()["__aexec"](client, message) async def shell_exec(code, treat=True): process = await asyncio.create_subprocess_shell( code, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.STDOUT ) stdout = (await process.communicate())[0] if treat: stdout = stdout.decode().strip() return stdout, process
- Assistant