Opened 5 years ago

Closed 5 years ago

#15193 closed (invalid)

string indices must be integers, not str during YAML deserialization

Reported by: Jack Owned by: nobody
Component: Core (Other) Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by russellm)

Problem installing fixture 'data\init.yaml': Traceback (most recent call last):
  File "C:\Python26\lib\site-packages\django\core\management\commands\loaddata.p
y", line 169, in handle
    for obj in objects:
  File "C:\Python26\lib\site-packages\django\core\serializers\", line 5
9, in Deserializer
    for obj in PythonDeserializer(objs, **options):
  File "C:\Python26\lib\site-packages\django\core\serializers\", line 8
4, in Deserializer
    Model = _get_model(d["model"])
TypeError: string indices must be integers, not str

I made the following change to and it fixed the problem:

def Deserializer(stream_or_string, **options):
    Deserialize a stream or string of YAML data.
    if isinstance(stream_or_string, basestring):
        stream = StringIO(stream_or_string)
        stream = stream_or_string
    for obj in PythonDeserializer(yaml.load(stream), **options):
        yield obj

I'm running Windows XP SP3 with this version of pyyaml:

Change History (2)

comment:1 Changed 5 years ago by Jack

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Sorry, I realized that I can't use ''' inside code snippet, please disregard it around:

comment:2 Changed 5 years ago by russellm

  • Description modified (diff)
  • Resolution set to invalid
  • Status changed from new to closed

Marking invalid -- report doesn't give any indication of *why* the proposed change is required, other than apparent abiility of the reporter to generate a stack trace.

In order for a bug report to be useful, you need to give us the ability to reproduce a problem. That means a complete set of instructions that would allow someone else to reproduce the problem.

If you care to provide such instructions, please repoen this ticket with those details.

Note: See TracTickets for help on using tickets.
Back to Top