Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   SNMP support for Python under Windows (http://www.velocityreviews.com/forums/t319457-snmp-support-for-python-under-windows.html)

WIWA 07-09-2003 06:27 PM

SNMP support for Python under Windows
 
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

Peter Hansen 07-09-2003 06:59 PM

Re: SNMP support for Python under Windows
 
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

WIWA 07-10-2003 10:52 AM

Re: SNMP support for Python under Windows
 
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 <peter@engcorp.com> wrote in message news:<3F0CB4ED.C195374F@engcorp.com>...
> 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.p...=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



All times are GMT. The time now is 02:16 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.