Is anyone else having trouble with segfaults when using Mojo’s input function? I’m on apple silicon.
Please explain in detail on how to reproduce the issue. If possible, please share a snippet of your code)
Hi there, many thanks for the quick responseI have an input function:
fn get_input(self) raises -> String:
while True:
var input_str = str(Python.evaluate("input()"))
input_str = input_str.lower()
if input_str == "exit":
print("exiting the game, hamba kahle")
exit(0)
elif input_str == "rules":
print_rules()
print("enter your move:")
else:
return input_str
I have just changed it to a the mojo input function and it now seems to be working correctly.
var input_str = input("make a choice: ")
Sorry about that. Do you know if someone has made any fixes to it?
Regarding the python function? Well, it does get runtimed, and not all io features are supported just yet afaik
Yes I have tried it in a few exercises and I always got this “malloc: *** error for object 0x10d124008: pointer being realloc’d was not allocated” error but now I can’t recreate it.
Well, mojo will change it’s memory allocation logic, maybe get a bit more parsable soon, we’ll wait and recreate
Many thanks for your input. If I get any problems I will let you know what error/s have occurred