From 62d1c9d27a2f63b02c8acc71aea10a9e639432f2 Mon Sep 17 00:00:00 2001 From: caryoscelus Date: Sun, 2 Jul 2023 03:35:34 +0000 Subject: [PATCH] improve zeronet.py: don't reimport config and fix name clash previously due to zeronet.py and most of the source files living in different import 'namespaces', Config module was imported twice. this if fixed by editing sys.modules --- CHANGELOG.md | 1 + zeronet.py | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32e431fb..ce2cb131 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ maintainers: @caryoscelus - better debugging of update non-propagation - sec update of msgpck dependency (@chncaption) - deprecate python-3.6 as it apparently is no longer used (by active users) +- improvement in imports and naming (@caryoscelus) ### zeronet-conservancy 0.7.8.1 (2022-11-28) (0054eca9df0c9c8c2f4a78) maintainers: @caryoscelus diff --git a/zeronet.py b/zeronet.py index 1106c925..6f0e63b9 100755 --- a/zeronet.py +++ b/zeronet.py @@ -3,7 +3,11 @@ import os import sys from src.Config import config -def main(): +# fix further imports from src dir +sys.modules['Config'] = sys.modules['src.Config'] + +def launch(): + '''renamed from main to avoid clashes with main module''' if sys.version_info.major < 3: print("Error: Python 3.x is required") sys.exit(0) @@ -12,7 +16,6 @@ def main(): from greet import fancy_greet fancy_greet(config.version) - main = None try: import main main.start() @@ -131,7 +134,7 @@ def start(): import update update.update() else: - main() + launch() if __name__ == '__main__':