Pleiades / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

calcdeps.py needs to consistently handle file encodings on windows #473

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The calcdeps.py script doesn't work on utf-8 files using python 3 on windows.

Line 132 handles it correctly. All invocations of 'open' should similarly check 
the python version. 

calcdeps.py: Scanning files...
calcdeps.py: Finding Closure dependencies...
Traceback (most recent call last):
  File "..\prereq.closure-tools\closure\bin\calcdeps.py", line 570, in <module>
    logging.error('Invalid value for --output flag.')
  File "..\prereq.closure-tools\closure\bin\calcdeps.py", line 540, in main

  File "..\prereq.closure-tools\closure\bin\calcdeps.py", line 221, in CalculateDependencies
    file_handle = open(input_file, 'r')
  File "C:\data\python\3.2.3\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 5979: 
character maps to <undefined>

Original issue reported on code.google.com by ori.schw...@gmail.com on 24 May 2012 at 12:16

GoogleCodeExporter commented 8 years ago

Original comment by nn...@google.com on 30 May 2012 at 11:58

GoogleCodeExporter commented 8 years ago
Do we have a fix for this? Temporary workaround, perhaps?

Original comment by malachaifrazier on 14 Jun 2013 at 6:44

GoogleCodeExporter commented 8 years ago
I have a similar problem using Python 3.3.2 on Windows 7, see issue 603. Is 
there a fix or workaround? To include the name of the affected file in the 
error message, I have already proposed an improvement (for my problem, but may 
be included similarly elsewhere). See attached file and issue 602.

Original comment by m...@jochenscharr.de on 10 Nov 2013 at 5:10

Attachments: