Can't re-checkout swift program due to Python Unicode error

I heard that our copies of the LLVM system were being redone. That was a week ago, so I threw out those directories next to my swift compiler checkout directory, git-fetched the latest copy of the swift repository, then tried to call

./utils/update-checkout --clone

I got an error stream ending in:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 19: ordinal not in range(128)

I had to do it several times to get all the parallel directories back. But I thought there was supposed to be only one Apple copy of LLVM, all unified or stuff. Has that not been implemented yet for regular users? Or has it been done, but the build script rearranges things to keep the old layout for regular users? Either way, I should not be getting that error. I checked on Stack Overflow, and it's caused by using Unicode streams while the Python still thinks it's an ASCII stream.

1 Like

I didn't run into the Unicode error you're encountering when I migrated to the monorepo, but to answer your other question:

update-checkout should create symlinks which point into llvm-project and recreate the pre-monorepo directory structure. Do you have non-ASCII characters in the path to your checkout? Maybe there's an issue with the symlinking step

Here's the output:

Daryles-MacBook-Air-II:swift daryle$ ./utils/update-checkout --clone
Skipping cmake on Darwin
Skipping icu on Darwin
Skipping clone of 'sourcekit-lsp', directory already exists
Skipping clone of 'swift-syntax', directory already exists
Skipping clone of 'cmake', requested by user
Skipping clone of 'swift-xcode-playground-support', directory already exists
Skipping clone of 'swift-format', directory already exists
Skipping clone of 'swift-stress-tester', directory already exists
Skipping clone of 'llvm-project', directory already exists
Skipping clone of 'llbuild', directory already exists
Skipping clone of 'cmark', directory already exists
Skipping clone of 'swift-corelibs-foundation', directory already exists
Skipping clone of 'indexstore-db', directory already exists
Skipping clone of 'swift-corelibs-xctest', directory already exists
Skipping clone of 'ninja', directory already exists
Skipping clone of 'swift-integration-tests', directory already exists
Skipping clone of 'swiftpm', directory already exists
Skipping clone of 'swift', directory already exists
Skipping clone of 'swift-corelibs-libdispatch', directory already exists
Skipping clone of 'icu', requested by user
Not cloning any repositories.
Running ``update_single_repository`` with up to 8 processes.
Traceback (most recent call last):
  File "./utils/update-checkout", line 15, in <module>
    update_checkout.main()
  File "/Volumes/ExtremeSSD—Data/Users/Shared/swift-source/swift/utils/update_checkout/update_checkout/update_checkout.py", line 595, in main
    cross_repos_pr)
  File "/Volumes/ExtremeSSD—Data/Users/Shared/swift-source/swift/utils/update_checkout/update_checkout/update_checkout.py", line 205, in update_all_repositories
    args.n_processes)
  File "/Volumes/ExtremeSSD—Data/Users/Shared/swift-source/swift/utils/swift_build_support/swift_build_support/shell.py", line 248, in run_parallel
    results = pool.map_async(func=fn, iterable=pool_args).get(999999)
  File "/usr/local/Cellar/python@2/2.7.17/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 572, in get
    raise self._value
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 19: ordinal not in range(128)

Should I re-erase these directories and try again. I mentioned before it took me several attempts to get all the directories.

@CTMacUser: you might want to run ./utils/update-checkout --clone -j1 to remove the paralellism and maybe get a more precise error.

You might also want to try env LC_ALL=C ./utils/update-checkout --clone to avoid your language in the shell (is it English) to emit some non-ASCII character that trips the script.