Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor suggests invalid code #268

Open
ReenigneArcher opened this issue Dec 23, 2023 · 0 comments
Open

refactor suggests invalid code #268

ReenigneArcher opened this issue Dec 23, 2023 · 0 comments

Comments

@ReenigneArcher
Copy link

This tool suggests refactoring my code as shown here.

INFO: ./service.themerr/service.py

--- ./service.themerr/service.py	(original)
+++ ./service.themerr/service.py	(refactored)
@@ -7,9 +7,9 @@
 import xbmcvfs
 
 # lib imports
-from themerr import constants
-from themerr.logger import Logger
-from themerr.settings import Settings
+from .themerr import constants
+from .themerr.logger import Logger
+from .themerr.settings import Settings
 
 settings = Settings()
 log = Logger()

But this suggestion is invalid. When the __name__ is __main__ you cannot do a relative import... and it seems that this is how Kodi runs the addon. https://stackoverflow.com/a/66895066/11214013

The relative imports work if you import the file into an existing python instance, but not when you run python ./service.py.

Is there anyway to skip the refactoring? It also causes a second problem if my dependencies are installed to the addon directory (./resources/lib)... there will thousands of warnings. Excluding specific directories would be beneficial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant