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 8664035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:08:34+00:00 2026-06-12T17:08:34+00:00

I have a command-line python script that uses a configuration file. I’m planning to

  • 0

I have a command-line python script that uses a configuration file. I’m planning to put this on pypi soon.

What is the best general approach for including a default version of the configuration file in the package, so that it is obvious to the end-user where to find it?

One example of a pypi project which includes user-editable config files is Django. In Django, the user has to run a script to initialize a new project. This generates a directory with a bunch of stuff, including the project configuration file. However, this seems like a heavy approach for a simple command line utility like mine.

Another option is requiring the user to specify the location of the config file as a command line arg. I guess this is okay, but it puts the onus on the user to go to the documentation and create the entire config file from scratch.

Is there any better option? Is there any standard practice for this?

Thanks!

-Travis

  • 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-12T17:08:36+00:00Added an answer on June 12, 2026 at 5:08 pm

    You could include the defaults as part of your script and then allow the user to change the defaults with either command line arguments or a config file in the user’s home directory.

    I don’t think the Django approach would work unless you have the concept of a project.

    If this is on Unix I would either put the config file in /etc if the script will be run by more than one user or in the user’s home folder as a dotfile. This way the user does not have to specify the config file each time, though you could also have a command line argument that lets the user specify a different config file to use.

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

Sidebar

Related Questions

I have a command line script that uses the Django ORM and MySQL backend.
I have a script in python that can be invoked from the command-line and
I have a python script start.py that executes well from the command line. There
I have a Python command line script that connects to a database, generates files
I have a python script that i want to run from the command line
I have a python script that, once executed from command line, performs the needed
I have a long-running Python script that I run from the command-line. The script
I have a program that is run from the command line like this python
I have a Python3 script that can take optional command line parameters which the
My Python script (for todo lists) is started from the command line like this:

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.