Skip to content

Error thrown if drive filter excludes all drives #7

@chazlarson

Description

@chazlarson

I have no shared drives with BAZ in the name:

(safire-venv) ➜  safire git:(master) ✗ ./safire.py list drives BAZ
Traceback (most recent call last):
  File "./safire.py", line 701, in <module>
    main()
  File "./safire.py", line 697, in main
    fire.Fire(Commands)
  File "/opt/safire/safire-venv/lib/python3.8/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/opt/safire/safire-venv/lib/python3.8/site-packages/fire/core.py", line 466, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/opt/safire/safire-venv/lib/python3.8/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "./safire.py", line 88, in drives
    self._export(drivelist, filter, file_tag, ["id", "name"], "drives", prt)
  File "/opt/safire/safire/utils.py", line 44, in _export
    print(df[fields])
  File "/opt/safire/safire-venv/lib/python3.8/site-packages/pandas/core/frame.py", line 3464, in __getitem__
    indexer = self.loc._get_listlike_indexer(key, axis=1)[1]
  File "/opt/safire/safire-venv/lib/python3.8/site-packages/pandas/core/indexing.py", line 1314, in _get_listlike_indexer
    self._validate_read_indexer(keyarr, indexer, axis)
  File "/opt/safire/safire-venv/lib/python3.8/site-packages/pandas/core/indexing.py", line 1374, in _validate_read_indexer
    raise KeyError(f"None of [{key}] are in the [{axis_name}]")
KeyError: "None of [Index(['id', 'name'], dtype='object')] are in the [columns]"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions