[BUG] Seems like output dir tree printing in dcm2bids_scaffold assumes UTF-8 encoding which breaks logging on windows
Opened this issue · 1 comments
kenanoestreich commented
The core function of dcm2bids_scaffold seems to still be working fine by inspecting the files and directories.
I ran dcm2bids_scaffold -o ~/bids_dir on git bash on Windows 11, and I received a logging error for each file or directory created; each looked like this, with small changes depending on which file or directory it tried to log.
Not a big issue, but might be solved if you can figure out the unicode encoding of the native system. Not sure how all that works.
Here's the error:
--- Logging error ---
Traceback (most recent call last):
File "C:\Users\username\miniconda3\envs\dcm2bids\Lib\logging\__init__.py", line 1113, in emit
stream.write(msg + self.terminator)
File "C:\Users\username\miniconda3\envs\dcm2bids\Lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode characters in position 55-57: character maps to <undefined>
Call stack:
File "C:\Users\username\miniconda3\envs\dcm2bids\Scripts\dcm2bids_scaffold-script.py", line 9, in <module>
sys.exit(main())
File "C:\Users\username\miniconda3\envs\dcm2bids\Lib\site-packages\dcm2bids\cli\dcm2bids_scaffold.py", line 110, in main
TreePrinter(args.output_dir).print_tree()
File "C:\Users\username\miniconda3\envs\dcm2bids\Lib\site-packages\dcm2bids\utils\utils.py", line 209, in print_tree
logger.info(item)
Message: '\u251c\u2500\u2500 CHANGES'
arnaudbore commented
Hello @kenanoestreich ,
Thank you for reporting this issue.
Can you give a try with the container ? I would be interested in knowing if you get the exact same error with it.
In the meantime I need to find a laptop with Windows 11 now 😅