looker-open-source / henry

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

AttributeError: module 'looker_sdk.rtl.serialize' has no attribute 'serialize40' #78

Open rePetko opened 4 months ago

rePetko commented 4 months ago

Hi, when I run $ henry pulse I get the following error: AttributeError: module 'looker_sdk.rtl.serialize' has no attribute 'serialize40'

Here is the full tree: (Python3.7_env) pko@pko-VirtualBox:~/Desktop$ henry pulse Traceback (most recent call last): File "/home/pko/miniconda3/envs/Python3.7_env/bin/henry", line 8, in sys.exit(main()) File "/home/pko/miniconda3/envs/Python3.7_env/lib/python3.7/site-packages/henry/cli.py", line 16, in main pulse.Pulse.run(user_input) File "/home/pko/miniconda3/envs/Python3.7_env/lib/python3.7/site-packages/henry/commands/pulse.py", line 18, in run pulse = cls(user_input) File "/home/pko/miniconda3/envs/Python3.7_env/lib/python3.7/site-packages/henry/modules/fetcher.py", line 43, in init options.config_file, options.section, options.timeout File "/home/pko/miniconda3/envs/Python3.7_env/lib/python3.7/site-packages/henry/modules/fetcher.py", line 71, in configure_sdk serialize.serialize40, AttributeError: module 'looker_sdk.rtl.serialize' has no attribute 'serialize40'

I am having the following set up (run in python 3.7 environment):

`Python3.7_env) pko@pko-VirtualBox:~/Desktop$ pip list Package Version


attrs 23.2.0 cattrs 1.1.2 certifi 2022.12.7 charset-normalizer 3.3.2 exceptiongroup 1.2.0 henry 0.3.0 idna 3.6 importlib-metadata 6.7.0 looker-sdk 21.0.0 pip 22.3.1 requests 2.31.0 setuptools 65.6.3 tabulate 0.9.0 typing_extensions 4.7.1 urllib3 2.0.7 wheel 0.38.4 zipp 3.15.0 ` Also I am using .ini configuration file stored in the working folder.

Could somebody help with this error ? Thanks!

rePetko commented 4 months ago

Hi updating looker-sdk to looker_-sdk-22.4.0 resolved the issue Cheers!

vasilis-mourtakos commented 4 months ago

Hello @rePetko Which of the commands working for you? Can you please share as much info for environment as possible to maybe replicate it, i.e.

I have followed you advice and here is my env with python3.8

(looker-cleanup-py3.8) ~/codebase/looker_cleanup $ poetry show
attrs              23.2.0   Classes Without Boilerplate
cattrs             23.2.3   Composable complex class support for attrs and dataclasses.
certifi            2024.2.2 Python package for providing Mozilla's CA Bundle.
charset-normalizer 3.3.2    The Real First Universal Charset Detector. Open, modern and activel...
exceptiongroup     1.2.0    Backport of PEP 654 (exception groups)
henry              0.3.0    A Looker Cleanup Tool
idna               3.6      Internationalized Domain Names in Applications (IDNA)
looker-sdk         22.4.0   Looker REST API
requests           2.31.0   Python HTTP for Humans.
tabulate           0.9.0    Pretty-print tabular data
typing-extensions  4.9.0    Backported and Experimental Type Hints for Python 3.8+
urllib3            2.2.1    HTTP library with thread-safe connection pooling, file post, and more.

I'm trying to make it work and the pulse command is Testing connection 1/6 and never ends and the rest like analyze get some errors, like the below one and others!

(looker-cleanup-hhkCuwdM-py3.8) ~/codebase/looker_cleanup $ henry analyze projects --save --config-file=config.ini
Traceback (most recent call last):
  File "/home/vmourtakos/.cache/pypoetry/virtualenvs/looker-cleanup-hhkCuwdM-py3.8/bin/henry", line 8, in <module>
    sys.exit(main())
  File "/home/vmourtakos/.cache/pypoetry/virtualenvs/looker-cleanup-hhkCuwdM-py3.8/lib/python3.8/site-packages/henry/cli.py", line 18, in main
    analyze.Analyze.run(user_input)
  File "/home/vmourtakos/.cache/pypoetry/virtualenvs/looker-cleanup-hhkCuwdM-py3.8/lib/python3.8/site-packages/henry/commands/analyze.py", line 13, in run
    result = analyze.projects(id=user_input.project)
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/home/vmourtakos/.cache/pypoetry/virtualenvs/looker-cleanup-hhkCuwdM-py3.8/lib/python3.8/site-packages/henry/commands/analyze.py", line 35, in projects
    if "/bare_models/" in cast(str, p.git_remote_url):
TypeError: argument of type 'NoneType' is not iterable

Thanks a lot in advance!

rePetko commented 4 months ago

Hey @vasilis-mourtakos , The above error was associated with Henry's inability to connect to my Looker API. I could not get Henry to connect with python3.8 invironment. Instead, I used Python 3.7, and it is working for me as described above.   One important thing to note is that the pulse command did not work even after I finally established a connection.

After looking into the error traceback and checking the code, I discovered that there was a small error in the code. Please look Here, in line 81 the two elements in the list need to be separated by quotation marks. You will need to edit the line to look like this: fields=["dashboard.title", "query.count"],

There is another error that needs to be addressed in order to fix the vacuum, and I think the analyze commands and make them work. Please check the following thread, as pointed out by Sedosa Here 

I hope this helps !

vasilis-mourtakos commented 4 months ago

@rePetko Thank you so super much for the very detailed and specific answer! Will try them all and fingers crossed!

Thanks again!