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

AttributeError: 'NoneType' object has no attribute 'col' #51

Closed
klieret opened this issue Nov 30, 2020 · 5 comments
Closed

AttributeError: 'NoneType' object has no attribute 'col' #51

klieret opened this issue Nov 30, 2020 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@klieret
Copy link
Owner

klieret commented Nov 30, 2020

As reported by @CalculusAce in #42

In the pervious version, I was able to merge the notes tables into the card table after expanding the fields in the note table with fields as columns. In the current build, I am now unable to merge the field columns into the cards table, which is critical for an app I am developing. Here is the code I was using successfully in the previous version that no longer works in the current build.

collect = Collection()
cards = collect.cards
notes = collect.notes
notes.fields_as_columns(inplace=True)
field_cols = [col for col in notes.columns if 'nfld' in col]
cards.merge_notes(inplace=True,columns=field_cols+['nmodel','ntags','nid'])

I get the following error after upgrading to the latest version of ankipandas that you released this morning:

"ankidf.py", line 459, in merge_notes
    setattr(ret, md, getattr(self, md))

AttributeError: 'NoneType' object has no attribute 'col'
@klieret klieret added the bug Something isn't working label Nov 30, 2020
@klieret klieret self-assigned this Nov 30, 2020
@klieret
Copy link
Owner Author

klieret commented Nov 30, 2020

Ah, I see the issue. For a quick workaround, if you drop the inplace=True in your last line, I think it will work.

@klieret
Copy link
Owner Author

klieret commented Nov 30, 2020

I will try to push a fix today

@klieret
Copy link
Owner Author

klieret commented Dec 6, 2020

Sorry, it took me some time to get to this. This should be fixed now.

@klieret
Copy link
Owner Author

klieret commented Dec 6, 2020

Thanks again for your report! Let me know if this work.

Note: I still need to release the package before you can update the normal way.

@klieret
Copy link
Owner Author

klieret commented Dec 6, 2020

Published

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant