I have a encoding problem during using of subprocess. The input is a
string with UTF-8 encoding.
the code is:
tokenize =
subprocess.Pope n(tok_command,s tdin=subprocess .PIPE,stdout=su bprocess.PIPE,c lose_fds=True,s hell=True)
(tokenized_text ,errs) = tokenize.commun icate(t)
the error is:
File "/usr/local/python/lib/python2.5/subprocess.py", line 651, in
communicate
return self._communica te(input)
File "/usr/local/python/lib/python2.5/subprocess.py", line 1115, in
_communicate
bytes_written = os.write(self.s tdin.fileno(), input[:512])
UnicodeEncodeEr ror: 'ascii' codec can't encode character u'\xa9' in
position 204: ordinal not in range(128)
How I change the default encoding from "ascii" to "utf-8"?
Ying Chen
string with UTF-8 encoding.
the code is:
tokenize =
subprocess.Pope n(tok_command,s tdin=subprocess .PIPE,stdout=su bprocess.PIPE,c lose_fds=True,s hell=True)
(tokenized_text ,errs) = tokenize.commun icate(t)
the error is:
File "/usr/local/python/lib/python2.5/subprocess.py", line 651, in
communicate
return self._communica te(input)
File "/usr/local/python/lib/python2.5/subprocess.py", line 1115, in
_communicate
bytes_written = os.write(self.s tdin.fileno(), input[:512])
UnicodeEncodeEr ror: 'ascii' codec can't encode character u'\xa9' in
position 204: ordinal not in range(128)
How I change the default encoding from "ascii" to "utf-8"?
Ying Chen
Comment