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

An Error Occurred: {'Choices with data ... #254

Closed
FetznerJ opened this issue Apr 6, 2016 · 4 comments
Closed

An Error Occurred: {'Choices with data ... #254

FetznerJ opened this issue Apr 6, 2016 · 4 comments
Assignees

Comments

@FetznerJ
Copy link

FetznerJ commented Apr 6, 2016

I have created a new template and have used an online YAML parser to check that it validates ok. (See bottom of post for the code).

When loading this new inselect_template I created I get the following error:

**An error occurred: {'Choices with data': [u'Only OrderedDict may be used in a OrderedDicType']}**

**Traceback:**
Traceback (most recent call last):
  File "C:\Users\Lawrence\projects\inselect\inselect\gui\utils.py", line 74, in wrapper
  File "C:\Users\Lawrence\projects\inselect\inselect\gui\user_template_popup_button.py", line 72, in choose
  File "C:\Users\Lawrence\projects\inselect\inselect\gui\user_template_choice.py", line 60, in load
  File "C:\Users\Lawrence\projects\inselect\inselect\gui\user_template_choice.py", line 55, in _load
  File "C:\Users\Lawrence\projects\inselect\inselect\lib\user_template.py", line 98, in load
  File "C:\Users\Lawrence\projects\inselect\inselect\lib\user_template.py", line 103, in from_specification
  File "C:\Users\Lawrence\projects\inselect\inselect\lib\persist_user_template.py", line 257, in validated_specification
  File "C:\Users\Lawrence\Miniconda2-64\envs\inselect\lib\site-packages\schematics\models.py", line 242, in __init__
  File "C:\Users\Lawrence\Miniconda2-64\envs\inselect\lib\site-packages\schematics\models.py", line 289, in convert
  File "C:\Users\Lawrence\Miniconda2-64\envs\inselect\lib\site-packages\schematics\transforms.py", line 419, in convert
  File "C:\Users\Lawrence\Miniconda2-64\envs\inselect\lib\site-packages\schematics\transforms.py", line 119, in import_loop
ModelConversionError: {'Choices with data': [u'Only OrderedDict may be used in a OrderedDictType']}

I note that the file path listed in the traceback does not correspond to my machine. Not sure if that is the issue?? Thanks for any help you can lend on this issue.

YAML Template Code:

Name: Flea Slide Template
Thumbnail width pixels: 8192
Cropped file suffix: .jpg
Object label: '{UniqueNo}_{BNumber}_{Family}_{Country}'
Fields:
    - Name: UniqueNo
      Label: Specimen Unique Number
      Regex parser: '^[0-9]{6}$'
    - Name: BNumber
      Label: Specimen B-Number
      Regex parser: '^B[0-9]{5,6}$'
    - Name: SlideTrayNo
      Label: InvertNet Slide Tray Number
      Mandatory: true
      Regex parser: '^[0-9]{0,4}$'
    - Name: ColumnNumber
      Label: Slide tray column number, eg. 1,2
      Mandatory: true
      Regex parser: '^[1-2]{1}$'
    - Name: SlideNumber
      Label: Slide position in column, eg. '1,2,...'
      Mandatory: true
      Regex parser: '^([1-9]|10)$'
    - Name: NumberOfSpecimens
      Label: Specimens contained on slide
      Mandatory: true
      Regex parser: '^[1-9]$'
    - Name: SubPrep
      Label: Slide contains genitalia prep? Yes|No
      Mandatory: true
      Regex parser: '^(Yes|No)$'
    - Name: SpecimenSource
      Label: Original source collection of specimen
      Mandatory: true
    - Name: Country
      Label: Country of collection
      Mandatory: true
    - Name: Order
      Label: Taxonomic ordinal name
      Mandatory: true
      Choices with data:
        Siphonaptera
    - Name: Family
      Label: Taxonomic family name
      Mandatory: true
      Choices with data:
        Ancistropsyllidae
        Ceratophyllidae
        Chimaeropsyllidae
        Coptopsyllidae
        Hectopsyllidae
        Hystrichopsyllidae
        Lycopsyllidae
        Macropsyllidae
        Malacopsyllidae
        Pulicidae
        Pygiopsyllidae
        Rhopalopsyllidae
        Stephanocircidae
        Stivaliidae
        Vermipsyllidae
    - Name: Genus
      Label: Taxonomic genus name
    - Name: Species
      Label: Taxonomic species name
    - Name: Subspecies
      Label: Taxonomic subspecies name
@quicklizard99
Copy link
Member

quicklizard99 commented Apr 6, 2016

I have edited the issue so that the traceback and the YAML template are wrapped in a 'fence' - three backticks (```) at the start and end of each block - this preserves the formatting.

@quicklizard99
Copy link
Member

The template specifies that the Order and Family fields are Choices with data (lines 41 and 46) but these contain lists rather than mappings. If you want to show a drop-down list of options, change 41 and 46 to Choices. If you want to associate values with the displayed list of options then change the contents of the Choices with data blocks to be mappings e.g.,

      Choices with data:
            Ancistropsyllidae: 1
            Ceratophyllidae: 2
            Chimaeropsyllidae: 3

The error message from Inselect is cryptic. We will fix this.

@quicklizard99 quicklizard99 self-assigned this Apr 6, 2016
@FetznerJ
Copy link
Author

FetznerJ commented Apr 6, 2016

Ok, that makes sense. That for the information.

I appreciate you guys creating and maintaining this software. It will be immensely useful to the digitization community.

Cheers,
Jim

Sent from my iPhone

On Apr 6, 2016, at 1:24 PM, Lawrence Hudson <notifications@github.commailto:notifications@github.com> wrote:

The template specifies that the Order and Family fields are Choices with data (lines 41 and 46) but these contains lists rather than mappings. If you want to show a drop-down list of options, change 41 and 46 to Choices. If you want to associate values with the displayed list of options then change the contents of the Choices with data blocks to be mappings e.g.,

  Choices with data:
        Ancistropsyllidae: 1
        Ceratophyllidae: 2
        Chimaeropsyllidae: 3

The error message from Inselect is cryptic. We will fix this.

You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHubhttps://github.com//issues/254#issuecomment-206474692

The information contained in this message and/or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy any copies. Any views expressed in this message are those of the individual sender.

@quicklizard99
Copy link
Member

Great, thanks Jim - please let us know if you hit any more problems.

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

2 participants