# Buggy code
def init_long_path(target_path):
    win_ver, _, win_rev = context.os_distribution_name_version[1].split(".")
    # win10, build 14352 was the first preview release that supported this
    if int(win_ver) >= 10 and int(win_rev) >= 14352:
        prev_value, value_type = _read_windows_registry(target_path)
        if prev_value != "1":
            if context.verbosity:
                print("\n")
                print(target_path)
                print(make_diff(prev_value, "1"))
            if not context.dry_run:
                _write_windows_registry(target_path, "1", winreg.REG_DWORD)
            return Result.MODIFIED
        else:
            return Result.NO_CHANGE
    else:
        if context.verbosity:
            print("\n")
            print(
                "Not setting long path registry key; Windows version must be at least 10 with "
                'the fall 2016 "Anniversary update" or newer.'
            )
            return Result.NO_CHANGE


# Traceback (ValueError)
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

Traceback (most recent call last):
File "c:\users\wani\downloads\repos\conda\conda\exceptions.py", line 1001, in __call__
return func(*args, **kwargs)
File "c:\users\wani\downloads\repos\conda\conda\cli\main.py", line 84, in _main
exit_code = do_call(args, p)
File "c:\users\wani\downloads\repos\conda\conda\cli\conda_argparse.py", line 81, in do_call
exit_code = getattr(module, func_name)(args, parser)
File "c:\users\wani\downloads\repos\conda\conda\cli\main_init.py", line 52, in execute
anaconda_prompt)
File "c:\users\wani\downloads\repos\conda\conda\core\initialize.py", line 106, in initialize
run_plan(plan2)
File "c:\users\wani\downloads\repos\conda\conda\core\initialize.py", line 552, in run_plan
result = globals()[step['function']](*step.get('args', ()), **step.get('kwargs', {}))
File "c:\users\wani\downloads\repos\conda\conda\core\initialize.py", line 1196, in init_long_path
_write_windows_registry(target_path, "1", winreg.REG_DWORD)
File "c:\users\wani\downloads\repos\conda\conda\core\initialize.py", line 1143, in _write_windows_registry
winreg.SetValueEx(key, value_name, 0, value_type, value_value)
ValueError: Could not convert the data to the specified type.

`$ C:\ProgramData\MinicondaX\Scripts\conda-script.py init --system cmd.exe`

# Fixed code
def init_long_path(target_path):
    win_ver, _, win_rev = context.os_distribution_name_version[1].split(".")
    # win10, build 14352 was the first preview release that supported this
    if int(win_ver) >= 10 and int(win_rev) >= 14352:
        prev_value, value_type = _read_windows_registry(target_path)
        if str(prev_value) != "1":
            if context.verbosity:
                print("\n")
                print(target_path)
                print(make_diff(str(prev_value), "1"))
            if not context.dry_run:
                _write_windows_registry(target_path, 1, winreg.REG_DWORD)
            return Result.MODIFIED
        else:
            return Result.NO_CHANGE
    else:
        if context.verbosity:
            print("\n")
            print(
                "Not setting long path registry key; Windows version must be at least 10 with "
                'the fall 2016 "Anniversary update" or newer.'
            )
            return Result.NO_CHANGE