Ikabot-Collective / ikabot

A Python-based bot designed for automating tasks in the game Ikariam
https://discord.com/invite/3hyxPRj
MIT License
102 stars 67 forks source link

loadCustomModule issue with latest Python version #269

Closed susikaman closed 2 months ago

susikaman commented 5 months ago

Bug explanation

I just switched OS from Windows Server 2019 with Python 3.11 into Ubuntu with Python 3.12 and the loadCustomModule function stopped working. After investigating the issue, I can confirm that the issue lies within the loadCustomModule function since the same loaded module works perfectly fine when used built-in. The problem seems to be with the read() function specifically, I guess something around this broke after switching from Python 3.11 to 3.12? So far I've used Python 3.10 and 3.11 without any issues, this is my first time running the loadCustomModule function with Python 3.12 and everything else seems to work perfectly fine, including read() with all the built-in functions.

Operating System

Ubuntu 24.04

Ikabot installation

I downloaded the pre-built Windows binary

Ikabot version

7.0.3

Python version

Python 3.12.3

BigMax23 commented 3 months ago

@susikaman How did you manage to resolve the issue? I received the same error message.

Operating system: Debian (Raspberry PI). Ikabot version 7.0.5

ikagod commented 3 months ago

Comment out this line in your custom module and let me know if it fixes the issue sys.stdin = os.fdopen(stdin_fd)

BigMax23 commented 2 months ago

Thank you @ikagod! Worked!