m110 / grafcli

Grafana CLI for quick and easy dashboards management.
MIT License
168 stars 20 forks source link

Getting "TypeError:" on backup with grafana3 #6

Closed ddes closed 8 years ago

ddes commented 8 years ago

Hi,

First of all, thanks for your work, it's a great tool.

Any chance to be compatible with grafana 3 ?

Worked very well with previous version but since grafana3 I get:

TypeError: the JSON object must be str, not 'bytes'

When trying to run a backup command.

The full trace:

Traceback (most recent call last): File "/usr/local/bin/grafcli", line 27, in <module> sys.exit(main()) File "/usr/local/bin/grafcli", line 22, in main cli.run() File "/usr/local/lib/python3.4/dist-packages/climb/core.py", line 55, in run result = self.execute(*shlex.split(command)) File "/usr/local/lib/python3.4/dist-packages/climb/core.py", line 73, in execute return self._commands.execute(command, **kwargs) File "/usr/local/lib/python3.4/dist-packages/climb/commands.py", line 26, in execute return method(*args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/grafcli/commands.py", line 173, in backup self.file_export(doc_path, file_path) File "/usr/local/lib/python3.4/dist-packages/grafcli/commands.py", line 204, in file_export document = self._resources.get(path) File "/usr/local/lib/python3.4/dist-packages/grafcli/resources/resources.py", line 46, in get return manager.get(*parts) File "/usr/local/lib/python3.4/dist-packages/grafcli/resources/common.py", line 33, in get dashboard = self._storage.get(dashboard_name) File "/usr/local/lib/python3.4/dist-packages/grafcli/storage/sql.py", line 70, in get source = json.loads(result[0][0]) File "/usr/lib/python3.4/json/__init__.py", line 312, in loads s.__class__.__name__)) TypeError: the JSON object must be str, not 'bytes'

Thanks for any help

m110 commented 8 years ago

Hey, thanks for the report! I'll look into it and grafana 3 compatibility in general.

ddes commented 8 years ago

Thank you !

I'll be happy to test and give feedback

m110 commented 8 years ago

@ddes Alright, it seems to be working fine now! Please just open another issue if you find something broken or have any suggestions. :)