[yt-dev] Issue #1044: Athena parsing is broken in python3 (yt_analysis/yt)

Nathan Goldbaum issues-reply at bitbucket.org
Fri Jul 10 14:10:37 PDT 2015


New issue 1044: Athena parsing is broken in python3
https://bitbucket.org/yt_analysis/yt/issues/1044/athena-parsing-is-broken-in-python3

Nathan Goldbaum:

This can be reproduced in python3 by doing `yt load ShockCloud/id0/Cloud.0050.vtk` at the command line.

The issue occurs in the `parse_line` function in `yt/frontends/athena/data_structures.py`. Here is an abbreviated version of that function that illustrates the exact issue:


```
#!python

def parse_line(line, grid):
    # grid is a dictionary
    splitup = line.strip().split()
    # *** snip ***
    elif chk23("SCALARS") in splitup:
        field = str23(splitup[1])
        grid['read_field'] = field
        grid['read_type'] = 'scalar'
   # *** snip ***
```

Since `line` is a byte sequence, `line.strip().split()` returns a list of byte sequences. `chk23("SCALARS")` does not return a byte sequence, instead returning a unicode string in python3.

This means that grid['read_field'] never gets filled out, so the loop in `_parse_parameter_file` can never be terminated.

The fix is to be consistent in comparing bytes with bytes or strings with strings.  Since @jzuhone was the last person to look at this I'm going to assign the issue to him.

Responsible: jzuhone



More information about the yt-dev mailing list