intercreate / smpmgr

Simple Management Protocol (SMP) Manager for remotely managing MCU firmware
Apache License 2.0
10 stars 3 forks source link

Logging module recursive dependency #18

Closed vChavezB closed 5 months ago

vChavezB commented 5 months ago

I am trying to run smpmgr in development mode as per the instructions (i.e. Poetry and pipx).

When I try to run the main application /smpmgr/__main__.py I get the error

cannot import name 'Handler' from partially initialized module 'logging'

If I change the file name of /smpmgr/logging.py to something else, and change the related import in /smpmgr/main.py then it works.

E.g. change /smpmgr/logging.py to /smpmgr/logging_smp.py and in /smpmgr/main.py

import as from smpmgr.logging_smp import LogLevel, setup_logging

Am I missing something on how I need to run /smpmgr/__main__.py ?

OS: Windows 10

Commands

git clone https://github.com/intercreate/smpmgr
cd smpmgr
poetry install
.\envr.ps1
python /smpmgr/__main__.py --version
JPHutchins commented 5 months ago

Hello! I think it’s a good idea to resolve this, but in the meantime do you have luck running it as any of:

smpmgr python -m smpmgr python -m smpmgr.main ‘python -m smpmgr.main

LMK if running as a module works for you, thanks!

JPHutchins commented 5 months ago

Also there may be an error in your environment. Envr.ps1 must be sourced, not run, eg “. ./envr.ps1” not “./envr.ps1”.

vChavezB commented 5 months ago

If I run smpmgr it works the latter options do not. Thanks!

JPHutchins commented 5 months ago

If I run smpmgr it works the latter options do not. Thanks!

Importantly, the update that needs to be made to the docs is that when running the local development version, --version should return "0". If it returns a real version, then it probably means that smpmgr is running some pip or pipx installed version.

here's what I see:

. ./envr.ps1
# shell prompt is now prefixed with (smpmgr)
smpmgr --version
0
python -m smpmgr --version
0
python -m smpmgr.main --version # this won't work because main is not a script
python -m smpmgr.__main__ --version
0

LMK what's going on with running the modules like python -m ...

vChavezB commented 5 months ago

yes all of those commands worked and have the same output as per your comment