These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

Error when attempting to use Eos

Author
Ligraph
The Scope
Gallente Federation
#1 - 2016-03-11 01:49:10 UTC
I have been trying to use eos to simulate fittings for a program of mine, but whenever I try to set up a JsonCacheHandler I get an error:

Traceback (most recent call last):
  File -----, line 12, in module
    SourceManager.add('tiamat', data_handler, cache_handler, make_default=True)
  File -----, line 84, in add
    cache_data = CacheGenerator().run(data_handler)
  File -----, line 78, in run
    row['table_pos'] = table_pos
TypeError: 'str' object does not support item assignment


The code in question is:


        Generate cache out of passed data.

        Required arguments:
        data_handler - data handler to use for getting data

        Return value:
        Dictionary in {entity type: [{field name: field value}]
        format
        """
        # Put all the data we need into single dictionary
        # Format, as usual, {table name: table}, where table
        # is set of rows, which are represented by frozendicts
        # {fieldName: fieldValue}. Combination of sets and
        # frozendicts is used to speed up several stages of
        # the generator.
        data = {}
        tables = {
            'invtypes': data_handler.get_invtypes,
            'invgroups': data_handler.get_invgroups,
            'dgmattribs': data_handler.get_dgmattribs,
            'dgmtypeattribs': data_handler.get_dgmtypeattribs,
            'dgmeffects': data_handler.get_dgmeffects,
            'dgmtypeeffects': data_handler.get_dgmtypeeffects,
            'dgmexpressions': data_handler.get_dgmexpressions
        }

        for tablename, method in tables.items():
            table_pos = 0
            # For faster processing of various operations,
            # freeze table rows and put them into set
            table = set()
            for row in method():
                # During  further generator stages. some of rows
                # may fall in risk groups, where all rows but one
                # need to be removed. To deterministically remove rows
                # based on position in original data, write position
                # to each row
                row['table_pos'] = table_pos
                table_pos += 1
                table.add(FrozenDict(row))
            data[tablename] = table

        # Run pre-cleanup checks, as cleaning and further stages
        # rely on some assumptions about the data
        self._checker.pre_cleanup(data)

        # Also normalize the data to make data structure
        # more consistent, and thus easier to clean properly
        self._converter.normalize(data)

        # Clean our container out of unwanted data
        self._cleaner.clean(data)

        # Verify that our data is ready for conversion
        self._checker.pre_convert(data)

        # Convert data into Eos-specific format. Here tables are
        # no longer represented by sets of frozendicts, but by
        # list of dicts
        data = self._converter.convert(data)




In particular, the line:
row['table_pos'] = table_pos


Does anyone know why this is happening and/or how to fix it?