NetApp / ontap-rest-python

This repository contains sample code illustrating how to access the ONTAP REST API using Python. This Repository also contains ONTAPI Usage reporting code that helps to identify ONTAPI usage in your environment using ONTAP REST APIs.
BSD 3-Clause "New" or "Revised" License
62 stars 41 forks source link

Just continuing testing more sample scripts...some obstacles. #33

Closed ashwinwriter closed 2 years ago

ashwinwriter commented 2 years ago

Hi,

Following 2 scripts gave me following errors:

[root@centos9 /]# python3.9 file_system_analytics.py --c x.x.x.x -u admin -p xxxxxx Traceback (most recent call last): File "//file_system_analytics.py", line 26, in from utils import get_key_volumes, show_svm, show_volume ImportError: cannot import name 'get_key_volumes' from 'utils' (/utils.py)

[root@centos9 /]# python3.9 nfs_setup.py -c x.x.x.x -u admin -p xxxxxx Traceback (most recent call last): File "//nfs_setup.py", line 26, in from utils import setup_connection, get_size, get_key_svms, show_svm ImportError: cannot import name 'get_key_svms' from 'utils' (/utils.py)

[root@centos9 /]# python3.9 cifs_setup.py -c x.x.x.x -u admin -p xxxxxx Traceback (most recent call last): File "//cifs_setup.py", line 160, in main() File "//cifs_setup.py", line 154, in main headers = setup_connection(args.api_user, args.api_pass) TypeError: setup_connection() missing 1 required positional argument: 'api_pass'

Thanks!

RobertBlackhart commented 2 years ago

You might be mixing scripts. There are two main directories of examples in this repo. One is rest_api and these examples use the requests library directly to make API calls to ONTAP. This rest_api directory has in it a utils.py file that contains the get_key_volumes() function that it being referred to in that first error.

The other directory is python_client_library and these examples make use of the netapp_ontap library (a NetApp published library) to make API calls. This directory has a separate utils.py file in it whose contents are a little different.

I would say, make sure you're running scripts from the right directory so that the utils that gets imported is the right one.

ashwinwriter commented 2 years ago

Thanks, Rob. Yes, I did mix it up. Please close off this ticket. I will continue testing the rest of it, thanks for your help.

On Tue, Dec 21, 2021 at 4:31 PM Robert Blackhart @.***> wrote:

You might be mixing scripts. There are two main directories of examples in this repo. One is rest_api and these examples use the requests library directly to make API calls to ONTAP. This rest_api directory has in it a utils.py file that contains the get_key_volumes() function that it being referred to in that first error.

The other directory is python_client_library and these examples make use of the netapp_ontap library (a NetApp published library) to make API calls. This directory has a separate utils.py file in it whose contents are a little different.

I would say, make sure you're running scripts from the right directory so that the utils that gets imported is the right one.

— Reply to this email directly, view it on GitHub https://github.com/NetApp/ontap-rest-python/issues/33#issuecomment-998923301, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMYKQVYEP6GLKIHWRXSAY3DUSCTW7ANCNFSM5KQQDTPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>