On Sun, Nov 1, 2015 at 9:17 AM, Erik Schnetter <schnetter@gmail.com> wrote:
I'm developing a new frontend for yt <https://bitbucket.org/eschnett/yt>. I am currently encountering this error <http://pastebin.com/EYauU1rv>.

I don't know what causes this error. The error message mentions an __init__ function, but I don't know which __init__ function this is, nor whether the problem is in the caller or the callee. I'd be grateful for any feedback.

Hi Erik,

The easiest way to debug issues like this is to use a python debugger. I prefer ipdb, which has nice integration with IPython, including tab completions. Others like pudb. There's also pdb, which is part of the python standard library.  All of these debuggers have a gdb-like command-line interface, allowing printing out backtraces, inspecting variables, and stepping through code. Both ipdb and pudb can be installed via pip.

In any case, using a debugger, you would put a breakpoint above line 371 of yt/data_objects/static_output.py by (for ipdb) inserting "import ipdb; ipdb.set_trace()". You can also add breakpoints without altering the code, but I tend to find that it's the least frictionless way to interact with python debuggers. YMMV and others might have other suggestions.

For this specific error, I would print out what self._field_info_class is. Without running the code myself and checking in a debugger, I would guess it's your frontend-specific subclass of FieldInfoContainer. In particular, it looks like your stub implementation of SimulationIOFieldInfo only takes two arguments (https://bitbucket.org/eschnett/yt/commits/7c7296f05b0b521c33067e94e00996063e43ade0#Lyt/frontends/simulationio/fields.pyT38) but it looks like the other frontends expect a signature like this:

def __init__(self, ds, field_list):

(see e.g. the Enzo frontend, https://bitbucket.org/yt_analysis/yt/src/60428e2d8aad1b87ca57ef6eb3c2fa53fed70dad/yt/frontends/enzo/fields.py?at=yt&fileviewer=file-view-default#fields.py-106)

Looking at the skeleton frontend, it looks like the bug actually originates there in the template for fields.py.  It would be an excellent first pull request to yt if you wanted to fix this bug in the skeleton frontend. You should probably do that in a separate bookmark from your Cactus frontend work so only the bugfix comes in. You would then merge with mainline yt once the bugfix to the skeleton frontend gets merged. I'd be happy to walk you through any aspect of contributing to yt if you encounter trouble or have questions.





yt-dev mailing list