Kodi Community Forum

Full Version: writing python 2 and 3 code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

Im wondering if there is a way to write these lines somehow to be 2 and 3 compatible

        os.makedirs(drive + 'addons', exist_ok=True)     ####################### PYTHON 3 ########################


        if not os.path.exists(drive + addons):   ####################### PYTHON 2 ########################
            os.makedirs(drive + addons)          ####################### PYTHON 2 ########################
The second example should work fine on python2 and 3
thank you it worked