From 3346ba0bed171db1e8cc2208d5145904c8f4c907 Mon Sep 17 00:00:00 2001 From: wuzewu Date: Mon, 9 Aug 2021 17:15:06 +0800 Subject: [PATCH] Warn when using Chinese directory under windows. --- paddlehub/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/paddlehub/__init__.py b/paddlehub/__init__.py index 4b5d935f..be47df84 100644 --- a/paddlehub/__init__.py +++ b/paddlehub/__init__.py @@ -33,11 +33,13 @@ from paddlehub.finetune import Trainer from paddlehub.utils import log, parser, utils from paddlehub.utils import download as _download from paddlehub.utils.paddlex import download, ResourceNotFoundError +from paddlehub.utils.platform import is_windows from paddlehub.server import server_check from paddlehub.server.server_source import ServerConnectionError from paddlehub.module import Module from paddlehub.text.bert_tokenizer import BertTokenizer, ErnieTinyTokenizer from paddlehub.text.tokenizer import CustomTokenizer +from paddlehub.text.utils import is_chinese_char # In order to maintain the compatibility of the old version, we put the relevant # compatible code in the paddlehub.compat package, and mapped some modules referenced @@ -103,3 +105,12 @@ def help(*args, **kwargs): CacheUpdater("paddle.hub.help").start() return phhelp(*args, **kwargs) + + +if is_windows(): + for char in env.HUB_HOME: + if is_chinese_char(char): + log.logger.warning( + 'The home directory contains Chinese characters which may cause unknown exceptions in the execution \ + of some modules. Please set another path through the set HUB_HOME command.') + break -- GitLab