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
This commit is contained in:
caryoscelus 2023-07-02 03:35:34 +00:00
parent ddde202879
commit 62d1c9d27a
2 changed files with 7 additions and 3 deletions

View file

@ -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

View file

@ -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__':