unicode - What is a good strategy when it comes to Python I/O and user input from command prompt? -
i freaking out lately because have spent week writing totally useless pyton module transforms spacial data .csv format.
i got not problemwith handling spatial data when software runs ask user submit input command prompt or cygwin. after lot of effort , googling got somehow work utf-8.
i made compromise use english language , not (greek) needed errors english! take @ error:
please respond 'yes' or 'no' or 'y' or 'n'). add trips route id ''no5leho'' , direction 0? [y/n] y traceback (most recent call last): file "main.py", line 296, in <module> inputaddtrips = query_yes_no('would add trips route id \'\'%s\'\' , direction 0?\r\n' % (i)) file "main.py", line 33, in query_yes_no choice = input().lower() file "c:\python34\lib\codecs.py", line 319, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) unicodedecodeerror: 'utf-8' codec can't decode byte 0xcf in position 0: invalid continuation byte
i have tried sorts of try setting pythonioencoding system variable utf-8 , .encoding decoding every single print , input().
i have used
#!/usr/bin/env python
and
# -*- coding: utf-8 -*-
but nothing happens? still errors! want ask guys when comes input , output? begineer know big websites , software made in python there must way aboid errors!!
it's not greek or english. it's encoding in general. if user submits encoding comes system. neither utf-8, nor ascii. error "invalid continuation byte" indicates iso-8859-1. maybe tread helpful? unicodedecodeerror, invalid continuation byte
Comments
Post a Comment