A script at /foo/bar.py
tries to run a second script /main.py
using the subprocess
module. Although main.py
runs fine with python main.py
in the Windows command prompt, running bar.py
which calls main.py
causes an error
ConfigParser.NoSectionError: No section: 'user'
Why is there now a problem with the path to settings.ini
, and how can we fix it?
~/settings.ini
[user]
id: helloworld
~/foo/bar.py
subprocess.Popen([sys.executable, "../main.py"])
~/main.py
Config = ConfigParser.ConfigParser()
Config.read("settings.ini")
userId = Config.get('user', 'id')
Aucun commentaire:
Enregistrer un commentaire