Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: object of type 'int' has no len() while fetching policy #17

Open
dawiddzhafarov opened this issue Oct 30, 2023 · 3 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@dawiddzhafarov
Copy link

Hi, there seems to be a problem while trying to fetch a policy using akamai/cli with cli-cloudlets installed from it.

akamai/cli version: 1.5.5
akamai/cli-cloudlets version: 1.1.1
OS: darwin x86_64
Command: akamai cloudlets --edgerc ~/.edgerc --section <redacted> --policy <redacted>
Error message:

Found policy-id <redacted_id>, cloudlet policy <redacted name>
Traceback (most recent call last):
  File "/Users/<redacted>/.akamai-cli/src/cli-cloudlets/bin/akamai-cloudlets.py", line 1063, in <module>
    cli_status = cli(prog_name='akamai cloudlets')
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/src/cli-cloudlets/bin/akamai-cloudlets.py", line 284, in retrieve
    df = pd.DataFrame.from_dict(response.json(), orient='index')
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/pandas/core/frame.py", line 1764, in from_dict
    return cls(data, index=index, columns=columns, dtype=dtype)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/pandas/core/frame.py", line 746, in __init__
    arrays, columns, index = nested_data_to_arrays(
                             ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/pandas/core/internals/construction.py", line 510, in nested_data_to_arrays
    arrays, columns = to_arrays(data, columns, dtype=dtype)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/pandas/core/internals/construction.py", line 865, in to_arrays
    arr = _list_to_arrays(data)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/pandas/core/internals/construction.py", line 886, in _list_to_arrays
    content = lib.to_object_array(data)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pandas/_libs/lib.pyx", line 2969, in pandas._libs.lib.to_object_array
TypeError: object of type 'int' has no len()
@pwongcha pwongcha added the bug Something isn't working label Nov 1, 2023
@pwongcha pwongcha self-assigned this Nov 1, 2023
@pwongcha
Copy link
Contributor

Hi @dawiddzhafarov, can you still replicate the issue? Normally they should be a command before --policy
if you run akamai cloudlets -h, you will get a list of available commands

Technically, based on your report, you should get

Usage: akamai cloudlets [OPTIONS] COMMAND [ARGS]...
Try 'akamai cloudlets -h' for help.

Error: No such option: --policy

or can you try with akamai cloudlets, version 1.1.2 and let me know if you still got the same error.

@dawiddzhafarov
Copy link
Author

You are right that I forgot to put the command in the message, but I used it when I was executing it. The command was retrieve. The whole command looks like this:
akamai cloudlets --edgerc ~/.edgerc --section <redacted> retrieve --policy <redacted>

I reinstalled cloudlets and now using 1.1.2, but I still get the error:

Found policy-id <redacted>, cloudlet policy <redacted>
Traceback (most recent call last):
  File "/Users/<redacted>/.akamai-cli/src/cli-cloudlets/bin/akamai-cloudlets.py", line 1434, in <module>
    cli_status = cli(prog_name='akamai cloudlets')
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/src/cli-cloudlets/bin/akamai-cloudlets.py", line 326, in retrieve
    df = pd.DataFrame.from_dict(response.json(), orient='index')
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/pandas/core/frame.py", line 1764, in from_dict
    return cls(data, index=index, columns=columns, dtype=dtype)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/pandas/core/frame.py", line 746, in __init__
    arrays, columns, index = nested_data_to_arrays(
                             ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/pandas/core/internals/construction.py", line 510, in nested_data_to_arrays
    arrays, columns = to_arrays(data, columns, dtype=dtype)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/pandas/core/internals/construction.py", line 865, in to_arrays
    arr = _list_to_arrays(data)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/.akamai-cli/venv/cli-cloudlets/lib/python3.11/site-packages/pandas/core/internals/construction.py", line 886, in _list_to_arrays
    content = lib.to_object_array(data)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pandas/_libs/lib.pyx", line 2969, in pandas._libs.lib.to_object_array
TypeError: object of type 'int' has no len()

@pwongcha
Copy link
Contributor

Can you DM me on Akamai internal webex/Slack which policy and account you use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants