External Email - Use Caution        


Looks like python3 tries to write/process a string into a file when running the res-config script and fails to translate something to a utf-8 character.

If your locale says you are using UTF-8, e.g.,

$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=

- then it should work to use this grep command to find files with non-UTF8 characters in them, e.g.

$ grep -axvq '.*’ file.txt

The -q will prevent displaying the non-utf8 characters which might screw up your terminal session.

This thread gives some examples of when that error occurs and how to unmangle the string,
https://stackoverflow.com/questions/57794413/yet-another-person-who-cant-figure-how-to-use-unicode-in-python

- R.



On Mar 27, 2023, at 22:14, David Lau <drlauci@gmail.com> wrote:

        External Email - Use Caution        


Hi,

I tried to run Freesurfer (macOS-7.1.1) to the command line and the terminal replied, 

"DavidLaus-MacBook-Air:local davidlau$ recon-all -i /Users/davidlau/Desktop/testing/1RAS.nii -subject /Users/davidlau/Desktop/testing/$d done
Traceback (most recent call last):
  File "/Users/davidlau/Documents/freesurfer/python/scripts/rca-config", line 143, in <module>
    file.write(arg + '\n')
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcc3' in position 0: surrogates not allowed
ERROR: could not configure recon-all parameters"

A similar question has been retrieved from the mail list (20 Jul 2020) by Molly and Andrew replied that there might be a non-unicode character accidentlly passed to the command line and recommended manually typing out the recon-all command. I've tried this several times but the same error message popped out. 

Any suggestions would be much appreciated.

David
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer