On Thu, Aug 4, 2011 at 6:27 AM, Benjamin Sims <benjamins...@gmail.com> 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 <sluggos...@gmail.com>

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

Reply via email to