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

itsdb.get_data_specifier() doesn't work with a unicode argument in Python2 #164

Closed
goodmami opened this issue Aug 8, 2018 · 1 comment
Closed
Assignees
Milestone

Comments

@goodmami
Copy link
Member

goodmami commented Aug 8, 2018

This is a standard Python 2 unicode-vs-string issue. It prevents the main script from working with Python 2 for the convert command because (a) from __future__ import unicode_literals is used in main.py, and (b) the convert command has a default selector defined. To reproduce:

$ python2 -m delphin.main convert <<< "[ ]"

Rather than ensure that the convert command passes a string, a more robust fix would let itsdb.get_data_specifier() to work with unicode or (byte) string objects.

@goodmami
Copy link
Member Author

itsdb.get_data_specifier() calls itsdb._split_cols() which has this line (which is the heart of the problem):

    return list(map(str.strip, colstring.split('@')))

str refers to different types in Python2 and Python3, so str.strip() may not work with unicode objects in Python2 or bytes objects in Python3. Rather than specify str.strip you can rely on duck-typing to ignore the difference and strip spaces no matter what type each column value is.

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