build py file include Chinese notes show error #12831
Unanswered
skylin008
asked this question in
STM32 / Pyboard
Replies: 1 comment 2 replies
-
Python's |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I had a lcd.py file as show:
`#coding:utf-8
"""
LCD 驱动,版本1.0
LCD 为迪文创新的串口屏,型号为 DMG10600T070_A5WTC
使用 RS485 方式进行数据传送,波特率为115200
数据协议格式如下: 起始符(2个字节) + 长度(1个字节) + 命令类型(1个字节) + 地址(2个字节) + 数据内容
16 进制格式 5A A5 0~FF 0x82(写入)/0x83(读取) 详见协议
例子:测距 1-6 跟倒车雷达距离,因为7个数据所在地址是连续的,发送时只给首地址即可
5A A5 11 82 50 00 00 32 00 32 00 32 00 32 00 32 00 32 00 32
"""
from machine import UART,Pin
import gc
import logging
import uasyncio as asyncio
from machine import const
from primitives import delay_ms
import ustruct
from InitConfig import config
from micropython import alloc_emergency_exception_buf
logging.level_name(level = logging.DEBUG)
log = logging.Logger("Lcd")
alloc_emergency_exception_buf(100)
DEBUG = config.get('DEBUG', False)
gc.collect()
version = "1.0"
author = "skylin"
class Lcd(object):
`
and lcd directory manifest.py as follow:
'
package(
"lcd",
(
"lcd.py",
),
base_path="..",
opt=3,
)
'
and at the same time, I add some content to the boards/manifest.py file as:
include("$(PORT_DIR)/modules/lcd")
when i build the PYBV11 firmware, the error shows:
MPY lcd/lcd.py
Traceback (most recent call last):
File "E:\Project\TianMa\SoftWare_Micropython\micropython\tools\makemanifest.py", line 265, in
main()
File "E:\Project\TianMa\SoftWare_Micropython\micropython\tools\makemanifest.py", line 196, in main
with manifestfile.tagged_py_file(result.full_path, result.metadata) as tagged_path:
File "C:/msys64/mingw64/lib/python3.10/contextlib.py", line 135, in enter
return next(self.gen)
File "E:/Project\TianMa\SoftWare_Micropython\micropython\tools/manifestfile.py", line 547, in tagged_py_file
contents = src.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x8f in position 76: illegal multibyte sequence
make: *** [../../py/mkrules.mk:194: build-PYBV11/frozen_content.c] Error 1
make: *** Waiting for unfinished jobs....
How to solve this issue? Thanks !
Beta Was this translation helpful? Give feedback.
All reactions