Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python3 support #5

Closed
ashish01 opened this issue Apr 19, 2013 · 3 comments
Closed

Python3 support #5

ashish01 opened this issue Apr 19, 2013 · 3 comments

Comments

@ashish01
Copy link

I was able to compile and install yard under python3. 2to3 takes care of everything except one line in utils.py

on line 145 in utils.py change

table = maketrans(sep, "_"*len(sep))

to

table = dict((ord(x), y) for (x, y) in zip(sep, "_"*len(sep)))

and remove this import from the top

from string import maketrans
@ntamas
Copy link
Owner

ntamas commented Apr 19, 2013

Hmmm. I believe maketrans is still there in Python 3.x but it has been made a static method of the str class. How about this one?

try:
    from string import maketrans
except ImportError:
    maketrans = str.maketrans

Implemented in 43ed7e9. Let me know if it doesn't work for you.

@ntamas ntamas closed this as completed Apr 19, 2013
@ashish01
Copy link
Author

Cool! Yes it works fine. But this isn't the change you made in 43ed7e9 is not this :)

@ntamas
Copy link
Owner

ntamas commented Apr 20, 2013

Wow, that's awkward. Thanks. :) Fixed in c30f83a.

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

No branches or pull requests

2 participants