Hi, thanks for the reply - sorry just picking this up again. Traceback
follows at the end of this mail.

The scan call is in the main function of __init__.py, yes.

However, I do have a separate script as part of the package which reads in
the application config (in order to maintain only one config file). I have
confirmed that deleting that script solves the problem.

I'm happy to move those scripts elsewhere unless there is a better way of
resolving this?

Ben


Traceback (most recent call last):
  File "../../bin/paster", line 8, in <module>
    load_entry_point('PasteScript==1.7.4.2', 'console_scripts', 'paster')()
 File
"/Users/benjamin/myvirtualenv/lib/python2.7/site-packages/PasteScript-1.7.4.2-py2.7.egg/paste/script/command.py",
line 104, in run
    invoke(command, command_name, options, args[1:])
  File
"/Users/benjamin/myvirtualenv/lib/python2.7/site-packages/PasteScript-1.7.4.2-py2.7.egg/paste/script/command.py",
line 143, in invoke
    exit_code = runner.run(args)
  File
"/Users/benjamin/myvirtualenv/lib/python2.7/site-packages/PasteScript-1.7.4.2-py2.7.egg/paste/script/command.py",
line 238, in run
    result = self.command()
  File
"/Users/benjamin/myvirtualenv/lib/python2.7/site-packages/PasteScript-1.7.4.2-py2.7.egg/paste/script/serve.py",
line 284, in command
    relative_to=base, global_conf=vars)
  File
"/Users/benjamin/myvirtualenv/lib/python2.7/site-packages/PasteScript-1.7.4.2-py2.7.egg/paste/script/serve.py",
line 321, in loadapp
    **kw)
  File
"/Users/benjamin/myvirtualenv/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py",
line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File
"/Users/benjamin/myvirtualenv/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py",
line 272, in loadobj
    return context.create()
  File
"/Users/benjamin/myvirtualenv/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py",
line 710, in create
    return self.object_type.invoke(self)
  File
"/Users/benjamin/myvirtualenv/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py",
line 203, in invoke
    app = context.app_context.create()
  File
"/Users/benjamin/myvirtualenv/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py",
line 710, in create
    return self.object_type.invoke(self)
  File
"/Users/benjamin/myvirtualenv/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py",
line 146, in invoke
    return fix_call(context.object, context.global_conf,
**context.local_conf)
  File
"/Users/benjamin/myvirtualenv/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/util.py",
line 56, in fix_call
    val = callable(*args, **kw)
  File "/Users/benjamin/myvirtualenv/RD3/rd3/__init__.py", line 48, in main
    config.scan()
  File
"/Users/benjamin/myvirtualenv/lib/python2.7/site-packages/pyramid-1.2a1-py2.7.egg/pyramid/config/__init__.py",
line 753, in scan
    scanner.scan(package, categories=categories)
  File
"/Users/benjamin/myvirtualenv/lib/python2.7/site-packages/venusian-0.9-py2.7.egg/venusian/__init__.py",
line 82, in scan
    __import__(modname)
  File "/Users/benjamin/myvirtualenv/RD3/rd3/scraper.py", line 26, in
<module>
    logging.config.fileConfig(args[0])
  File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py",
line 70, in fileConfig
    formatters = _create_formatters(cp)
  File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/config.py",
line 106, in _create_formatters
    flist = cp.get("formatters", "keys")
  File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ConfigParser.py",
line 567, in get
    raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'formatters'


On 4 August 2011 18:42, Mike Orr <[email protected]> wrote:

> On Thu, Aug 4, 2011 at 6:27 AM, Benjamin Sims <[email protected]>
> wrote:
> > Hi,
> > I am switching my application from imperative to declarative
> configuration
> > using view_config.
> > However, when I add config.scan() to __init.py__, my application refuses
> to
> > start. If I do:
> > 'paster serve config.ini ', I get a message saying 'no such option
> > --reload'.
> > If I just do 'paster serve config.ini' the error is:
> > ConifgParser.NoSectionError.
> > Removing config.scan() once again allows the application to run normally.
> Am
> > I missing other steps or options?
>
> That sounds really strange. What is the traceback? It must be
> happening after Paste has read the config file and is loading the
> application and running the main function, because that's the point
> where scan would be called. Do you have the scan call inside the main
> function and not at module level? Having it at module level could well
> do something weird; if something it expects to have happened hasn't
> yet.
>
> The second question is, is something in the application trying to
> parse the config file again? (That is, something called by main, or in
> any of your application modules at module level. You might do this to
> read a custom section for an application-specific purpose.) It sounds
> like it's reading the wrong file or is trying to read a nonexistent
> file. ConfigParser does have a misfeature where if you try to read a
> file that doesn't exist, it succeeds as if it were an empty file. That
> would then lead to a missing section error or missing option error.
> There's a third-party version of ConfigParser that fixes that, but I'm
> not sure if Paste's version (paste.deploy.something.NicerConfigParser)
> does.
>
> --
> Mike Orr <[email protected]>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to