Python Forum

Full Version: for what is this used for? APP_NAME, APPDIRS, LOGFILE , VENDOR_CACHE
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm learning through one's code and I can not find a specific answer to my question(s). (I have an intermediate python's level)

Code: https://github.com/sumpfgottheit/lanscan...lanscan.py

[Line 52 - 55] For what is APP_NAME, APPDIRS, LOGFILE, VENDOR_CACHE used for? why is he using that?

APP_NAME = 'lanscan'
APPDIRS = AppDirs(APP_NAME)
LOGFILE = os.path.join(APPDIRS.user_log_dir, 'lanscan.log')
VENDOR_CACHE = os.path.join(APPDIRS.user_cache_dir, 'vendors')
In line 63 he made a function called initialize_directories() using some of the variables but I don't get it.

def initialize_directories():
    if not isdir(APPDIRS.user_cache_dir):
        os.makedirs(APPDIRS.user_cache_dir, mode=0o755, exist_ok=True)
    if not isdir(APPDIRS.user_log_dir):
        os.makedirs(APPDIRS.user_log_dir, mode=0o755, exist_ok=True)
I appreciate your help Smile