Ask coding questions

← Back to all posts
I am getting this error when I run my game, and searching has yielded no results.
AIDANAINSLEY (2)

The error is:
Traceback (most recent call last):
File "main.py", line 11, in <module>
from getch import getch
ImportError: /opt/virtualenvs/python3/lib/python3.8/site-packages/getch.cpython-38-x86_64-linux-gnu.so: undefined symbol: Py_InitModule

I have tried for hours to find what is wrong, but I couldn't find anything.

Answered by InvisibleOne (3215) [earned 5 cycles]
View Answer
Comments
hotnewtop
InvisibleOne (3215)

This is a known problem, and there are a few things you can try to do to fix it.
First, delete the two packager files and then use the shell to install getch with the command pip install getch and then run the file again. If it still isn't working then there's a .replit file you can add which should make it work, I'll track it down and find it.

InvisibleOne (3215)

You can make a file called .replit and put this in it:

run="poetry install && clear && python3 -m poetry run python3 main.py"

But I'm not sure if that still works.

AIDANAINSLEY (2)

@InvisibleOne THANKS SOO MUCH!! The first part you suggested works.

InvisibleOne (3215)

good, that's better then having to do the second part, which makes the repl run soooo slow @AIDANAINSLEY