![]() If you have a mix of unicode and bytestring values, decode just the bytestrings or encode just the unicode values try to avoid mixing the types. Layer=layer, enabled_drivers=enabled_drivers, **kwargs)įile "C:\Python27\ArcGIS10.8\lib\site-packages\fiona\collection.py", line 154, in _init_įile "fiona\ogrext.pyx", line 466, in . The solution is to not encode data that is already encoded, or first decode using a suitable codec before trying to encode again, if the data was encoded to a different codec than what you needed. With reader(path_or_bytes, **kwargs) as features:įile "C:\Python27\ArcGIS10.8\lib\site-packages\fiona\env.py", line 398, in wrapperįile "C:\Python27\ArcGIS10.8\lib\site-packages\fiona\_init_.py", line 257, in open To fix this, you can specify the correct codec when opening the file or when calling the decode method. Gdf_corridor_sorted.to_file('G:\Jason Ma\2022Q3 HERE shapefiles\Corridors\Old corridors\Toronto1_done.shp')įile "C:\Python27\ArcGIS10.8\lib\site-packages\geopandas\io\file.py", line 76, in read_file The 'UnicodeDecodeError: 'ascii' codec can't decode byte' error occurs when trying to decode non-ASCII bytes using the ASCII codec. I had the same error, with URLs containing non-ascii chars (bytes with values > 128) url url.decode( 'utf8' ).encode( 'utf-8' ) Worked for me, in Python 2.7, I suppose this assignment changed ‘something’ in the str internal representationi.e., it forces the right decoding of the backed byte sequence in url and finally puts the string. ![]() Gdf_corridor_sorted = MM.Order_the_Links(corridor_name,gdf_corr) I have a file called example.txt with the following contents. ![]() Here is an example of how the error occurs. To solve the error, specify the correct encoding, e.g. Gdf_corr = gpd.read_file('G:\Jason Ma\2022Q3 HERE shapefiles\Corridors\Old corridors\Toronto1.shp') The Python 'UnicodeDecodeError: 'ascii' codec can't decode byte in position' occurs when we use the ascii codec to decode bytes that were encoded using a different codec.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |