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

Representation of index variables is broken #961

Closed
guyer opened this issue Oct 3, 2023 · 0 comments · Fixed by #1013
Closed

Representation of index variables is broken #961

guyer opened this issue Oct 3, 2023 · 0 comments · Fixed by #1013

Comments

@guyer
Copy link
Member

guyer commented Oct 3, 2023

>>> import fipy as fp
>>> mesh = fp.Grid2D(nx=3, ny=4)
>>> mesh.cellCenters[0]
Traceback (most recent call last):
  File ~/mambaforge-arm/envs/fipy311/lib/python3.11/site-packages/IPython/core/formatters.py:699 in __call__
    return repr(obj)
  File ~/Documents/research/FiPy/fipy/fipy/variables/operatorVariable.py:307 in __repr__
    return self._getRepresentation()
  File ~/Documents/research/FiPy/fipy/fipy/variables/operatorVariable.py:87 in _getRepresentation
    representation = self._py3kInstructions(op=self.op, style=style, argDict=argDict, id=id, freshen=freshen)
  File ~/Documents/research/FiPy/fipy/fipy/variables/operatorVariable.py:211 in _py3kInstructions
    stack.append(stack.pop(-2) + "[" + stack.pop() + "]")
TypeError: can only concatenate str (not "int") to str

The stack.pop() needs to be wrapped in str(), or the whole thing should use f-string formatting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant