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

try to write all attributes as NC_CHAR (issue #529) #533

Merged
merged 12 commits into from
Mar 1, 2016
Merged

Conversation

jswhit
Copy link
Collaborator

@jswhit jswhit commented Feb 26, 2016

only write NC_STRING if it can't be converted to ascii.

to ascii, then write NC_CHAR if possible.
# try to convert to ascii string, write as NC_CHAR
# else it's a unicode string, write as NC_STRING (if NETCDF4)
try:
if force_ncstring: raise UnicodeDecodeError("",b"",1,1,"")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this strange argument here to UnicodeDecodeError?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because UnicodeDecodeError has 5 mandatory args

https://coderwall.com/p/stzy9w/raising-unicodeencodeerror-and-unicodedecodeerror-manually-for-testing-purposes

that all have to be specified to raise it manually.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to UnicodeError, which doesn't require args.

jswhit added a commit that referenced this pull request Mar 1, 2016
try to write all attributes as NC_CHAR (issue #529)
@jswhit jswhit merged commit b980965 into master Mar 1, 2016
@jswhit jswhit deleted the attwrite_char branch March 1, 2016 19:25
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.

2 participants