Yaroslav Grebnov
    • Wiki
    • Blog

    Introduction

    • About this Wiki

    Bash Scripts

    • Bash basics
    • Using variables
    • Executing scripts
    • Parametrized scripts
    • Logging scripts execution
    • Using grep in scripts
    • Using sed in scripts
    • Using awk in scripts
    • Using find in scripts
    • Using git in scripts
    • Using sqlplus in scripts
    • Working With PostgreSQL
    • Networking

    Docker

    • Installation
    • Containers
    • Images
    • docker-compose
    • gradle-docker-compose-plugin

    Go

    • Go concepts
    • Using structs in Go
    • Using text/templates in Go
    • Types in Go
    • Regular expressions in Go
    • Maps in Go
    • Working with SQLite in Go
    • Working with file system in Go
    • Configuring Go application
    • Resolving of common errors

    Python

    • Dockerizing Python application
    • Django
    • Filesystem
    • Configuration

    Java

    • Spring Boot
    • REST Assured
    • Patterns
    • Streams

    Scala

    • Pattern matching
    • Lists
    • Build using sbt
    • scopt

    Groovy

    • Spock
    • Geb

    JavaScript

    • AngularJS
    • Postman

    C

    • Macros
    • Make/CMake

    Linux/Unix

    • ssh
    • dnf
    • Fedora
    • Ubuntu
    • AIX

    Test Management

    • Reporting
    • Jenkins

    General Development

    • Using git
    • Using WSL
    • Using PostgreSQL
    • Using PowerShell
    • Using SQLite

    network

    • IP protocol types
    • Ports and protocols
    • nmap
    • tcp
    • udp
    • ping
    • traceroute
    • ipconfig
    • ifconfig
    • ip
    • nslookup
    • dig
    • hostname
    • arp
    • route
    • nbtstat
    • netstat
    • telnet
    • tcpdump

    On this page

    • Get current file directory

    Filesystem

    Get current file directory#

    A complex command composed of two: os.path.dirname and os.path.abspath:

    import os
    os.path.dirname(os.path.abspath(__file__))
    

    The command can be useful, for example, for fetching configuration from files in pre-defined locations.

    ← Django
    Configuration →
    • Yaroslav Grebnov, 2017-2022