SNMP support for Python under Windows

Discussion in 'Python' started by WIWA, Jul 9, 2003.

  1. WIWA

    WIWA Guest

    I'm looking for SNMP support in Python. I have found pySNMP, but I'm
    not sure whether this works under Windows as well. A few questions:

    1) Where do I need to install the pySNMP files?
    2) What do I have to do in order to be able to write somethin like:
    "from pysnmp import session"

    Thakns in advance for all input
    WIWA, Jul 9, 2003
    #1
    1. Advertising

  2. WIWA

    Peter Hansen Guest

    WIWA wrote:
    >
    > I'm looking for SNMP support in Python. I have found pySNMP, but I'm
    > not sure whether this works under Windows as well.


    Yes, it does.

    > A few questions:
    >
    > 1) Where do I need to install the pySNMP files?


    Doesn't it install with distutils? If so "python setup.py --install"
    or whatever it says in the README would work. Sorry, I haven't
    installed it lately.

    If it doesn't have instructions, put the files under the
    c:/python/lib/site-packages directory.

    > 2) What do I have to do in order to be able to write somethin like:
    > "from pysnmp import session"


    Install, then type "from pysnmp import session".... ;-)

    > Thakns in advance for all input


    (If you're having troubles, please note versions and platform
    next time, for Python, PySNMP, and Windows.)

    -Peter
    Peter Hansen, Jul 9, 2003
    #2
    1. Advertising

  3. WIWA

    WIWA Guest

    Hi Peter,

    Thanks for this useful information. I tried this on my Windows2000
    system and it seems to work. I used distutils and modified the PATH
    entry. I'll check on my Windows XP machine and will let you know if I
    found any discrepancy.

    Thanks again for all your effort. I have another question, but will
    put that in a separate message on this discussion forum. Any help is
    welcome.

    - Wim

    Peter Hansen <> wrote in message news:<>...
    > WIWA wrote:
    > >
    > > I did two things, both unsuccessfull:
    > >
    > > 1) If I install the pySNMP modules under lib/site-packages and then
    > > type sth like:
    > > from pysnmp import session it gives the error message "ImportError: No
    > > module named pysnmp". The same happens if I unstall pySNMP directly
    > > under the lib directory. Installs in this context means 'copy paste'
    > > the *.py files of the pySNMP distribution.

    >
    > I misled you the first time, but have since taken another look
    > at the installation to see how it works. In order to import
    > anything from a package (roughly, a set of .py files that includes an
    > __init__.py file), you need to put those files in a directory
    > which is named for the package (e.g. pysnmp in this case) _and_
    > which is available in sys.path. (Do "import sys" and "sys.path"
    > to see the list. You probably have lib/site-packages in that
    > list, so just put all the PySNMP files under it in a folder called
    > pysnmp.)
    >
    > > - Do I need to explicitly mention in my script where pySNMP is
    > > installed?

    >
    > Not if it's in a folder called pysnmp that is itself in one of the
    > sys.path folders, or under the current folder.
    >
    > > 2) I installed distutils 1.0.2 for Windows and it installed into the
    > > Python directory. So ar so good, I think...

    >
    > Distutils is included in Python so you probably didn't need to do
    > that, and maybe shouldn't have. I'm not sure whether that will have
    > broken the standard distutils. It's repairable if it did. On my
    > Python 2.2.1 setup here, the standard distutils is v1.0.3.
    >
    > > I go to DOS prompt and go to the directory where disutils is installed
    > > and type in python setup.py install, but DOS replies:
    > > 'Python is not recognized as an internal or external command, program
    > > or batchfile".

    >
    > Now that's a different problem. You need python.exe to be findable
    > from the DOS PATH. The simplest approach might be to check the FAQ
    > entry at http://www.python.org/cgi-bin/faqw.py?req=show&file=faq08.018.htp
    >
    > As a test of the pysnmp installation, without having to change PATH
    > at all, change to the Python directory ("cd \python" or whatever)
    > and run the interactive interpreter ("python") and just type
    > "import pysnmp" to see if it works.
    >
    > > System coordinates are Windows XP. Python version is 2.2.2 and pySNMP
    > > is version 3.0.0.

    >
    > Should all be no problem, although I suspect instructions in that
    > FAQ entry may be a little light on XP advice. Let us know if you
    > see any area that could be improved so others can benefit from this
    > exchange...
    >
    > -Peter
    WIWA, Jul 10, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. somez72
    Replies:
    3
    Views:
    678
    iksrazal
    May 17, 2004
  2. Replies:
    3
    Views:
    384
    Richard Bos
    Jan 17, 2007
  3. Peter Hicks

    SNMP support

    Peter Hicks, Apr 5, 2008, in forum: Ruby
    Replies:
    0
    Views:
    85
    Peter Hicks
    Apr 5, 2008
  4. ggerke
    Replies:
    0
    Views:
    90
    ggerke
    Apr 28, 2005
  5. milaus

    SNMP module to query net-snmp

    milaus, Aug 31, 2006, in forum: Perl Misc
    Replies:
    3
    Views:
    388
    Dr.Ruud
    Aug 31, 2006
Loading...

Share This Page