DaylightingSociety / SocMap

Social Mapping Framework for Twitter
https://socmap.daylightingsociety.org/
BSD 3-Clause "New" or "Revised" License
18 stars 4 forks source link

Crashes during data collection #21

Closed milo-trujillo closed 6 years ago

milo-trujillo commented 6 years ago

Current behavior:

Traceback (most recent call last):
  File "./socmap.py", line 103, in <module>
06/21/18 18:28:26 Info: Beginning data collection for layer 0
    acquire.getLayers(api, options.layers, options, layer0)
  File "/Users/milo/src/SocMap/acquire.py", line 156, in getLayers
    saveUserList(options.workdir, "layer" + str(layer) + "startingUsers", set(userlist))
  File "/Users/milo/src/SocMap/acquire.py", line 129, in saveUserList
    blob = json.dumps(dictionary)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/__init__.py", line 230, in dumps
    return _default_encoder.encode(obj)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/encoder.py", line 180, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: {'USERNAME OF ACCOUNT WITH NO RETWEETS'} is not JSON serializable

Looks like there's an errant line in acquire.py that reads:

saveUserList(options.workdir, "layer" + str(layer) + "startingUsers", set(userlist))

My guess is we tried to save off a list of the users we were working with, but saveUserList expects a dictionary of src->destination. Whoops.

milo-trujillo commented 6 years ago

Fixed now, just had to pull that line of code out.