# Buggy code
def __init__(self, path):
    kwargs = {
        "path": path,
    }
    if on_win:
        message = dals("""
            The current user does not have write permissions to a required path.
              path: %(path)s
            """)
    else:
        message = dals("""
            The current user does not have write permissions to a required path.
              path: %(path)s
              uid: %(uid)s
              gid: %(gid)s

            If you feel that permissions on this path are set incorrectly, you can manually
            change them by executing

              $ sudo chmod %(uid)s:%(gid)s %(path)s
            """)
        import os

        kwargs.update(
            {
                "uid": os.geteuid(),
                "gid": os.getegid(),
            }
        )
    super(NotWritableError, self).__init__(message, **kwargs)


# Traceback (PermissionError)
Traceback (most recent call last):
File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/exceptions.py\", line 721, in __call__
return func(*args, **kwargs)
File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/main.py\", line 78, in _main
exit_code = do_call(args, p)
File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/conda_argparse.py\", line 75, in do_call
exit_code = getattr(module, func_name)(args, parser)
File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/main_install.py\", line 11, in execute
install(args, parser, 'install')
File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/install.py\", line 239, in install
handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv)
File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/cli/install.py\", line 269, in handle_txn
unlink_link_transaction.execute()
File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 220, in execute
self.verify()
File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/common/io.py\", line 402, in decorated
return f(*args, **kwds)
File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 207, in verify
exceptions = self._verify(self.prefix_setups, self.prefix_action_groups)
File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 460, in _verify
cls._verify_transaction_level(prefix_setups),
File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 455, in <genexpr>
exceptions = tuple(exc for exc in concatv(
File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/link.py\", line 323, in _verify_individual_level
error_result = axn.verify()
File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/core/path_actions.py\", line 870, in verify
touch(USER_ENVIRONMENTS_TXT_FILE, mkdir=True, sudo_safe=True)
File \"/home/nbcommon/anaconda3_420/lib/python3.5/site-packages/conda/gateways/disk/update.py\", line 89, in touch
os.chown(path, uid, gid)
PermissionError: [Errno 1] Operation not permitted: '/home/nbcommon/.conda/environments.txt'

# Fixed code
def __init__(self, path, errno, **kwargs):
    kwargs.update(
        {
            "path": path,
            "errno": errno,
        }
    )
    if on_win:
        message = dals("""
            The current user does not have write permissions to a required path.
              path: %(path)s
            """)
    else:
        message = dals("""
            The current user does not have write permissions to a required path.
              path: %(path)s
              uid: %(uid)s
              gid: %(gid)s

            If you feel that permissions on this path are set incorrectly, you can manually
            change them by executing

              $ sudo chmod %(uid)s:%(gid)s %(path)s
            """)
        import os

        kwargs.update(
            {
                "uid": os.geteuid(),
                "gid": os.getegid(),
            }
        )
    super(NotWritableError, self).__init__(message, **kwargs)