9
私はConfigParser.NoSectionErrorを取得しています:いいえセクション:上記のコードを使用している 'TestInformation'エラー。Python:ConfigParser.NoSectionError:いいえセクション: 'TestInformation'
def LoadTestInformation(self):
config = ConfigParser.ConfigParser()
print(os.path.join(os.getcwd(),'App.cfg'))
with open(os.path.join(os.getcwd(),'App.cfg'),'r') as configfile:
config.read(configfile)
return config.items('TestInformation')
ファイルパスは正しいですか、私は二重チェックしました。 configファイルには、Test.cfgファイルのTestInformationセクション
[TestInformation]
IEPath = 'C:\Program Files\Internet Explorer\iexplore.exe'
URL = 'www.google.com.au'
'''date format should be '<Day> <Full Month> <Full Year>'
SystemDate = '30 April 2013'
があります。私が間違っていることがわからない
'app.cfg'または' App.cfg'に代わりにファイルのフルパスをファイル開くステップを省略している場合は
read()
を使い続けることができますか? – RedBaronApp.cfg。 app.cfgだけを使うべきですか? – Loganswamy
あなたの質問の最後の行では、すべてを 'app.cfg'に入れましたが、あなたのコードでは' App.cfg'を開いています。私はタイプミスとしてそれを取るでしょう。 – RedBaron