cityofaustin / knackpy

A Python client for interacting with Knack applications
https://cityofaustin.github.io/knackpy/docs/user-guide/
Other
39 stars 18 forks source link

TypeError: string indices must be integers #98

Closed elrezad closed 2 years ago

elrezad commented 2 years ago

Hi! Since last Friday I'm having an error when running records=app.get('object_8')

throwing this: `File "/usr/local/lib/python3.7/dist-packages/knackpy/formatters.py", line 118, in identifiers = [conn["identifier"] for conn in value] TypeError: string indices must be integers'

I'm able to get other objects (much smallers, the one that is giving problem has 8.5k records x 25 columns), so the problem should be on that db. Any suggestions of where or what should I look for?

Thanks

johnclary commented 2 years ago

@elrezad sorry to hear of your error. I believe you've encountered a bug. Would you be able to provide your app ID, or at least copy/paste the object_8 field list from the knack explorer output?

brandontoups commented 2 years ago

Hey @johnclary, this isn't my issue but I believe I've been able to repro this for one of our apps.

For us, it had to do with aa random string of characters in one of our _raw fields (I have raised this issue internally with Knack as well, but just wanted to let you know).

The specifics are as follows:

When knackpy pulls this record down and begins looping through each fields' formatters,

I will let you know what I hear back from Knack about this, as it's really upstream of knackpy. If you'd like me to raise a PR anyways for

-         identifiers = [conn["identifier"] for conn in value]
+         identifiers = [conn["identifier"] for conn in value if "identifier" in conn]

let me know.

App-specific output for that app:

Connections

Retailer | object_39 | field_457 | outbound | one | many

Fields

Retailer | field_457 | connection