User Activity

  • Posted a comment on merge request #6 on SpacePy

    I used exactly the code in my first comment, plus your changes elsewhere in the file, and it worked fine on 3.5. I don't have a 3.6 install that I've proven to work with the whole SpacePy stack but I really doubt that'd be an issue. I'd probably make it: if dtype is str and str is not bytes and type(A) is bytes: A = A.decode() just to make sure what's coming in really needs decoding to str. (At that point the "dtype is str" would probably be redundant.)

  • Posted a comment on merge request #6 on SpacePy

    You get exceptions indicating the bytes were not being decoded to str when you use the test for Python 3 in the form "str is not bytes" but not in the test on sys.version[0], regardless of the sense of the dtype comparison? Is this failing in a unit test so I can check? (I see that str here will always be str since it's being used more as a flag than the dtype of the actual data.)

  • Posted a comment on merge request #6 on SpacePy

    It matches the sense of the test in the PR, which I think is backwards...if dtype is str, you're going to call the decode, and str has no decode method in Python 3. There's nothing in the "str is not bytes" that causes an exception on 3.6. I think what you want is actually: if dtype is bytes and str is not bytes: A = A.decode() since that will guarantee A is str, whatever str happens to be.

  • Posted a comment on merge request #6 on SpacePy

    if dtype is str and str is not bytes: A = A.decode() as mentioned in the last PR. That's an explicit check on what we care about (the flavour of str).

  • Posted a comment on merge request #5 on SpacePy

    .decode('ascii') will also make a unicode string; that's what .decode does: converts from the Python 2 string type ('bytes' in py3k, 'str' in Python 2) to the Python 3 string type ('unicode' in Python 2, 'str' in Python 3.) If the goal is to make sure it's in a str type regardless, something like: if str is not bytes: headline = headline.decode('ascii') would do the trick (and would fail on non-ASCII characters in Python 3).

  • Posted a comment on merge request #5 on SpacePy

    The question is, what is the actual encoding of the input? Decoding from ASCII will fail if there are high characters...so it's a matter of what's in the IDL output file. Dan? (How does this "reduce verbosity"?)

  • Posted a comment on merge request #2 on SpacePy

    Superseded by #3; thanks, and will close this one.

  • Posted a comment on merge request #3 on SpacePy

    Thanks John! The rebase made it a lot easier to read and Dan's good with the pybats improvements, so I've merged.

View All

Personal Data

Username:
jnlanl
Joined:
2011-06-07 19:08:09

Projects

This is a list of open source software projects that Jonathan Niehof is associated with:

  • Project Logo SpacePy   Last Updated:

Personal Tools