econchick / new-coder

New Coder tutorials
zlib License
597 stars 394 forks source link

json problem in api.py #205

Open matthewboman opened 8 years ago

matthewboman commented 8 years ago

When I try to run the program, I get this error:

RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
  File "api.py", line 33, in <module>
    import matplotlib.pyplot as plt
  File "/home/crash/TestEnv/venv/local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 27, in <module>
    import matplotlib.colorbar
  File "/home/crash/TestEnv/venv/local/lib/python2.7/site-packages/matplotlib/colorbar.py", line 32, in <module>
    import matplotlib.artist as martist
  File "/home/crash/TestEnv/venv/local/lib/python2.7/site-packages/matplotlib/artist.py", line 12, in <module>
    from .transforms import Bbox, IdentityTransform, TransformedBbox, \
  File "/home/crash/TestEnv/venv/local/lib/python2.7/site-packages/matplotlib/transforms.py", line 39, in <module>
    from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: numpy.core.multiarray failed to import

I then tried to update numpy to the most recent version, which leads to this error:

    Traceback (most recent call last):
  File "api.py", line 340, in <module>
    if __name__ == '__main__': main()
  File "api.py", line 286, in main
    opts = parse_args()
  File "api.py", line 274, in parse_args
    help='Path to the PNG file which should contain the data output')
  File "/usr/lib/python2.7/argparse.py", line 1297, in add_argument
    return self._add_action(action)
  File "/usr/lib/python2.7/argparse.py", line 1671, in _add_action
    self._optionals._add_action(action)
  File "/usr/lib/python2.7/argparse.py", line 1498, in _add_action
    action = super(_ArgumentGroup, self)._add_action(action)
  File "/usr/lib/python2.7/argparse.py", line 1311, in _add_action
    self._check_conflict(action)
  File "/usr/lib/python2.7/argparse.py", line 1449, in _check_conflict
    conflict_handler(action, confl_optionals)
  File "/usr/lib/python2.7/argparse.py", line 1456, in _handle_conflict_error
    raise ArgumentError(action, message % conflict_string)
argparse.ArgumentError: argument --plot-file: conflicting option string(s): --plot-file

I tried it using my code, and then I tried it using the code on here, but either way I get the same issue.

joshuamsmith commented 7 years ago

Looks like you might have added the "--plot-file" option twice via add_argument method. See the same error explained here: https://docs.python.org/2/library/argparse.html#conflict-handler