Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xce in position 33: invalid continuation byte #438

Open
kebuAAA opened this issue Oct 8, 2023 · 7 comments

Comments

@kebuAAA
Copy link

kebuAAA commented Oct 8, 2023

when run radian in windows 11 by Python 3.10
throw:

Traceback (most recent call last):
  File "c:\Users\lm\AppData\Local\Programs\Python\Python310\Lib\site-packages\radian\__main__.py", line 31, in <module>
    main(cleanup=cleanup)
  File "C:\Users\lm\AppData\Local\Programs\Python\Python310\lib\site-packages\radian\app.py", line 108, in main
    RadianApplication(r_home, ver=__version__).run(options, cleanup=cleanup)
  File "C:\Users\lm\AppData\Local\Programs\Python\Python310\lib\site-packages\radian\app.py", line 217, in run
    rutils.source_radian_profile(options.profile)
  File "C:\Users\lm\AppData\Local\Programs\Python\Python310\lib\site-packages\radian\rutils.py", line 70, in source_radian_profile
    global_profile = user_path(".radian_profile")
  File "C:\Users\lm\AppData\Local\Programs\Python\Python310\lib\site-packages\radian\rutils.py", line 44, in user_path
    return make_path(rcopy(rcall(("base", "path.expand"), "~")), *args)
  File "C:\Users\lm\AppData\Local\Programs\Python\Python310\lib\site-packages\rchitect\dispatch.py", line 53, in __call__
    return func(*args, **kwargs)
  File "C:\Users\lm\AppData\Local\Programs\Python\Python310\lib\site-packages\rchitect\interface.py", line 581, in rcopy
    return rcopy(unbox(r))
  File "C:\Users\lm\AppData\Local\Programs\Python\Python310\lib\site-packages\rchitect\dispatch.py", line 53, in __call__
    return func(*args, **kwargs)
  File "C:\Users\lm\AppData\Local\Programs\Python\Python310\lib\site-packages\rchitect\interface.py", line 569, in rcopy
    return rcopy(T, s)
  File "C:\Users\lm\AppData\Local\Programs\Python\Python310\lib\site-packages\rchitect\dispatch.py", line 53, in __call__
    return func(*args, **kwargs)
  File "C:\Users\lm\AppData\Local\Programs\Python\Python310\lib\site-packages\rchitect\interface.py", line 479, in rcopy
    return _string(lib.STRING_ELT(s, 0))
  File "C:\Users\lm\AppData\Local\Programs\Python\Python310\lib\site-packages\rchitect\interface.py", line 469, in _string
    return text_type(ffi.string(lib.Rf_translateCharUTF8(s)).decode("utf-8"))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xce in position 33: invalid continuation byte

My R version is 4.3.1 and I'm not sure why this problem happened.

@kebuAAA
Copy link
Author

kebuAAA commented Oct 8, 2023

I solved this problem with the guidance in readme. So sorry to bother you.

@kebuAAA kebuAAA closed this as completed Oct 8, 2023
@kebuAAA
Copy link
Author

kebuAAA commented Oct 11, 2023

This setting worked well but it conflicts with my zip.exe. After checking the Beta: Use Unicode UTF-8 for worldwide language support, I will see some garbage characters of file name in my zip file. So I just wonder if there is any otrher solution to deal with this problem.

@kebuAAA kebuAAA reopened this Oct 11, 2023
@randy3k
Copy link
Owner

randy3k commented Oct 11, 2023

What version of radian are you using?

@kebuAAA
Copy link
Author

kebuAAA commented Oct 11, 2023

What version of radian are you using?

I'm so sorry for fogetting to provide necessary infomation:

C:\Users\lm>radian --version
radian version: 0.6.7
r executable: D:\R\R-4.3.1\bin\R
r version: 4.3.1
python executable: C:\Users\lm\AppData\Local\Programs\Python\Python310\python.exe 
python version: 3.10.2

And I have solved this problem by adding a new .radian_profile in the %USERPROFILE% to avoid stepping into the elif statement in rutils.py. I think this error happened because the return vallue of the user_path(".radian_profile") contained unicode characters(I changed my defalut saving path). So thankful for your reply.❤️❤️

@mqdw222
Copy link

mqdw222 commented Oct 11, 2023

how to solve this problem?help!help!

@kebuAAA
Copy link
Author

kebuAAA commented Oct 12, 2023

how to solve this problem?help!help!

Are you sure you meet the same problem with me? If so, solutions may be:

  • Change the defalult locale in your computer just as the readme does. Changing the system locale or checking the Beta: Use Unicode UTF-8 for worldwide language support can solve this problem(My original locale is simplified Chinese).
  • adding a new .radian_profile in the %USERPROFILE% to avoid stepping into the elif statement in rutils.py

@randy3k
Copy link
Owner

randy3k commented Oct 12, 2023

Um, I believe that for some reason, user_path(".radian_profile") or base::path.expand("~") has returned a non-utf8 string despite utf-8 locale should have set earlier.

I will be great if you could test if rutils.set_locale is doing its job (unless we have LC_CTYPE set?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants