我正在尝试使用高通的材料在Ubuntu 20下为DragonBoard 410c构建自己的安卓系统。我已经从高通开发者门户网站下载了文件linux_android_board_support_package_vla.br_.1.2.7-01010-8x16.0-4.zip,该文件包含我解压到文件夹~/Documents/linux_android_board_support_package_vla.br.1.2.7-01010-8x16.0-4中的材料,使可用的材料包括外壳脚本DB410c_build.sh。
解包和设置是由DB410c_build.sh完成的,它执行各种操作,比如用.repo脚本使用的python文件生成python目录树,以及下载源代码。
我在各种python脚本中遇到了许多语法错误,这似乎是为python2编写的,到目前为止,我已经能够解决这些错误。顺便说一下,python --version报告了python 2.7.18,但我仍然看到一些错误,表明正在使用Python3。
最新的错误来自python脚本.repo/repo/subcmds/smartsync.py,当它执行时,我得到以下错误,我无法通过搜索找出或找到解决方案。
Traceback (most recent call last):
File "/home/rick/Documents/linux_android_board_support_package_vla.br.1.2.7-01010-8x16.0-4/APQ8016_410C_LA.BR.1.2.7-01010-8x16.0_6.0.1_Marsh_Mallo_P2/.repo/repo/main.py", line 42, in <module>
from subcmds import all as all_commands
File "/home/rick/Documents/linux_android_board_support_package_vla.br.1.2.7-01010-8x16.0-4/APQ8016_410C_LA.BR.1.2.7-01010-8x16.0_6.0.1_Marsh_Mallo_P2/.repo/repo/subcmds/__init__.py", line 33, in <module>
mod = __import__(__name__,
File "/home/rick/Documents/linux_android_board_support_package_vla.br.1.2.7-01010-8x16.0-4/APQ8016_410C_LA.BR.1.2.7-01010-8x16.0_6.0.1_Marsh_Mallo_P2/.repo/repo/subcmds/smartsync.py", line 16, in <module>
from sync import Sync
ModuleNotFoundError: No module named 'sync'完整的python源文件smartsync.py如下所示:
#
# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from sync import Sync
class Smartsync(Sync):
common = True
helpSummary = "Update working tree to the latest known good revision"
helpUsage = """
%prog [<project>...]
"""
helpDescription = """
The '%prog' command is a shortcut for sync -s.
"""
def _Options(self, p):
Sync._Options(self, p, show_smart=False)
def Execute(self, opt, args):
opt.smart_sync = True
Sync.Execute(self, opt, args)这只是这个文件中的python脚本的最新问题,该文件是从https://developer.qualcomm.com/hardware/dragonboard-410c/software下载的,尝试使用
Android Board Support Package
vLA.BR.1.2.7-01010-8x16.0-4之前的大多数错误都是由于except和raise以及print的语法错误,以及几个很容易找到解决方案的import错误(谢谢StackOverFlow!)。
然而,我找不到关于这个的任何东西。
发布于 2020-12-04 12:26:42
该问题是由于位于文件夹.repo/repo/subcmds中的文件smartsync.py和该文件中的from sync import Sync语句中的语法错误造成的。
sync实际上引用的是文件sync.py,该文件也位于.repo/repo/subcmds文件夹中,而不是这段python源代码之外的某个python文件。
from语句缺少文件sync.py所在的目录说明符subcmds。为了从位于文件夹subcmds中的文件sync.py导入类Sync,这行代码应该已经编写为from subcmds.sync import Sync。我认为这是因为python脚本在当前目录设置为.repo/repo而不是.repo/repo/subcmds的情况下运行。
在对文件进行此更改后,脚本将成功运行,直到另一个文件中出现需要更正的下一个错误。
https://stackoverflow.com/questions/65119491
复制相似问题