无法在Google App Engine中为python应用程序创建配置文件
我尝试创建一个配置文件,在那里我可以存储常量 每当我尝试使用ConfigParser时,都会出现一个错误无法在Google App Engine中为python应用程序创建配置文件,python,google-app-engine,configuration,configuration-files,configparser,Python,Google App Engine,Configuration,Configuration Files,Configparser,我尝试创建一个配置文件,在那里我可以存储常量 每当我尝试使用ConfigParser时,都会出现一个错误 Traceback (most recent call last): File "/home/baun/google_appengine/google/appengine/ext/webapp /__init__.py", line 511, in __call__ handler.get(*groups) File "/home/baun/workspace/
Traceback (most recent call last):
File "/home/baun/google_appengine/google/appengine/ext/webapp /__init__.py", line 511, in __call__
handler.get(*groups)
File "/home/baun/workspace/octopuscloud/s3/S3.py", line 138, in get
test = parser.get('bucket', 'bucketname')
File "/usr/lib/python2.5/ConfigParser.py", line 511, in get
raise NoSectionError(section)
NoSectionError: No section: 'bucket'
simple.cfg:
[bucket]
bucketname: 'octopus_storage'
s3.py:
...
from ConfigParser import SafeConfigParser
parser = SafeConfigParser()
parser.read('simple.cfg')
...
# Get values from the config file
test = parser.get('bucket', 'bucketname')
...
我怎样才能解决这个问题
===============================
问题已经解决了。代码是正确的,但simple.cfg位于错误的目录中 非常感谢。问题已经解决了。代码和配置文件是正确的。配置文件位于错误的目录中。
[bucket]
bucketname= octopus_storage