rehandalal / sort-requirements

A simple script to sort python dependencies in requirement text files.
Mozilla Public License 2.0
17 stars 4 forks source link

UnicodeEncodeError #4

Closed crkrenn closed 4 years ago

crkrenn commented 4 years ago

@rehandalal,

Thanks very much for writing sort-requirements.!

I just tried to use it on a windows laptop under and got a strange UnicodeEncodeError on two different packages.

Do you have any advice on how to debug this?

Thanks!

$ sort-requirements.exe  requirements.txt
Traceback (most recent call last):
  File "C:\Users\crkrenn\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\crkrenn\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\crkrenn\code\codepy\venv\Scripts\sort-requirements.exe\__main__.py", line 9, in <module>
  File "c:\users\crkrenn\code\codepy\venv\lib\site-packages\sort_requirements\script.py", line 103, in main
    return end(0, args, changed, len(files))
  File "c:\users\crkrenn\code\codepy\venv\lib\site-packages\sort_requirements\script.py", line 21, in end
    write("All done! \U0001f389\n")
  File "C:\Users\crkrenn\Anaconda3\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f389' in position 10: character maps to <undefined>
rehandalal commented 4 years ago

Seems like there might be a strange character in your requirements file. Would you be able to share the file you are trying to process?

crkrenn commented 4 years ago

Thanks very much for the response! I think it is a windows issue.

If you care, it seems to be a problem with git-bash and anaconda. Using sort-requirements in windows power shell works fine.

I really wish I was not forced to switch from mac to windows!

rehandalal commented 4 years ago

Glad that worked out!