TypeError when set target to build Fuchsia

133 Views Asked by At

Trying to set a target before building Fuchsia, but getting the following error. I tried converting the sep to byte by using b.startswith(b'sep') then it gives the error. So I am just stuck on how to deal with this. I have zero knowledge of python.

prashant@prashant-Lenovo:~/fuchsia$ scripts/fx set x64

and the output is :

ERROR at //build/gn/BUILD.gn:67:5: Script returned non-zero exit code.
    exec_script("//build/zircon/list_source_files.py", [], "list lines")
    ^---------- Current dir: /home/prashant/fuchsia/out/x64/ Command: /usr/bin/env -- /home/prashant/fuchsia/build/zircon/list_source_files.py Returned 1. stderr:

Traceback (most recent call last):   File "/home/prashant/fuchsia/build/zircon/list_source_files.py", line 36, in <module>
    sys.exit(main())   File "/home/prashant/fuchsia/build/zircon/list_source_files.py", line 31, in main
    for file in get_files():   File "/home/prashant/fuchsia/build/zircon/list_source_files.py", line 27, in get_files
    return [os.path.join(ZIRCON_ROOT, file) for file in files]   File "/home/prashant/fuchsia/build/zircon/list_source_files.py", line 27, in <listcomp>
    return [os.path.join(ZIRCON_ROOT, file) for file in files]   File "/usr/lib/python3.6/posixpath.py", line 87, in join
    if b.startswith(sep): TypeError: startswith first arg must be bytes or a tuple of bytes, not str
1

There are 1 best solutions below

0
On

I just ran into this particular problem too. The problem probably comes from the fact that your system's python is aliased to python3 instead of python2.

This is a bug in the fuchsia build scripts. It can be resolved by either:

  • Updating the python interpreter of your file from from: #!/usr/bin/env python to #!/usr/bin/env python2
  • Setting up your system's python to point to python2. This may break other things on your system.