mtga_log.py is very useful for my MTG Arena projects, but when you try to import it as a module (from mtga_utils import mtga_log with mtga_utils in a subfolder) it throws an error:
Traceback (most recent call last):
File "c:/Users/billy/code/mtga_decklist_viewer/mtga_decklist_viewer.pyw", line 11, in <module>
from mtga_utils import mtga_log
File "c:\Users\billy\code\mtga_decklist_viewer\mtga_utils\mtga_log.py", line 6, in <module>
import scryfall
ModuleNotFoundError: No module named 'scryfall'
This is due to how Python handles relative imports—it's looking for the scryfall module in the base folder instead of the mtga_utils folder.
This solution should work fine. Unfortunately, the repo name mtga-utils is not a valid package name, so I couldn't simply change the import code to from mtga-utils import scryfall.
mtga_log.py is very useful for my MTG Arena projects, but when you try to import it as a module (
from mtga_utils import mtga_log
withmtga_utils
in a subfolder) it throws an error:This is due to how Python handles relative imports—it's looking for the
scryfall
module in the base folder instead of the mtga_utils folder.This solution should work fine. Unfortunately, the repo name
mtga-utils
is not a valid package name, so I couldn't simply change the import code tofrom mtga-utils import scryfall
.