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

  • SEARCH
  • Home
  • 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 7995703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:30:00+00:00 2026-06-04T14:30:00+00:00

I do have the module config.py which has vars in it that indicates configuration

  • 0

I do have the module config.py which has vars in it that indicates configuration data.

For example:

logfile_enable = True
logfile_name = "debug.log"
logfile_maxsize = 100*1024 # 100KB
logfile_backupCount = 1

Then I can just import config in every project script, and access data through config.VAR (config.maxsize for example).

I do want to save the changes to the module once the application is closed.
I thought about pickling the __dict__ of the module and somehow set it back on startup, but I seem to fail doing it, as you can’t call __dict__ from the module itself.

I don’t want to use a class and a dict in it. I think that the config.VAR syntax is much clearer in the script, and I don’t want to initialize a new class object in every import.

What can I do?

  • 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-04T14:30:01+00:00Added an answer on June 4, 2026 at 2:30 pm

    I’ve used the standard library ConfigParser module for this purpose, and then had a global config object, so in all your files you say from config import config where config is an instantiated ConfigParser object which you can read stuff from load from a file and save to a file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a config.cfg which I parse using the python-module ConfigParser. In one section
I have to write a SNMP module which monitor a certain server application that
I have a rails engine code. But Rails::Engine don't have config.session_store variable. module Admin
I have module application. When I run it, the main window of that app
I have module that implements custom content type via NodeAPI hooks ( hook_insert ,
I have a module that returns an array: module Module1 class Class1 def self.get
I have a module that is specifically Python 3. What's the best way to
I have a remote server like below which already has an initialized class and
I have a module, that is just a list of items. Relating to content.
I have an MVC site which has routes which I need to redirect with

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.