Toma400 / Librerian

Universal library manager for all types of art
Other
3 stars 1 forks source link

No possibility to enter menu #8

Closed Toma400 closed 2 years ago

Toma400 commented 2 years ago

When using PyCharm, this does not happen. It does, though, when you are using regular build.

In short, program stops and spits out the message with issue as seen in this log: 2022_7_27_15_51_20_log.log

I assume this may be caused by path not being recognised correctly for this specific process (it is set on PyCharm, but not in executable file). Especially path printed in initial message of the log is suspicious and this is why I have such thought of a culprit being path.

Toma400 commented 2 years ago

Tried to switch code used to importlib + make it not crash, swapped code for that:

def menu_layout():
    modules = file_lister(f"entries/", ext="py")
    for x in modules: #| imports all modules from /entries/ folder
        x1 = x.replace("\\", "."); x2 = x1.replace("\\", "."); log.debug(f"Module is being imported: [{x2}]")
        #try: __import__(x2); log.debug(f"Module {x2} loaded successfully!")
        try: importlib.import_module(x2); log.debug(f"Module {x2} loaded successfully!")
        except ModuleNotFoundError:
            log.debug(f"Module {x2} failed to load regularly. Taking absolute path...")
            try: importlib.import_module(f"{spath}/{x2}"); log.debug(f"Module {x2} loaded successfully from absolute path: [{spath}/{x2}]")
            except ModuleNotFoundError: log.debug(f"Module {x2} failed to load. Printing the stacktrace...", exc_info=True)

But it resulted in similar stacktrace, not showing entries. Again, it works for IDE, not for executable build. One of possible culprits can be what is put here. Take a look at it later.

Example log from current (not commited) build: 2022_7_28_6_39_25_log.log

Toma400 commented 2 years ago

Fixed with 5f92a7c