# Cannot find getCmd in pysnmp.hlapi

**URL:** <https://discuss.python.org/t/cannot-find-getcmd-in-pysnmp-hlapi/63469>\
**Category:** Python Help\
**Created:** [September 10, 2024, 11:15am UTC](https://discuss.python.org/t/cannot-find-getcmd-in-pysnmp-hlapi/63469 "2024-09-10T11:15:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![woodk](https://avatars.discourse-cdn.com/v4/letter/w/aeb1de/32.png) [@woodk](https://discuss.python.org/u/woodk)\
**Post date:** [September 10, 2024, 11:15am UTC](https://discuss.python.org/t/cannot-find-getcmd-in-pysnmp-hlapi/63469/1 "2024-09-10T11:15:36Z")

</div>

Dear All,

I tried to start simple program by using pysnmp, however I cannot find the getCmd(even other functions) in the library.

My Python version is 3.12.6 with pysnmp 7.0.3(Tried to downgrade to 3.11.9 and pysnmp 4.x.x.x. but still cannot)

**init**.py is only 1kB not sure is normal or not

Delete and re-install the program result is the same.

Thank you for your help in advance.

Below it the error message.  
(myenv) c:\>python  
Python 3.12.6 (tags/v3.12.6:a4a2d2b, Sep 6 2024, 20:11:23) [MSC v.1940 64 bit (AMD64)] on win32  
Type “help”, “copyright”, “credits” or “license” for more information.

> > > from pysnmp.hlapi import getCmd, SnmpEngine, CommunityData, UdpTransportTarget, ContextData, ObjectType, ObjectIdentity  
> > > Traceback (most recent call last):  
> > > File “”, line 1, in   
> > > ImportError: cannot import name ‘getCmd’ from ‘pysnmp.hlapi’ (unknown location)

---

<div class="post-metadata">

**Author:** ![Sakepl88](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/sakepl88/32/22871_2.png) [@Sakepl88](https://discuss.python.org/u/Sakepl88)\
**Post date:** [October 1, 2024, 3:03pm UTC](https://discuss.python.org/t/cannot-find-getcmd-in-pysnmp-hlapi/63469/2 "2024-10-01T15:03:54Z")

</div>

have the same issue… im testing at school SNMP commands, and when i try to run script ist getting issue with getCmd and hlapi

---

<div class="post-metadata">

**Author:** ![woodk](https://avatars.discourse-cdn.com/v4/letter/w/aeb1de/32.png) [@woodk](https://discuss.python.org/u/woodk)\
**Post date:** [October 11, 2024, 3:13am UTC](https://discuss.python.org/t/cannot-find-getcmd-in-pysnmp-hlapi/63469/3 "2024-10-11T03:13:35Z")

</div>

Finally I can use getcmd by referring to  
[https://docs.lextudio.com/pysnmp/v7.1/docs/hlapi/v1arch/asyncio/manager/cmdgen/getcmd#pysnmp.hlapi.v1arch.asyncio.getCmd](https://docs.lextudio.com/pysnmp/v7.1/docs/hlapi/v1arch/asyncio/manager/cmdgen/getcmd#pysnmp.hlapi.v1arch.asyncio.getCmd)

You need to use below

from pysnmp.hlapi.v3arch.asyncio import \*  
Or  
from pysnmp.hlapi.v1arch.asyncio import\*

And beware that bulkget is exclusive for SNMP v2c and v3

---

<div class="post-metadata">

**Author:** ![leeren2002](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/leeren2002/32/24685_2.png) [@leeren2002](https://discuss.python.org/u/leeren2002)\
**Post date:** [December 20, 2024, 1:58pm UTC](https://discuss.python.org/t/cannot-find-getcmd-in-pysnmp-hlapi/63469/4 "2024-12-20T13:58:26Z")

</div>

Because in pysnmp7, getCmd is deprecated and replaced by get\_cmd\set\_cmd, etc.
