Search code examples
pythonrepo

repo init returns WindowsError: [Error 2]


Environment:

  1. Windows 7
  2. Python 2.7 (64bit)

When I run repo init -u https://android.googlesource.com/platform/manifest, it generates the following error:

Traceback (most recent call last):

  File "F:\android source code\.repo\repo/main.py", line 538, in <module>
    _Main(sys.argv[1:])

  File "F:\android source code\.repo\repo/main.py", line 512, in _Main
    result = repo._Run(argv) or 0

  File "F:\android source code\.repo\repo/main.py", line 181, in _Run
    portable.NoPager(cmd)

  File "F:\android source code\.repo\repo\portable.py", line 277, in NoPager
    RunWindowsShell(cmd)

  File "F:\android source code\.repo\repo\portable.py", line 281, in RunWindowsS
hell
    redirect_all(executable)

  File "F:\android source code\.repo\repo\portable.py", line 288, in redirect_al
l
    p = subprocess.Popen([executable], stdin=subprocess.PIPE, stdout=old_sysout,
 stderr=old_syserr)

  File "C:\Python27\lib\subprocess.py", line 394, in __init__
    errread, errwrite)

  File "C:\Python27\lib\subprocess.py", line 644, in _execute_child
    startupinfo)

WindowsError: [Error 2]

Solution

  • Windows error 2 means that a file cannot be found. Verify each of the addressed files if they really exist in the expected place and that the access rights are appropriate. Eventually you have to run your script with admin priviledges.