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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:36:59+00:00 2026-06-17T19:36:59+00:00

os.path.curdir returns ‘.’ which is totally truthful and totally worthless. To get anything useful

  • 0

os.path.curdir returns ‘.’ which is totally truthful and totally worthless. To get anything useful from it, you have to wrap it with os.path.abspath(os.path.curdir)

Why include a useless variable in the os.path module? Why not have os.path.curdir be a function that does the os.path.abspath for you?

Is there some historic reason for os.path.curdir to exist?

Maybe useless is a bit harsh, but not very useful seems weak to describe this.
enter image description here

  • 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-17T19:37:00+00:00Added an answer on June 17, 2026 at 7:37 pm

    It is a constant, just like os.path.sep.

    Platforms other than POSIX and Windows could use a different value to denote the ‘current directory’. On Risc OS it’s @ for example, on the old Macintosh OS it’s :.

    The value is used throughout the standard library to remain platform agnostic.

    Use os.getcwd() instead; os.path.abspath() uses that function under the hood to turn os.path.curdir into the current working directory anyway. Here is the POSIX implementation of abspath():

    def abspath(path):
        """Return an absolute path."""
        if not isabs(path):
            if isinstance(path, _unicode):
                cwd = os.getcwdu()
            else:
                cwd = os.getcwd()
            path = join(cwd, path)
        return normpath(path)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code which is executed from the command line: import cgi,time,os,json,sys,zipfile,urllib2
import xlwt import xlrd import os.path import os print os.path.abspath(os.curdir) #Create workbook and worksheet
BRIEF: hg clone creates path default in /.hg/hgrc, set to where you cloned from.
Request.Path will get the current Path name with file name such as: C:/......./Personal/Items.aspx How
I have a path windows network shared drive like this . String url=//sample/data/Documents/network/test/; How
Consider the following example: import string,cgi,time from os import curdir, sep from BaseHTTPServer import
I have a piece of code which I'm using to search for the executables
The path that is returned from Directory.GetCurrentDirectory() contains non escaped '\' characters. How do
Hello! I have the following script: import os import stat curDir = os.getcwd() autorun_signature
I have a pretty simple python webserver that returns a few web pages, and

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.