Error: 'str' object has no attribute 'items'

Hello,

I have been trying to deploy a form I have been using since 2022, but since last week it has been returning an error Server 500 Error, checking on online ODK the error "Error: ‘str’ object has no attribute ‘items’ " , has something changed?

I have attached the form.
Participants Registration Form 1.xlsx (286.7 KB)

I’ve been digging into this today, and it appears you may have hit a regression in the new pyxform version. We just updated this in the last release, which is why you probably didnt hit it till now.

As best I can tell, the problem lies in the unfortunate circumstance that you happen to have a column called ‘media’ in your choice list (!). If you change this to, say ‘mediaXYZ’ everything is fine (of course, you then also have to change your choice_filters to match).

I also note that your initial note question (presumably to display your logo) doesn’t have any text; this will also now cause a pyxform error. So I’ve put in a stub label to make it happy. And finally, I’ve edited your label language settings slightly, otherwise you’ll get a warning about missing languages… After all this, your form deploys nicely:

Participants Registration Form 1 copy.xlsx (287.1 KB)

As I said, I believe you’ve hit a regression in pyxform such that it now misbehaves if you inadvertently happen to have a choices column called ‘media’. It probably just so happens to use this for some internal purposes, but AFAIK its not explicitly documented as a reserved word anywhere… I’m investigating further and will open a pyxform defect as appropriate - thanks for bringing it to our attention! In the mean time, hopefully just renaming your column to something else, as I have done, will get you going again.

1 Like

Hello @Xiphware

Thank you so much. It worked!!! :partying_face:

To add: Also model seems a reserved word. Maybe others too. Good idea to document this. Even, to integrate a check/error in the Online validator?

I’ve tried but I havent been able to reproduce this with ‘model’ as a column title in the choices sheet, either on Kobo Global or XLSForm Online using this form:

SimpleSelect_model.xlsx (18.2 KB)

Where are you seeing this with ‘model’ @wroos? :thinking:

But I wholly agree: any pyxform ‘reserved words’ need to be explicitly documented, with non-obscure error messages if you happen to inadvertently use them.

  • Gareth

Hi, there was some previous discussion in the forum, e.g. Online validator is clean but error message “Expecting value: line 2 column 1 (char 1)" seen when uploading an xlsform in the server - #11 by wroos.

1 Like

Thanks for the reference @wroos . This appears to be a somewhat unrelated issue - at least to the above - where using ‘model’ for a field/question name causes issues for Enketo [and I’ve confirmed still does].

But you are correct, using ‘model’ is also something of a no-no in certain form contexts. It seems to be fine for choices columns but not for field names, at least at present. We are investigating the latter.

1 Like