looker-open-source / henry

A command line tool for Looker instance cleanup
MIT License
79 stars 27 forks source link

Getting parser error #46

Open makhai88 opened 3 years ago

makhai88 commented 3 years ago

I created a .ini file with credential to access looker. But i am getting this error when executed on Linux Terminal.

File "/usr/lib/python3/dist-packages/yaml/parser.py", line 171, in parse_document_start
    raise ParserError(None, None,
yaml.parser.ParserError: expected '<document start>', but found '<scalar>'

in "/home/user/looker.ini", line 2, column 1

here is the .ini file, please help me to fix the issue, i am not a programmer, hence need more help solving this issue

[Looker]
base_url=https://looker.company.de
client_id=sxxxxxxxxxxxxx
client_secret=Jxxxxxxxxxxxxxxx
verify_ssl=True
[Production]
base_url=https://looker.company.de
client_id=sxxxxxx
client_secret=Jxxxxxxxxxxxxxx
verify_ssl=True
makhai88 commented 3 years ago

@josephaxisa can you help? @whscullin

josephaxisa commented 3 years ago

@makhai88 that ini file seems valid. Could you show the full stack trace please? What's command are you using in the terminal?

makhai88 commented 3 years ago

@josephaxisa henry pulse --path /home/lahiru/looker.ini

Here is the full error massage.

Traceback (most recent call last):
  File "/home/lahiru/.local/bin/henry", line 8, in <module>
    sys.exit(main())
  File "/home/lahiru/.local/lib/python3.8/site-packages/henry/cli.py", line 281, in main
    looker = authenticate(timeout, session_info, config_path, **auth_args)
  File "/home/lahiru/.local/lib/python3.8/site-packages/henry/modules/auth.py", line 35, in authenticate
    params = yaml.safe_load(f)
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 162, in safe_load
    return load(stream, SafeLoader)
  File "/usr/lib/python3/dist-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/usr/lib/python3/dist-packages/yaml/constructor.py", line 49, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python3/dist-packages/yaml/composer.py", line 39, in get_single_node
    if not self.check_event(StreamEndEvent):
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib/python3/dist-packages/yaml/parser.py", line 171, in parse_document_start
    raise ParserError(None, None,
yaml.parser.ParserError: expected '<document start>', but found '<scalar>'
  in "/home/lahiru/looker.ini", line 2, column 1
josephaxisa commented 3 years ago

@makhai88 you need to upgrade henry. Ini files weren't supported in older versions.

makhai88 commented 3 years ago

@josephaxisa i upgrade using following command pip3 install --upgrade henry

I ran henry command after. But still get the same error.

If i am wrong please give me the command also.

makhai88 commented 3 years ago

henry pulse --host=company.looker.com --client_id=sxxxxxx --client_secret=Jxxxxx

if i use the above command, i get following error

Traceback (most recent call last):
  File "/home/user/.local/bin/henry", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.8/site-packages/henry/cli.py", line 281, in main
    looker = authenticate(timeout, session_info, config_path, **auth_args)
  File "/home/user/.local/lib/python3.8/site-packages/henry/modules/auth.py", line 58, in authenticate
    looker = LookerApi(host=host,
  File "/home/user/.local/lib/python3.8/site-packages/henry/modules/lookerapi.py", line 25, in __init__
    self.auth()
  File "/home/user/.local/lib/python3.8/site-packages/henry/modules/lookerapi.py", line 35, in auth
    access_token = r.json().get('access_token')
  File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
josephaxisa commented 3 years ago

@makhai88 try pip list | grep henry to confirm that you are on 0.2.3.

You are using Python 3.8 and it requires Python <3.8 to install, that is why it's not installing the latest when upgrading. I suspect it's installing a version where there was no version upper bound. You can download pyenv to manage your python versions, which will allow you to install 3.7.6 very easily and that will in turn allow you to install henry v0.2.3

makhai88 commented 3 years ago

pip3 install -U henry

this is what i got after running above

Requirement already up-to-date: henry in ./.local/lib/python3.8/site-packages (0.1.3)
Requirement already satisfied, skipping upgrade: pyyaml in /usr/lib/python3/dist-packages (from henry) (5.3.1)
Requirement already satisfied, skipping upgrade: requests in /usr/lib/python3/dist-packages (from henry) (2.22.0)
Requirement already satisfied, skipping upgrade: tqdm in ./.local/lib/python3.8/site-packages (from henry) (4.60.0)
Requirement already satisfied, skipping upgrade: tabulate in ./.local/lib/python3.8/site-packages (from henry) (0.8.9)
josephaxisa commented 3 years ago

Yeah, please see my comment above. That's exactly what's going on