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

Error using recordclass module in Array.py #14

Open
JMCanning78 opened this issue Jan 7, 2020 · 1 comment
Open

Error using recordclass module in Array.py #14

JMCanning78 opened this issue Jan 7, 2020 · 1 comment

Comments

@JMCanning78
Copy link
Contributor

The Array.py source code imports the recordclass module. When I used
pip3 install recordclass
to install the Python 3 version, I got recordclass-0.12.0.1
When I run the visualization, however, I get this traceback:

Traceback (most recent call last):
  File "Array.py", line 25, in <module>
    class Array(object):
  File "Array.py", line 27, in Array
    Element.__new__.__defaults__ = (None,) * len(Element._fields)
AttributeError: type object 'Element' has no attribute '_fields'

This code is trying to set the default values for the record fields when a new class instance is built. The Python 3 version uses a different name for the "fields" attribute. Rewriting the line as:

Element.__new__.__defaults__ = (None,) * len(Element.__fields__)

works. I'm not sure if that's backwards compatible with Python 2.*.

@JMCanning78
Copy link
Contributor Author

See pull request #15 for fixes.

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

No branches or pull requests

1 participant