Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9251963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:49:48+00:00 2026-06-18T10:49:48+00:00

I am looking for a way to use the ExtendedInterpolation functionality found in the

  • 0

I am looking for a way to use the ExtendedInterpolation functionality found in the configparser lib when loading in a ini file to Logging.config.FileConfig.

http://docs.python.org/3/library/configparser#configparser.ExtendedInterpolation

So if I have a ini file that looks like this:

[logSettings]
eventlogs=application
logfilepath=C:\Programs\dk_test\results\dklog_009.log
levelvalue=10

[formatters]
keys=dkeventFmt,dklogFmt

[handlers]
keys=dklogHandler

[handler_dklogHandler]
class=FileHandler
level=${logSettings:levelvalue}
formatter=dklogFmt
args=(${logSettings:logfilepath}, 'w')

[logger_dklog]
level=${logSettings:levelvalue}
handlers=dklogHandler

As you can see I am following the extended interpolation syntax by using the ${…} notation to reference a value in a different section. When calling the file like so logging.config.fileConfig(filepath), the eval’ing within the module always fails. In paticular on the eval’ing of the args option in the [handler_dklogHandler] section.

Is there a way to get around this? Thanks!

Note: Using Python 3.2

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:49:49+00:00Added an answer on June 18, 2026 at 10:49 am

    Decided to use force the interpolation over the file and save the result to another temp file. I use the temp file for the logconfig.

    The function looks like this:

    tmpConfigDict           = {}
    tmpConfig               = ConfigParser(allow_no_value = True,
                                interpolation = ExtendedInterpolation())
    for path in configPaths:
        tmpConfig.read(path)
    
    #Iterate over options and use "get()" to execute the Interpolation
    for sec in tmpConfig.sections():
        tmpConfigDict[sec] = {}
        for opt, _ in tmpConfig[sec].items():
            tmpConfigDict[sec][opt] = cleanValue(tmpConfig.get(sec, opt))
    
    #Finished getting values. Write the dict to the configparser
    tmpConfig.read_dict(tmpConfigDict)
    
    #Open the file handle and close it when done
    with open(pathToTmpFile, 'w') as fp:
        tmpConfig.write(fp, space_around_delimiters = False)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was looking for a way to use GIFs within XNA when I found
I'm looking for a way to use hyperlinks in a winforms environment. I found
I'm looking for a way to use jQuery/js to show a 'Loading...' message while
I'm looking for a way to use OpenCL nicely in Haskell, and found these
My problem is that I was looking for way to use both storyboard and
I'm looking for a way to use your location to determine whether you need
I am looking for a way to use a UILabel (or something similar) to
I am looking for a way to use a WCF WebServiceHost without having to
I'm looking for a way to use some variant of vsnprintf() with a buffer
I'm looking for a way to use CSS to style everything between the first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.