Python Forum
portable way to get current directory
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
portable way to get current directory
#2
Yes, I use it all the time
from pathlib import Path
current_directory = Path(__file__).parent
Reply


Messages In This Thread
portable way to get current directory - by Skaperen - Jun-12-2019, 02:18 AM
RE: portable way to get current directory - by SheeppOSU - Jun-12-2019, 02:46 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Get Current Directory From ShortCut. Oshadha 1 1,038 Jul-30-2022, 04:41 PM
Last Post: snippsat
  Setup Portable Python on Windows for script starts with double clicks? pstein 0 1,892 Feb-18-2022, 01:29 PM
Last Post: pstein
  Portable installation of Python possible? pstein 2 3,185 Nov-15-2020, 12:14 PM
Last Post: snippsat
  where to get portable Python for Linux (Fedora)? python001 5 6,511 Nov-01-2020, 05:23 PM
Last Post: Larz60+
  current directory issue saisankalpj 1 2,471 Nov-12-2018, 12:06 PM
Last Post: buran
  CWD (Current working directory) pcsailor 5 4,826 Nov-11-2018, 10:14 AM
Last Post: Larz60+
  SQlite database portable? PythonWriter 1 2,583 Aug-11-2018, 02:39 PM
Last Post: Larz60+
  Compile python project to single portable .exe file Campbell 5 10,828 Dec-05-2017, 01:20 PM
Last Post: buran
  Importing module from outside of the current directory Annie 4 4,702 Mar-21-2017, 11:13 PM
Last Post: Annie

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020