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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:25:03+00:00 2026-05-15T18:25:03+00:00

under Linux I put my configs in ~/.programname. Where should I place it in

  • 0

under Linux I put my configs in “~/.programname”. Where should I place it in windows?
What would be the recommendated way of opening the config file OS independent in python?

Thanks!
Nathan

  • 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-05-15T18:25:04+00:00Added an answer on May 15, 2026 at 6:25 pm

    Try:

    os.path.expanduser('~/.programname')
    

    On linux this will return:

    >>> import os
    >>> os.path.expanduser('~/.programname')
    '/home/user/.programname'
    

    On windows this will return:

    >>> import os
    >>> os.path.expanduser('~/.programname')
    'C:\\Documents and Settings\\user/.programname'
    

    Which is a little ugly, so you’ll probably want to do this:

    >>> import os
    >>> os.path.join(os.path.expanduser('~'), '.programname')
    'C:\\Documents and Settings\\user\\.programname'
    

    EDIT: For what it’s worth, the following apps on my Windows machine create their config folders in my Documents and Settings\user folder:

    • Android
    • AgroUML
    • Gimp
    • IPython

    EDIT 2: Oh wow, I just noticed I put /user/.programname instead of /home/user/.programname for the linux example. Fixed.

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

Sidebar

Related Questions

Under Linux what would be the best way for a program to restart itself
With VMWare Server running under Linux (Debain), I would like to have the following
Is there any way under linux/terminal to count, how many times the char f
I am compiling under Linux (GCC 4.4.2) and Windows VS C++ Express Edition 2008
I don't understand how GCC works under Linux. In a source file, when I
I need to read a single file using multiple threads under Linux. There are
Under linux, you can rename a file with overwrite. For example, rename -f file_a
Under Linux, my C++ application is using fork() and execv() to launch multiple instances
Under Linux, how do I find out which process is using the swap space
So I'm running PPP under linux with a cellular modem. The program I'm writing

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.