pydomo - ImportError: cannot import name 'Sorting'

Options

Hi. I am Japanese.

 

I am using pydomo0.12 on Python3.6.0 & jupyter1.0.0.

As for the question, I get an ImportError of 'Sorting'.

Could you tell me how to solve this?

Thanks.

 

 

from pydomo import Domo
from pydomo.datasets import DataSetRequest, Schema, Column, ColumnType, Policy
from pydomo.datasets import PolicyFilter, FilterOperator, PolicyType,Sorting

---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-20-b1dbf454ea18> in <module>()
1 from pydomo import Domo
2 from pydomo.datasets import DataSetRequest, Schema, Column, ColumnType, Policy
----> 3 from pydomo.datasets import PolicyFilter, FilterOperator, PolicyType,Sorting
4
5 import logging

ImportError: cannot import name 'Sorting'

 

 

Comments

  • user06158
    Options

    Anyway,I solved to enter either value directly,not import Sorting.

     

    #dataset_list = list(datasets.list(sort=Sorting.NAME))

    dataset_list = list(datasets.list(sort='lastUpdated',offset=10,limit=10))

     

    If you know how to solve the import error please let me know.

  • user001021
    user001021 Domo Employee
    Options

    You are importing the Sorting class correctly, but the failure is strange. I've had trouble replicating the issue. You may want to uninstall/reinstall pydomo and make sure you use `pip3 install pydomo`, as pydomo has only been tested with Python3.

     

    Here is the import statement for the Sorting class:

     

    from pydomo.datasets import Sorting

     

    Once imported, you may use the Sorting class as an enum, with the following values:

     

    class Sorting:
    CARD_COUNT = 'cardCount'
    DEFAULT = None
    NAME = 'name'
    STATUS = 'errorState'
    UPDATED = 'lastUpdated'

    Thus, sorting by name would be "Sorting.NAME". Entering the string manually will have the same effect. 

  • user06158
    Options

    Thank you for your reply.

    I tried to uninstall/reinstall, but I got another error.

     

    Maybe,There is something wrong with my environment.
    I will create a new environment by virtualenv and try again.

     

    ---------------------------------------------------------------------------
    ModuleNotFoundError Traceback (most recent call last)
    <ipython-input-3-0a5b327573cd> in <module>()
    ----> 1 from pydomo import Domo
    2 from pydomo.datasets import DataSetRequest, Schema, Column, ColumnType, Policy
    3 #from pydomo.datasets import PolicyFilter, FilterOperator, PolicyType,Sorting
    4 from pydomo.datasets import PolicyFilter, FilterOperator, PolicyType
    5

    /home/my_username/miniconda3/lib/python3.6/site-packages/pydomo/__init__.py in <module>()
    ----> 1 from pydomo.Transport import DomoAPITransport
    2 from pydomo.datasets import DataSetClient
    3 from pydomo.groups import GroupClient
    4 from pydomo.streams import StreamClient
    5 from pydomo.users import UserClient

    /home/my_username/miniconda3/lib/python3.6/site-packages/pydomo/Transport.py in <module>()
    4 import requests
    5 import json
    ----> 6 from requests_toolbelt.utils import dump
    7
    8

    ModuleNotFoundError: No module named 'requests_toolbelt'

     

  • user001021
    user001021 Domo Employee
    Options

    Hi user06158,

     

    I added "requests_toolbelt" as a dependency to the python SDK. I made some updates on Friday and published a new version of the SDK. 

     

    To install 'requests_toolbelt, use `pip3 install requests_toolbelt`. Also, the error "ModuleNotFoundError" means a dependency is missing, and the solution is often installing the said missing module via Pip3.

This discussion has been closed.