emres / turkish-deasciifier

Turkish deasciifier in Python based on Deniz Yüret's turkish-mode for Emacs
https://ileriseviye.wordpress.com/tag/turkish-deasciifier/
146 stars 23 forks source link

encode-decode error #5

Closed fatihkaan22 closed 4 years ago

fatihkaan22 commented 4 years ago
$ echo "Opusmegi cagristiran catirtilar." | turkish-deasciify
Traceback (most recent call last):
  File "/usr/bin/turkish-deasciify", line 26, in <module>
    d.deasciify()
  File "/usr/bin/turkish-deasciify", line 22, in deasciify
    sys.stdout.write(result.encode("utf-8"))
TypeError: write() argument must be str, not bytes

Deleting .decode("utf-8") and .encode("utf-8") in /usr/bin/turkish-deasciify solves the issue.

emres commented 4 years ago

Thanks for the bug report! Yet another Python 2 versus Python 3 issue, it seems.

Even though the Python 3 example outlined in README.md is correct, the source code of the command line utility doesn't reflect that (i.e. not Python 3 compatible).

After 10 years, maybe it's time to retire all the remaining Python 2 related parts. Feel free to open a pull request (or you'll have to wait for a while for me to do it :).