celltypist icon indicating copy to clipboard operation
celltypist copied to clipboard

Error happened in models

Open anyang-kevin opened this issue 1 year ago • 8 comments

Hi, When I used any models method, I recived error :UnicodeEncodeError: 'UCS-2' codec can't encode character '\U0001f4dc' in position 0: Non-BMP character not supported in Tk (also in position 154) How can I fix it? It seems like a error caused by crawling web page.

anyang-kevin avatar Sep 10 '23 14:09 anyang-kevin

`models.download_models(force_update = True) --- Logging error --- Traceback (most recent call last): File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\logging_init_.py", line 985, in emit stream.write(msg) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 362, in write return self.shell.write(s, self.tags) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 604, in call value = self.sockio.remotecall(self.oid, self.name, args, kwargs) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 216, in remotecall return self.asyncreturn(seq) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 247, in asyncreturn return self.decoderesponse(response) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 267, in decoderesponse raise what UnicodeEncodeError: 'UCS-2' codec can't encode character '\U0001f4dc' in position 0: Non-BMP character not supported in Tk Call stack: File "", line 1, in File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 144, in main ret = method(*args, **kwargs) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 474, in runcode exec(code, self.locals) File "<pyshell#0>", line 1, in File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\site-packages\celltypist\models.py", line 436, in download_models models_json = get_models_index(force_update) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\site-packages\celltypist\models.py", line 395, in get_models_index download_model_index() Traceback (most recent call last): File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\logging_init_.py", line 985, in emit stream.write(msg) UnicodeEncodeError: 'UCS-2' codec can't encode character '\U0001f4dc' in position 0: Non-BMP character not supported in Tk

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "<pyshell#0>", line 1, in models.download_models(force_update = True) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\site-packages\celltypist\models.py", line 436, in download_models models_json = get_models_index(force_update) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\site-packages\celltypist\models.py", line 395, in get_models_index download_model_index() Traceback (most recent call last): File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\logging_init_.py", line 985, in emit stream.write(msg) UnicodeEncodeError: 'UCS-2' codec can't encode character '\U0001f4dc' in position 0: Non-BMP character not supported in Tk

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "<pyshell#0>", line 1, in models.download_models(force_update = True) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\site-packages\celltypist\models.py", line 436, in download_models models_json = get_models_index(force_update) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\site-packages\celltypist\models.py", line 395, in get_models_index download_model_index() Traceback (most recent call last): File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\logging_init_.py", line 985, in emit stream.write(msg) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 362, in write return self.shell.write(s, self.tags) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 604, in call value = self.sockio.remotecall(self.oid, self.name, args, kwargs) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 216, in remotecall return self.asyncreturn(seq) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 247, in asyncreturn return self.decoderesponse(response) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 267, in decoderesponse raise what UnicodeEncodeError: 'UCS-2' codec can't encode character '\U0001f4dc' in position 0: Non-BMP character not supported in Tk

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 474, in runcode exec(code, self.locals) File "<pyshell#0>", line 1, in File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\site-packages\celltypist\models.py", line 436, in download_models models_json = get_models_index(force_update) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\site-packages\celltypist\models.py", line 395, in get_models_index download_model_index() Traceback (most recent call last): File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\logging_init_.py", line 985, in emit stream.write(msg) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 362, in write return self.shell.write(s, self.tags) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 604, in call value = self.sockio.remotecall(self.oid, self.name, args, kwargs) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 216, in remotecall return self.asyncreturn(seq) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 247, in asyncreturn return self.decoderesponse(response) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 267, in decoderesponse raise what UnicodeEncodeError: 'UCS-2' codec can't encode character '\U0001f4dc' in position 0: Non-BMP character not supported in Tk

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 474, in runcode exec(code, self.locals) File "<pyshell#0>", line 1, in File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\site-packages\celltypist\models.py", line 436, in download_models models_json = get_models_index(force_update) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\site-packages\celltypist\models.py", line 395, in get_models_index download_model_index() File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\site-packages\celltypist\models.py", line 411, in download_model_index File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\logging_init_.py", line 1332, in info self.log(INFO, msg, args, **kwargs) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\logging_init.py", line 1468, in log self.handle(record) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\logging_init.py", line 1478, in handle self.callHandlers(record) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\logging_init_.py", line 1540, in callHandlers hdlr.handle(record) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\logging_init_.py", line 854, in handle self.emit(record) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\logging_init_.py", line 989, in emit self.handleError(record) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\logging_init_.py", line 916, in handleError traceback.print_stack(frame, file=sys.stderr) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\traceback.py", line 186, in print_stack print_list(extract_stack(f, limit=limit), file=file) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\traceback.py", line 25, in print_list print(item, file=file, end="") File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 362, in write return self.shell.write(s, self.tags) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 604, in call value = self.sockio.remotecall(self.oid, self.name, args, kwargs) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 216, in remotecall return self.asyncreturn(seq) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 247, in asyncreturn return self.decoderesponse(response) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 267, in decoderesponse raise what UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 156-156: Non-BMP character not supported in Tk

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 144, in main ret = method(*args, **kwargs) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 486, in runcode print_exception() File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 234, in print_exception print_exc(typ, val, tb) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 229, in print_exc traceback.print_list(tbe, file=efile) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\traceback.py", line 25, in print_list print(item, file=file, end="") File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 362, in write return self.shell.write(s, self.tags) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 604, in call value = self.sockio.remotecall(self.oid, self.name, args, kwargs) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 216, in remotecall return self.asyncreturn(seq) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 247, in asyncreturn return self.decoderesponse(response) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 267, in decoderesponse raise what UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 156-156: Non-BMP character not supported in Tk

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 158, in main print_exception() File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 234, in print_exception print_exc(typ, val, tb) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 220, in print_exc print_exc(type(context), context, context.traceback) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 229, in print_exc traceback.print_list(tbe, file=efile) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\traceback.py", line 25, in print_list print(item, file=file, end="") File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 362, in write return self.shell.write(s, self.tags) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 604, in call value = self.sockio.remotecall(self.oid, self.name, args, kwargs) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 216, in remotecall return self.asyncreturn(seq) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 247, in asyncreturn return self.decoderesponse(response) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 267, in decoderesponse raise what UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 156-156: Non-BMP character not supported in Tk

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 162, in main traceback.print_exception(type, value, tb, file=sys.stderr) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\traceback.py", line 101, in print_exception print(line, file=file, end="") File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\run.py", line 362, in write return self.shell.write(s, self.tags) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 604, in call value = self.sockio.remotecall(self.oid, self.name, args, kwargs) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 216, in remotecall return self.asyncreturn(seq) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 247, in asyncreturn return self.decoderesponse(response) File "C:\Users\anyang\AppData\Local\Programs\Python\Python37\lib\idlelib\rpc.py", line 267, in decoderesponse raise what UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 156-156: Non-BMP character not supported in Tk`

anyang-kevin avatar Sep 10 '23 14:09 anyang-kevin

@anyang-kevin, it should be fixed now. Could you check?

ChuanXu1 avatar Sep 12 '23 09:09 ChuanXu1

@anyang-kevin, it should be fixed now. Could you check?

No.I still receive the same error. Should I update my package?

anyang-kevin avatar Sep 12 '23 10:09 anyang-kevin

Now I can use MODEL in Centos system and the celltypist download from conda. But I also cant use in Windows system, which download in pip. And my Windows is chinese system. Maybe this is caused by unicode encoding? My python is 3.7.0 and celltypist version is 1.6.0. I hope it can help u to fix this bug.

anyang-kevin avatar Sep 12 '23 12:09 anyang-kevin

I've got a guess: this is because your system interpreter (IDE, windows or Tk interface) doesn't support the emojis that CellTypist uses when printing information becase they are not part of the Basic Multilingual Plane (bmp) ?

Are you using a particular python IDE or interpreter? I noticed the pyshell#0 in the log. Possibly you can have everything in a script and simply run it with python xxx.py from a system terminal outside the IDE or instead of using an interactive python REPL?

prete avatar Sep 12 '23 12:09 prete

I've got a guess: this is because your system interpreter (IDE, windows or Tk interface) doesn't support the emojis that CellTypist uses when printing information becase they are not part of the Basic Multilingual Plane (bmp) ?

Are you using a particular python IDE or interpreter? I noticed the pyshell#0 in the log. Possibly you can have everything in a script and simply run it with python xxx.py from a system terminal outside the IDE or instead of using an interactive python REPL?

Yes! Its useful. I used it in python IDLE and recived error. When I used it in windows cmd terminal, it works fine. and I saw a special symbol. 1694523848182

anyang-kevin avatar Sep 12 '23 13:09 anyang-kevin

By the way, my python IDE is the original IDLE that came with python. Maybe this emoji is not suitable for windows10(Professional Edition) ?

anyang-kevin avatar Sep 12 '23 13:09 anyang-kevin

CellTypist is most commonly used from the command line or from a notebook. We know it's been tested on VSCode and PyCharm. Would be interested in knowing if it works on the Tk interpreter (IDLE that comes with python) in more recent python versions (3.9+)?

prete avatar Sep 12 '23 13:09 prete