OpenHarmony开发者论坛

标题: OpenHarmony4.1.2 ModuleNotFoundError: No module named 'hb.resources' [打印本页]

作者: puppert_yard    时间: 2025-3-1 14:35
标题: OpenHarmony4.1.2 ModuleNotFoundError: No module named 'hb.resources'
[md]### 【问题描述】

1. 问题现象和发生的背景
   我输入指令: `./build.sh --product-name wifiiot_hispark_pegasus@hisilicon --cache`
   但是编译失败,报错:

   ![image.png](https://forums-obs.openharmony.c ... uphnuizxxytxja8.png "image.png")

   主要原因是找不到hb.resources模块。
2. 相关的代码

   我进入了报错的文件:build/ohos/packages/fs_process.py

   发现这个文件所在的上两级目录有对应的代码。build/hb/resources/config.py,这个文件里包含Config类,我曾一直以为这个类的代码就是它需要的,外加我看到,fs_process.py的文件中有设置文件目录的代码,我就认为可能只是路径错误,所以读取失败:

   ```python
   import os
   import sys
   import shutil
   import argparse
   sys.path.append(os.path.dirname(os.path.dirname(
       os.path.dirname(os.path.abspath(__file__)))))
   from hb.resources.config import Config
   from hb.util.log_util import LogUtil
   from hb.util.system_util import SystemUtil
   from hb.util.io_util import IoUtilpython
   ```

   我单独测试了这个导入的内容,发现并不会报错,但是build的时候就是会报错。
3. 我尝试过的解决方法和结果

   我尝试重新下载 `pip3 install ohos-build`

   但是没有用,我也尝试运行build/hb文件夹下的文件重构环境 `python3 -m pip install --user build/hb`

   然后按照readme.md文件的内容重构,但是没有结果。全部失败。
4. 我想要达到的结果

   我希望那我跟能够通过编译。

### 【运行环境】

硬件:Hi3861     hisilicon
ROM版本:Ubuntu20.04
DevEvoStudio版本:DevEco Studio 4 release
SDK版本:OpenHarmony4.1.2
[/md]
作者: 润开鸿_闻飞    时间: 2025-3-6 15:52
有没有一种可能是这个分支上的wifiiot_hispark_pegasus压根编译不了,或者hb使用不了,




欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/) Powered by Discuz! X3.5