Skip to content

Fixed syntax and unicode encode errors.#20

Merged
peterbe merged 5 commits intopeterbe:masterfrom
bernimoses:master
Jul 12, 2017
Merged

Fixed syntax and unicode encode errors.#20
peterbe merged 5 commits intopeterbe:masterfrom
bernimoses:master

Conversation

@bernimoses
Copy link
Contributor

This fixed some errors in the run.py file.

  File "run.py", line 48
    print()
        ^
SyntaxError: invalid syntax
  File "run.py", line 5
    from __future__ import print_function
SyntaxError: from __future__ imports must occur at the beginning of the file
Traceback (most recent call last):
  File "run.py", line 78, in <module>
    sys.exit(run(args))
  File "run.py", line 45, in run
    f.write(link.after)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 125: ordinal not in range(128)

@adrientetar
Copy link

Traceback (most recent call last):
  File "run.py", line 77, in <module>
    sys.exit(run(args))
  File "run.py", line 44, in run
    f.write(link.after.encode('utf-8'))
TypeError: must be str, not bytes

Python 3.4, Windows 7.

@peterbe
Copy link
Owner

peterbe commented Apr 14, 2014

Please change to use codecs instead of open and see if it works equally in python 3.4

@peterbe
Copy link
Owner

peterbe commented Jul 10, 2017

Can you take a stab at redoing this using codecs instead?

@bernimoses
Copy link
Contributor Author

Updated.

@peterbe peterbe merged commit 811af80 into peterbe:master Jul 12, 2017
@peterbe
Copy link
Owner

peterbe commented Jul 12, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants