pysnmp-dev Mailing List for SNMP library for Python (Page 6)
Brought to you by:
elie
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2004 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(6) |
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(4) |
Dec
(3) |
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(5) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(4) |
Sep
(1) |
Oct
|
Nov
(3) |
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
(1) |
Feb
(1) |
Mar
(5) |
Apr
(1) |
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
(3) |
Oct
(3) |
Nov
(1) |
Dec
|
2010 |
Jan
(2) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(4) |
Nov
(8) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(9) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
(2) |
Dec
(2) |
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
(2) |
Jun
(3) |
Jul
|
Aug
(2) |
Sep
(3) |
Oct
(3) |
Nov
(4) |
Dec
|
2015 |
Jan
|
Feb
(4) |
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
|
Aug
(11) |
Sep
(20) |
Oct
(18) |
Nov
(5) |
Dec
|
2021 |
Jan
(5) |
Feb
(11) |
Mar
(19) |
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2022 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
|
Jul
(4) |
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: Ilya E. <il...@gl...> - 2015-05-20 10:53:56
|
Hi Atilla, You are welcome to translate whatever contents on the pysnmp web site you consider useful provided you link your version back to the original. I could place a link to your translation, just let me know the URL. Keep in mind that a major web site update is coming within a few months rendering some of the materials there partly obsolete. -Ilya On 05/20/2015 12:27 PM, Atilla Debredeni wrote: > > Hello! > > My name is Atilla Debredeni, I'm a journalist from Hungary. > > I would like to translate your article > athttp://pysnmp.sourceforge.net/faq.html and > http://pysnmp.sourceforge.net/examples/current/index.html for my blog. > > So i'm asking for you to give me permission to translate it as well as > link back to my future translation, so we can generate some readers > interest to that translation and your work. I would not use it in any > commercial way. > > Thank you! > > |
From: Atilla D. <ati...@gm...> - 2015-05-20 09:28:02
|
Hello! My name is Atilla Debredeni, I'm a journalist from Hungary. I would like to translate your article at http://pysnmp.sourceforge.net/faq.html and http://pysnmp.sourceforge.net/examples/current/index.html for my blog. So i'm asking for you to give me permission to translate it as well as link back to my future translation, so we can generate some readers interest to that translation and your work. I would not use it in any commercial way. Thank you! |
From: chetan S. <che...@sy...> - 2015-04-30 14:35:18
|
Hi I tried to populate Table data by taking a reference from this link http://pysnmp.sourceforge.net/examples/current/v3arch/agent/cmdrsp/v2c-custom-tabular-mib-objects.html But i am not able to update table data in agent, so that it will send respond to incoming requests. Can anyone give a any working reference code to get a reference to populate data. Hopefully i will hear soon. -- Regards Chetan Sharma -- This message (and any associated files) is intended only for the use of the individual or entity to which it is addressed and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the intended recipient you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify Symstream Technology Group immediately by replying to the message and deleting it from your computer. Messages sent to and from us may be monitored. Internet communications cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. Therefore, we do not accept responsibility for any errors or omissions that are present in this message, or any attachment, that have arisen as a result of e-mail transmission. If verification is required, please request a hard-copy version. Any views or opinions presented are solely those of the author and do not necessarily represent those of the company. ------------------------------ |
From: Ani A <ani...@gm...> - 2015-03-29 05:30:02
|
Thanks ilya, I could try this just today, due to other priorities. So, I had to do: encoder.encode(reqMsg) and send it on another UDP port, and it worked. At the moment, I am not worried about performance, as I am prototyping this as a part of a bigger solution. Thanks again, I will get back if in case I am stuck with anything else. -- Regards, A. Aniruddha On Sat, Mar 7, 2015 at 9:11 PM, Ilya Etingof <il...@gl...> wrote: > Hi Ani, > > There’s no easy way to access *parts* of serialised message. May be you > could just decode the whole message (like you did), peek into varbinds to > select appropriate queue and then send the whole *original* SNMP > TRAP/INFORM message to a new destination (e.g. wholeMsg)? > > An alternative is to re-encode reqPDU to get serialised data just for it: > > from pyasn1.codec.ber import encoder > > rawData = encoder.encode(reqPDU) > > But that is less efficient. > > Let me know if this is not what you want. > > -ilya > > > > On 02 Mar 2015, at 15:13, Ani A <ani...@gm...> wrote: > > > > Thanks Ilya, > > > > I looked at `snmpfwd`, I think , at the moment, I don't need the full > > functionality, but rather just a small subset, for > > the trap processing. > > > > And, one more thing I feel is, in the notification forwarder, I just > > need to peek into the varbinds, and then if I > > can get just the PDU (as _data_ rather than Object), I can > > re-encapsulate it in a different UDP packet, and send > > But I don't this there is any API to get the PDU as _raw-data_ - is > > that correct ? > > > > Please see the attached code, that I have so far (I have added > > comments on what I am trying to accomplish). > > > > -- > > Regards, > > A. Aniruddha > > > > > > On Sun, Mar 1, 2015 at 1:44 AM, Ilya Etingof <il...@gl...> wrote: > >> Hi Ani, > >> > >> There’s similar app snmpfwd [1], however it does yet not support SNMP > >> notifications at the moment. > >> > >> The most straightforward way to do a proxy with pysnmp is to run both > sides > >> — Notification Receiver & Notification Originator together within a > single > >> main loop. Since pysnmp natively supports asynchronous communication, > while > >> one request is waiting for I/O, the other could be served concurrently. > But > >> two strictly simultaneous requests would queue up at shared SNMP engine > >> waiting for its services. Here’s an example script [2] that implements > SNMP > >> Commands forwarding in the above design. It could be modified to support > >> Notifications. With pysnmp API all the low-level processing and ACKs > could > >> be done automatically so you could deal with PDUs and targets. > >> > >> If you wish to use threads, you'd have to run many independent SNMP > engines > >> (and main loops) local to each thread. Take a look at this example [3] > to > >> get an idea. In case of notifications I imagine you would have the > receiving > >> parts sitting each in its own main loop waiting for incoming queries and > >> pushing received requests to a queue. The sending parts would run their > >> main loops briefly, just to push out request and optionally wait for > >> response (informs). So most of the time the sending parts would spend > >> waiting for queue to pull request from. > >> > >> From my perspective, the threading approach may give better load > >> distribution (but unlikely better throughput considering GIL which does > not > >> let you run threads truly simultaneously), however it may require more > work > >> from your side and larger memory footprint due to SNMP engine > duplication. > >> > >> The third option could be to run multiple instances of your purely > >> asynchronous proxy (receivers) to improve concurrency. > >> > >> -ilya > >> > >> [1] http://sf.net/projects/snmpfwd/ > >> [2] > >> > http://pysnmp.sourceforge.net/examples/current/v3arch/proxy/cmd/v3-to-v2c-conversion.html > >> [3] > >> > http://pysnmp.sourceforge.net/examples/current/v3arch/oneliner/manager/cmdgen/get-threaded-multiple-transports-and-protocols.html > >> > >> > >> On 27 Feb 2015, at 08:01, Ani A <ani...@gm...> wrote: > >> > >> Hi Ilya, > >> > >> I am trying to create something like a _proxy_, the goal is to be able > to > >> intercept traps from the local > >> SNMP Agent, and then peeking into the varbinds, decide which one of the > >> remote trap-receivers to send to. > >> > >> Traps are the first goal, then, for Informs, I need to be able to get > the > >> ack, and send it back to the main agent as well. > >> > >> Since I am using Multiprocessing module [1], do I still have to worry > about > >> MT safe? > >> > >> (the networking part of this, is that the receivers are all on different > >> networks > >> [ different Linux namespaces ], so I have to get the SNMP payload and > then > >> build a separate UDP packet and > >> send, unless there is an easier way/API that I can use to just change > the IP > >> and send) > >> > >> Hope I explained the problem [that I am trying to solve], clearly. Any > >> help/tips/guidance very much welcome. > >> > >> > >> [1] https://docs.python.org/2/library/multiprocessing.html > >> > >> -- > >> Ani > >> > >> > >> On Fri, Feb 27, 2015 at 1:09 AM, Ilya Etingof <il...@gl...> wrote: > >>> > >>> Hi Ani, > >>> > >>> At what point you are going to employ threading? Just for SNMP > receiving > >>> part (what is not easy since a single instance of SNMP engine is not > >>> MT-safe) or for some sort of custom processing logic beyond SNMP > engine? > >>> > >>> -ilya > >>> > >>>> On 24 Feb 2015, at 09:44, Ani A <ani...@gm...> wrote: > >>>> > >>>> Hello, > >>>> > >>>> I was running through the examples in pysnmp (for Trap receiver with > V3 > >>>> case) > >>>> and I have a few doubts (maybe trivial! but somehow I am not getting > it) > >>>> > >>>> I want to use pysnmp, with Python's Multiprocessing module, so in > >>>> each Process's callback function, do I run the following ? > >>>> > >>>> try: > >>>> snmpEngine.transportDispatcher.runDispatcher() > >>>> except: > >>>> snmpEngine.transportDispatcher.closeDispatcher() > >>>> raise > >>>> > >>>> i.e, what should my main-loop wait on? , since I have another Queue as > >>>> well > >>>> which I need to check. > >>>> > >>>> Thanks. > >>>> — > >>>> Ani > >>> > >> > >> > ------------------------------------------------------------------------------ > >> Dive into the World of Parallel Programming The Go Parallel Website, > >> sponsored > >> by Intel and developed in partnership with Slashdot Media, is your hub > for > >> all > >> things parallel software development, from weekly thought leadership > blogs > >> to > >> news, videos, case studies, tutorials and more. Take a look and join the > >> conversation now. > >> > http://goparallel.sourceforge.net/_______________________________________________ > >> pysnmp-dev mailing list > >> pys...@li... > >> https://lists.sourceforge.net/lists/listinfo/pysnmp-dev > >> > >> > > <snmpp.py> > > |
From: Ilya E. <il...@gl...> - 2015-03-07 15:50:15
|
Hi Ani, There’s no easy way to access *parts* of serialised message. May be you could just decode the whole message (like you did), peek into varbinds to select appropriate queue and then send the whole *original* SNMP TRAP/INFORM message to a new destination (e.g. wholeMsg)? An alternative is to re-encode reqPDU to get serialised data just for it: from pyasn1.codec.ber import encoder rawData = encoder.encode(reqPDU) But that is less efficient. Let me know if this is not what you want. -ilya > On 02 Mar 2015, at 15:13, Ani A <ani...@gm...> wrote: > > Thanks Ilya, > > I looked at `snmpfwd`, I think , at the moment, I don't need the full > functionality, but rather just a small subset, for > the trap processing. > > And, one more thing I feel is, in the notification forwarder, I just > need to peek into the varbinds, and then if I > can get just the PDU (as _data_ rather than Object), I can > re-encapsulate it in a different UDP packet, and send > But I don't this there is any API to get the PDU as _raw-data_ - is > that correct ? > > Please see the attached code, that I have so far (I have added > comments on what I am trying to accomplish). > > -- > Regards, > A. Aniruddha > > > On Sun, Mar 1, 2015 at 1:44 AM, Ilya Etingof <il...@gl...> wrote: >> Hi Ani, >> >> There’s similar app snmpfwd [1], however it does yet not support SNMP >> notifications at the moment. >> >> The most straightforward way to do a proxy with pysnmp is to run both sides >> — Notification Receiver & Notification Originator together within a single >> main loop. Since pysnmp natively supports asynchronous communication, while >> one request is waiting for I/O, the other could be served concurrently. But >> two strictly simultaneous requests would queue up at shared SNMP engine >> waiting for its services. Here’s an example script [2] that implements SNMP >> Commands forwarding in the above design. It could be modified to support >> Notifications. With pysnmp API all the low-level processing and ACKs could >> be done automatically so you could deal with PDUs and targets. >> >> If you wish to use threads, you'd have to run many independent SNMP engines >> (and main loops) local to each thread. Take a look at this example [3] to >> get an idea. In case of notifications I imagine you would have the receiving >> parts sitting each in its own main loop waiting for incoming queries and >> pushing received requests to a queue. The sending parts would run their >> main loops briefly, just to push out request and optionally wait for >> response (informs). So most of the time the sending parts would spend >> waiting for queue to pull request from. >> >> From my perspective, the threading approach may give better load >> distribution (but unlikely better throughput considering GIL which does not >> let you run threads truly simultaneously), however it may require more work >> from your side and larger memory footprint due to SNMP engine duplication. >> >> The third option could be to run multiple instances of your purely >> asynchronous proxy (receivers) to improve concurrency. >> >> -ilya >> >> [1] http://sf.net/projects/snmpfwd/ >> [2] >> http://pysnmp.sourceforge.net/examples/current/v3arch/proxy/cmd/v3-to-v2c-conversion.html >> [3] >> http://pysnmp.sourceforge.net/examples/current/v3arch/oneliner/manager/cmdgen/get-threaded-multiple-transports-and-protocols.html >> >> >> On 27 Feb 2015, at 08:01, Ani A <ani...@gm...> wrote: >> >> Hi Ilya, >> >> I am trying to create something like a _proxy_, the goal is to be able to >> intercept traps from the local >> SNMP Agent, and then peeking into the varbinds, decide which one of the >> remote trap-receivers to send to. >> >> Traps are the first goal, then, for Informs, I need to be able to get the >> ack, and send it back to the main agent as well. >> >> Since I am using Multiprocessing module [1], do I still have to worry about >> MT safe? >> >> (the networking part of this, is that the receivers are all on different >> networks >> [ different Linux namespaces ], so I have to get the SNMP payload and then >> build a separate UDP packet and >> send, unless there is an easier way/API that I can use to just change the IP >> and send) >> >> Hope I explained the problem [that I am trying to solve], clearly. Any >> help/tips/guidance very much welcome. >> >> >> [1] https://docs.python.org/2/library/multiprocessing.html >> >> -- >> Ani >> >> >> On Fri, Feb 27, 2015 at 1:09 AM, Ilya Etingof <il...@gl...> wrote: >>> >>> Hi Ani, >>> >>> At what point you are going to employ threading? Just for SNMP receiving >>> part (what is not easy since a single instance of SNMP engine is not >>> MT-safe) or for some sort of custom processing logic beyond SNMP engine? >>> >>> -ilya >>> >>>> On 24 Feb 2015, at 09:44, Ani A <ani...@gm...> wrote: >>>> >>>> Hello, >>>> >>>> I was running through the examples in pysnmp (for Trap receiver with V3 >>>> case) >>>> and I have a few doubts (maybe trivial! but somehow I am not getting it) >>>> >>>> I want to use pysnmp, with Python's Multiprocessing module, so in >>>> each Process's callback function, do I run the following ? >>>> >>>> try: >>>> snmpEngine.transportDispatcher.runDispatcher() >>>> except: >>>> snmpEngine.transportDispatcher.closeDispatcher() >>>> raise >>>> >>>> i.e, what should my main-loop wait on? , since I have another Queue as >>>> well >>>> which I need to check. >>>> >>>> Thanks. >>>> — >>>> Ani >>> >> >> ------------------------------------------------------------------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, >> sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub for >> all >> things parallel software development, from weekly thought leadership blogs >> to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. >> http://goparallel.sourceforge.net/_______________________________________________ >> pysnmp-dev mailing list >> pys...@li... >> https://lists.sourceforge.net/lists/listinfo/pysnmp-dev >> >> > <snmpp.py> |
From: Ilya E. <il...@gl...> - 2015-02-28 20:15:06
|
Hi Ani, There’s similar app snmpfwd [1], however it does yet not support SNMP notifications at the moment. The most straightforward way to do a proxy with pysnmp is to run both sides — Notification Receiver & Notification Originator together within a single main loop. Since pysnmp natively supports asynchronous communication, while one request is waiting for I/O, the other could be served concurrently. But two strictly simultaneous requests would queue up at shared SNMP engine waiting for its services. Here’s an example script [2] that implements SNMP Commands forwarding in the above design. It could be modified to support Notifications. With pysnmp API all the low-level processing and ACKs could be done automatically so you could deal with PDUs and targets. If you wish to use threads, you'd have to run many independent SNMP engines (and main loops) local to each thread. Take a look at this example [3] to get an idea. In case of notifications I imagine you would have the receiving parts sitting each in its own main loop waiting for incoming queries and pushing received requests to a queue. The sending parts would run their main loops briefly, just to push out request and optionally wait for response (informs). So most of the time the sending parts would spend waiting for queue to pull request from. From my perspective, the threading approach may give better load distribution (but unlikely better throughput considering GIL which does not let you run threads truly simultaneously), however it may require more work from your side and larger memory footprint due to SNMP engine duplication. The third option could be to run multiple instances of your purely asynchronous proxy (receivers) to improve concurrency. -ilya [1] http://sf.net/projects/snmpfwd/ <http://sf.net/projects/snmpfwd/> [2] http://pysnmp.sourceforge.net/examples/current/v3arch/proxy/cmd/v3-to-v2c-conversion.html <http://pysnmp.sourceforge.net/examples/current/v3arch/proxy/cmd/v3-to-v2c-conversion.html> [3] http://pysnmp.sourceforge.net/examples/current/v3arch/oneliner/manager/cmdgen/get-threaded-multiple-transports-and-protocols.html <http://pysnmp.sourceforge.net/examples/current/v3arch/oneliner/manager/cmdgen/get-threaded-multiple-transports-and-protocols.html> > On 27 Feb 2015, at 08:01, Ani A <ani...@gm...> wrote: > > Hi Ilya, > > I am trying to create something like a _proxy_, the goal is to be able to intercept traps from the local > SNMP Agent, and then peeking into the varbinds, decide which one of the remote trap-receivers to send to. > > Traps are the first goal, then, for Informs, I need to be able to get the ack, and send it back to the main agent as well. > > Since I am using Multiprocessing module [1], do I still have to worry about MT safe? > > (the networking part of this, is that the receivers are all on different networks > [ different Linux namespaces ], so I have to get the SNMP payload and then build a separate UDP packet and > send, unless there is an easier way/API that I can use to just change the IP and send) > > Hope I explained the problem [that I am trying to solve], clearly. Any help/tips/guidance very much welcome. > > > [1] https://docs.python.org/2/library/multiprocessing.html <https://docs.python.org/2/library/multiprocessing.html> > > -- > Ani > > > On Fri, Feb 27, 2015 at 1:09 AM, Ilya Etingof <il...@gl... <mailto:il...@gl...>> wrote: > Hi Ani, > > At what point you are going to employ threading? Just for SNMP receiving part (what is not easy since a single instance of SNMP engine is not MT-safe) or for some sort of custom processing logic beyond SNMP engine? > > -ilya > > > On 24 Feb 2015, at 09:44, Ani A <ani...@gm... <mailto:ani...@gm...>> wrote: > > > > Hello, > > > > I was running through the examples in pysnmp (for Trap receiver with V3 case) > > and I have a few doubts (maybe trivial! but somehow I am not getting it) > > > > I want to use pysnmp, with Python's Multiprocessing module, so in > > each Process's callback function, do I run the following ? > > > > try: > > snmpEngine.transportDispatcher.runDispatcher() > > except: > > snmpEngine.transportDispatcher.closeDispatcher() > > raise > > > > i.e, what should my main-loop wait on? , since I have another Queue as well > > which I need to check. > > > > Thanks. > > — > > Ani > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/_______________________________________________ > pysnmp-dev mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysnmp-dev |
From: Ani A <ani...@gm...> - 2015-02-27 05:01:38
|
Hi Ilya, I am trying to create something like a _proxy_, the goal is to be able to intercept traps from the local SNMP Agent, and then peeking into the varbinds, decide which one of the remote trap-receivers to send to. Traps are the first goal, then, for Informs, I need to be able to get the ack, and send it back to the main agent as well. Since I am using Multiprocessing module [1], do I still have to worry about MT safe? (the networking part of this, is that the receivers are all on different networks [ different Linux namespaces ], so I have to get the SNMP payload and then build a separate UDP packet and send, unless there is an easier way/API that I can use to just change the IP and send) Hope I explained the problem [that I am trying to solve], clearly. Any help/tips/guidance very much welcome. [1] https://docs.python.org/2/library/multiprocessing.html -- Ani On Fri, Feb 27, 2015 at 1:09 AM, Ilya Etingof <il...@gl...> wrote: > Hi Ani, > > At what point you are going to employ threading? Just for SNMP receiving > part (what is not easy since a single instance of SNMP engine is not > MT-safe) or for some sort of custom processing logic beyond SNMP engine? > > -ilya > > > On 24 Feb 2015, at 09:44, Ani A <ani...@gm...> wrote: > > > > Hello, > > > > I was running through the examples in pysnmp (for Trap receiver with V3 > case) > > and I have a few doubts (maybe trivial! but somehow I am not getting it) > > > > I want to use pysnmp, with Python's Multiprocessing module, so in > > each Process's callback function, do I run the following ? > > > > try: > > snmpEngine.transportDispatcher.runDispatcher() > > except: > > snmpEngine.transportDispatcher.closeDispatcher() > > raise > > > > i.e, what should my main-loop wait on? , since I have another Queue as > well > > which I need to check. > > > > Thanks. > > — > > Ani > > |
From: Ilya E. <il...@gl...> - 2015-02-26 19:39:16
|
Hi Ani, At what point you are going to employ threading? Just for SNMP receiving part (what is not easy since a single instance of SNMP engine is not MT-safe) or for some sort of custom processing logic beyond SNMP engine? -ilya > On 24 Feb 2015, at 09:44, Ani A <ani...@gm...> wrote: > > Hello, > > I was running through the examples in pysnmp (for Trap receiver with V3 case) > and I have a few doubts (maybe trivial! but somehow I am not getting it) > > I want to use pysnmp, with Python's Multiprocessing module, so in > each Process's callback function, do I run the following ? > > try: > snmpEngine.transportDispatcher.runDispatcher() > except: > snmpEngine.transportDispatcher.closeDispatcher() > raise > > i.e, what should my main-loop wait on? , since I have another Queue as well > which I need to check. > > Thanks. > — > Ani |
From: Ani A <ani...@gm...> - 2015-02-24 06:44:43
|
Hello, I was running through the examples in pysnmp (for Trap receiver with V3 case) and I have a few doubts (maybe trivial! but somehow I am not getting it) I want to use pysnmp, with Python's Multiprocessing module, so in each Process's callback function, do I run the following ? try: snmpEngine.transportDispatcher.runDispatcher() except: snmpEngine.transportDispatcher.closeDispatcher() raise i.e, what should my main-loop wait on? , since I have another Queue as well which I need to check. Thanks. -- Ani |
From: Ilya E. <il...@gl...> - 2014-11-16 18:31:53
|
Hi Matt, I’ve fixed the bug you mention and also re-designed the whole thing a little to make it better suitable for the asyncio programming style. The latest code is here: download latest CVS snapshot <http://pysnmp.cvs.sourceforge.net/viewvc/pysnmp/pysnmp/?view=tar> and examples are here: http://pysnmp.sourceforge.net/examples/current/index.html#AsyncioSNMPv3 <http://pysnmp.sourceforge.net/examples/current/index.html#AsyncioSNMPv3> Please let me know in case of further issues/suggestions. -ilya > On 05 Nov 2014, at 02:53, Matt Hooks <me...@ma...> wrote: > > Hi Ilya, > > I haven't a chance to run the merged code in our environment just yet, but I did notice something while looking at the diff. > > In carrier/asyncio/dispatch.py, > > try: > import asyncio > except ImportError: > from pysnmp.error import PySnmpError > raise PySnmpError('The asyncio transport is not available') > > PySnmpError is still necessary when the import doesn't error out, because of line 59. > > > A big use case here is for people who have built their application on the new 3.4 event loop (like we have), and so aren't using twisted. > > This also opens up some new Python3/asyncio features, such as the "yield from" clause, similar to Twisted's inline callbacks. > > As a rather specific example, in an asyncio coroutine, a user can do something like: > > result = yield from cmdgen.GetCommandGenerator().sendVarBinds( > snmpEngine, > 'my-router', > None, '', > ( ('1.3.6.1.2.1.1.1.0', None), ), > ) > > This is probably worthy of some example documentation. > > Matt > > > On Tue, Nov 4, 2014 at 3:30 PM, Ilya Etingof <il...@gl... <mailto:il...@gl...>> wrote: > Hi Matt, > > I’ve applied your patch to pysnmp and slightly reworked it afterwards. Please, try to use pysnmp development code and let me know in case of any issues: > > download latest CVS snapshot <http://pysnmp.cvs.sourceforge.net/viewvc/pysnmp/pysnmp/?view=tar> > > Please be aware that I’ve slightly changed the API you introduced in your patch to make it more uniform with the rest of pysnmp. See examples for details. > > I’m also interested in real-world use cases of the asyncio transport to better adapt pysnmp API. > > Thanks, > ilya > >> On 01 Nov 2014, at 00:56, Matt Hooks <me...@ma... <mailto:me...@ma...>> wrote: >> >> Hi everyone, >> >> After a long internal legal delay, I can now release the attached patch. >> >> This patch enables support for the new asyncio library in Python 3, and is a near drop in replacement for the Twisted transport currently provided. >> >> We've attempted to keep the structure and design nearly identical to the Twisted implementation to further the above goal. >> >> Ilya, I'm not familiar with any preferences you have for annotating the source files with licensing info, so I went ahead and used the license off the main site. >> >> We've included some example scripts, but haven't replicated all the ones available for Twisted. >> >> >> Cheers, >> >> Matt Hooks >> <asyncio_support.patch>------------------------------------------------------------------------------ > |
From: R. D. M. <rdm...@bi...> - 2014-11-04 22:01:16
|
On Tue, 04 Nov 2014 23:30:29 +0300, Ilya Etingof <il...@gl...> wrote: > Hi Matt, > > Iâve applied your patch to pysnmp and slightly reworked it afterwards. Please, try to use pysnmp development code and let me know in case of any issues: > > download latest CVS snapshot <http://pysnmp.cvs.sourceforge.net/viewvc/pysnmp/pysnmp/?view=tar> > > Please be aware that Iâve slightly changed the API you introduced in your patch to make it more uniform with the rest of pysnmp. See examples for details. > > Iâm also interested in real-world use cases of the asyncio transport to better adapt pysnmp API. On a somewhat different note... This is not a real world example, but it does show how the asyncio API (can) differ from that of pysnmp. This is an example I got working of a simple snmpv1 'get', based on the 'low level' get example. (Instead of printing errors, it should probably use set_exception.) I'm working on incorporating a more advanced version of this technique (that will handle multiple gets) into the application I'm writing. I also created a pynsmp asyncio transport patch, but frankly I couldn't figure out how to use the sort of intermediate-level API that is shown in the examples for the Twisted transport in my own application, so I gave up on that approach. Fortunately I only need v1. ---------------------------------------------------------------------- from pyasn1.codec.ber import encoder, decoder from pysnmp.proto import api import asyncio # Protocol version to use pMod = api.protoModules[api.protoVersion1] # Build PDU reqPDU = pMod.GetRequestPDU() pMod.apiPDU.setDefaults(reqPDU) pMod.apiPDU.setVarBinds( reqPDU, ( ('1.3.6.1.2.1.1.1.0', pMod.Null('')), ('1.3.6.1.2.1.1.3.0', pMod.Null('')) ) ) # Build message reqMsg = pMod.Message() pMod.apiMessage.setDefaults(reqMsg) pMod.apiMessage.setCommunity(reqMsg, 'public') pMod.apiMessage.setPDU(reqMsg, reqPDU) # Future for the result. reqFut = asyncio.Future() class SNMPProtocol(asyncio.DatagramProtocol): def datagram_received(self, data, transport_address): res = [] while data: rspMsg, data = decoder.decode(data, asn1Spec=pMod.Message()) rspPDU = pMod.apiMessage.getPDU(rspMsg) # Match response to request if pMod.apiPDU.getRequestID(reqPDU)==pMod.apiPDU.getRequestID(rspPDU): # Check for SNMP errors reported errorStatus = pMod.apiPDU.getErrorStatus(rspPDU) if errorStatus: print(errorStatus.prettyPrint()) else: for oid, val in pMod.apiPDU.getVarBinds(rspPDU): res.append((oid, val)) reqFut.set_result(res) @asyncio.coroutine def get(reqMsg): snmp.sendto(encoder.encode(reqMsg)) return reqFut @asyncio.coroutine def main(): for oid, val in (yield from asyncio.wait_for(get(reqMsg), timeout=3)): print('%s = %s' % (oid.prettyPrint(), val.prettyPrint())) loop = asyncio.get_event_loop() snmp, snmp_proto = loop.run_until_complete( loop.create_datagram_endpoint(SNMPProtocol, remote_addr=('demo.snmplabs.com', 161))) loop.run_until_complete(main()) |
From: Steven L. <st...@mi...> - 2014-11-04 21:15:22
|
Thanks both of you! From: Ilya Etingof [mailto:il...@gl...] Sent: Tuesday, November 4, 2014 12:30 PM To: pys...@li... Cc: Steven Logue; Matt Hooks Subject: Re: [pysnmp-dev] Asyncio support in Python 3 Hi Matt, I’ve applied your patch to pysnmp and slightly reworked it afterwards. Please, try to use pysnmp development code and let me know in case of any issues: download latest CVS snapshot<http://pysnmp.cvs.sourceforge.net/viewvc/pysnmp/pysnmp/?view=tar> Please be aware that I’ve slightly changed the API you introduced in your patch to make it more uniform with the rest of pysnmp. See examples for details. I’m also interested in real-world use cases of the asyncio transport to better adapt pysnmp API. Thanks, ilya On 01 Nov 2014, at 00:56, Matt Hooks <me...@ma...<mailto:me...@ma...>> wrote: Hi everyone, After a long internal legal delay, I can now release the attached patch. This patch enables support for the new asyncio library in Python 3, and is a near drop in replacement for the Twisted transport currently provided. We've attempted to keep the structure and design nearly identical to the Twisted implementation to further the above goal. Ilya, I'm not familiar with any preferences you have for annotating the source files with licensing info, so I went ahead and used the license off the main site. We've included some example scripts, but haven't replicated all the ones available for Twisted. Cheers, Matt Hooks <asyncio_support.patch>------------------------------------------------------------------------------ |
From: Ilya E. <il...@gl...> - 2014-11-04 20:30:42
|
Hi Matt, I’ve applied your patch to pysnmp and slightly reworked it afterwards. Please, try to use pysnmp development code and let me know in case of any issues: download latest CVS snapshot <http://pysnmp.cvs.sourceforge.net/viewvc/pysnmp/pysnmp/?view=tar> Please be aware that I’ve slightly changed the API you introduced in your patch to make it more uniform with the rest of pysnmp. See examples for details. I’m also interested in real-world use cases of the asyncio transport to better adapt pysnmp API. Thanks, ilya > On 01 Nov 2014, at 00:56, Matt Hooks <me...@ma...> wrote: > > Hi everyone, > > After a long internal legal delay, I can now release the attached patch. > > This patch enables support for the new asyncio library in Python 3, and is a near drop in replacement for the Twisted transport currently provided. > > We've attempted to keep the structure and design nearly identical to the Twisted implementation to further the above goal. > > Ilya, I'm not familiar with any preferences you have for annotating the source files with licensing info, so I went ahead and used the license off the main site. > > We've included some example scripts, but haven't replicated all the ones available for Twisted. > > > Cheers, > > Matt Hooks > <asyncio_support.patch>------------------------------------------------------------------------------ |
From: Ilya E. <il...@gl...> - 2014-10-26 06:55:23
|
Hi Zach, Your patch has just been committed to pysnmp dev trunk: http://pysnmp.cvs.sourceforge.net/viewvc/pysnmp/pysnmp/?view=tar I’ve slightly modified it to make it compatible with python 2.4. Thanks! -ilya > On 26 Oct 2014, at 01:06, Zachary Ware <zac...@gm...> wrote: > > Hi, > > Currently, DirMibSource._getData doesn't close the files it opens, > leading to a flood of ResourceWarnings (when warnings are enabled on a > sufficiently recent CPython). The following simple patch ought to be > sufficient to fix it for all supported Python versions. > > Regards, > -- > Zach > > (Patch also attached in case Gmail decides to mess things up one way > or the other) > > Index: pysnmp/smi/builder.py > =================================================================== > RCS file: /cvsroot/pysnmp/pysnmp/pysnmp/smi/builder.py,v > retrieving revision 1.51 > diff -u -r1.51 builder.py > --- pysnmp/smi/builder.py 4 Jun 2013 06:06:23 -0000 1.51 > +++ pysnmp/smi/builder.py 25 Oct 2014 22:00:04 -0000 > @@ -162,7 +162,11 @@ > def _getData(self, f, mode): > try: > if f in os.listdir(self._srcName): # make FS case-sensitive > - return open(os.path.join(self._srcName, f), mode).read() > + fp = open(os.path.join(self._srcName, f), mode) > + try: > + return fp.read() > + finally: > + fp.close() > except OSError: > pass > raise IOError # pretend there's no such file > <pysnmp-smi-builder-close-files.diff>——————————————————————————————————————— > _______________________________________________ |
From: Zachary W. <zac...@gm...> - 2014-10-25 22:07:26
|
Hi, Currently, DirMibSource._getData doesn't close the files it opens, leading to a flood of ResourceWarnings (when warnings are enabled on a sufficiently recent CPython). The following simple patch ought to be sufficient to fix it for all supported Python versions. Regards, -- Zach (Patch also attached in case Gmail decides to mess things up one way or the other) Index: pysnmp/smi/builder.py =================================================================== RCS file: /cvsroot/pysnmp/pysnmp/pysnmp/smi/builder.py,v retrieving revision 1.51 diff -u -r1.51 builder.py --- pysnmp/smi/builder.py 4 Jun 2013 06:06:23 -0000 1.51 +++ pysnmp/smi/builder.py 25 Oct 2014 22:00:04 -0000 @@ -162,7 +162,11 @@ def _getData(self, f, mode): try: if f in os.listdir(self._srcName): # make FS case-sensitive - return open(os.path.join(self._srcName, f), mode).read() + fp = open(os.path.join(self._srcName, f), mode) + try: + return fp.read() + finally: + fp.close() except OSError: pass raise IOError # pretend there's no such file |
From: Matt H. <me...@ma...> - 2014-09-24 18:40:14
|
I have a working patch ready to go. It's tied up in our legal department at the moment, but I expect it to be released from there soon. On Wed, Sep 24, 2014 at 1:46 PM, R. David Murray <rdm...@bi...> wrote: > A google search got me a hit on a message with the above subject and the > offer of a patch, but I don't know if there was any followup (ie: was > the patch submitted?). I have a use case for this, so I'd love to take > a look at the patch and help out with it if there's anything I can do. > > --David > > > ------------------------------------------------------------------------------ > Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer > Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports > Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper > Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer > > http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk > _______________________________________________ > pysnmp-dev mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysnmp-dev > |
From: Ilya E. <il...@gl...> - 2014-09-24 18:23:52
|
Hi David, Unfortunately, no patch followed so far. If someone offers one, I'd be happy to take it into pysnmp package. -ilya On 09/24/2014 09:46 PM, R. David Murray wrote: > A google search got me a hit on a message with the above subject and the > offer of a patch, but I don't know if there was any followup (ie: was > the patch submitted?). I have a use case for this, so I'd love to take > a look at the patch and help out with it if there's anything I can do. > > --David > |
From: R. D. M. <rdm...@bi...> - 2014-09-24 18:06:06
|
A google search got me a hit on a message with the above subject and the offer of a patch, but I don't know if there was any followup (ie: was the patch submitted?). I have a use case for this, so I'd love to take a look at the patch and help out with it if there's anything I can do. --David |
From: Ilya E. <il...@gl...> - 2014-08-18 21:26:41
|
Hi Matt, Yes, please, submit the patch either through Sourceforge or plain e-mail. Thanks, Ilya > On Aug 19, 2014, at 0:45, Matt Hooks <me...@ma...> wrote: > > Hello everyone, > > As Python 3.4 continues to gain adoption, asyncio support is something that would be reasonably expected from an async-capable library such as PySNMP. A coworker and I have written a patch to do so, by adding carrier.asyncio and entity.rfc3413.asyncio. > > Is there any interest in pulling this in? > > Matt Hooks > ------------------------------------------------------------------------------ > _______________________________________________ > pysnmp-dev mailing list > pys...@li... > https://lists.sourceforge.net/lists/listinfo/pysnmp-dev |
From: Matt H. <me...@ma...> - 2014-08-18 21:09:47
|
Hello everyone, As Python 3.4 continues to gain adoption, asyncio support is something that would be reasonably expected from an async-capable library such as PySNMP. A coworker and I have written a patch to do so, by adding carrier.asyncio and entity.rfc3413.asyncio. Is there any interest in pulling this in? Matt Hooks |
From: Ilya E. <il...@gl...> - 2014-06-27 06:54:05
|
Hi Andrea, I’ve applied a fix addressing MIB read similar to yours to CVS code. The second issue seems to be already resolved there. Could you please try the latest CVS code now? Please note that rfc3413 apps have been redesigned and a [hopefully] better API has been introduced. But the whole thing remains backward compatible. Thanks, ilya On 26 Jun 2014, at 05:43, Andrea Nicotra <nic...@gm...> wrote: > I Ilya. > > I get serialization errors when I try to send notify with using definition with nested object, also my object have the getValue redefine to have dynamic resolution: > > the mib is like: > ... > snmpHeartbeatNotification NOTIFICATION-TYPE > OBJECTS { snmpHeartbeatRate } > STATUS current > DESCRIPTION > "This notification will typically be sent every > 30 seconds." > ::= { snmpNotificationsPrefix 1 } > ... > > and the class has a method like that: > > class Var(SuperClass): > def readGet(self, name, *args): > return name, self.syntax.clone(getValue()) > > above my fix: > > Index: pysnmp-4.2.5/pysnmp/entity/rfc3413/ntforg.py > =================================================================== > --- pysnmp-4.2.5.orig/pysnmp/entity/rfc3413/ntforg.py 2013-06-05 14:16:33.000000000 +0200 > +++ pysnmp-4.2.5/pysnmp/entity/rfc3413/ntforg.py 2014-06-26 03:24:36.617993524 +0200 > @@ -244,7 +244,7 @@ > mibNode = mibNode.getNode(mibNode.name + instanceIndex) > else: > mibNode = mibNode.getNextNode(mibNode.name) > - varBinds.append((mibNode.name, mibNode.syntax)) > + varBinds.append(mibNode.readGet(mibNode.name)) > debug.logger & debug.flagApp and debug.logger('sendNotification: processed notification object %s, instance index %s, var-bind %s' % (notificationObject, instanceIndex is None and "<first>" or instanceIndex, mibNode)) > elif notificationName: # numeric OID > varBinds.append( > > on the same file there is also an error: > in the function sendNotification, line 170 > > you forgot to declare at function begin something like : > > self.__pendingNotifications[metaSendPduHandle] = 0 > > so all the line like : > > except error.StatusInformation: > if not self.__pendingNotifications[metaSendPduHandle] > > go in KeyError > > to avoid the error is not better write like above?: > > if metaSendPduHandle not in self.__pendingNotifications: > > Andrea > > |
From: Andrea N. <nic...@gm...> - 2014-06-26 01:43:16
|
I Ilya. I get serialization errors when I try to send notify with using definition with nested object, also my object have the getValue redefine to have dynamic resolution: the mib is like: ... snmpHeartbeatNotification NOTIFICATION-TYPE OBJECTS { snmpHeartbeatRate } STATUS current DESCRIPTION "This notification will typically be sent every 30 seconds." ::= { snmpNotificationsPrefix 1 } ... and the class has a method like that: class Var(SuperClass): def readGet(self, name, *args): return name, self.syntax.clone(getValue()) above my fix: Index: pysnmp-4.2.5/pysnmp/entity/rfc3413/ntforg.py =================================================================== --- pysnmp-4.2.5.orig/pysnmp/entity/rfc3413/ntforg.py 2013-06-05 14:16:33.000000000 +0200 +++ pysnmp-4.2.5/pysnmp/entity/rfc3413/ntforg.py 2014-06-26 03:24:36.617993524 +0200 @@ -244,7 +244,7 @@ mibNode = mibNode.getNode(mibNode.name + instanceIndex) else: mibNode = mibNode.getNextNode(mibNode.name) - varBinds.append((mibNode.name, mibNode.syntax)) + varBinds.append(mibNode.readGet(mibNode.name)) debug.logger & debug.flagApp and debug.logger('sendNotification: processed notification object %s, instance index %s, var-bind %s' % (notificationObject, instanceIndex is None and "<first>" or instanceIndex, mibNode)) elif notificationName: # numeric OID varBinds.append( on the same file there is also an error: in the function sendNotification, line 170 you forgot to declare at function begin something like : self.__pendingNotifications[metaSendPduHandle] = 0 so all the line like : except error.StatusInformation: if not self.__pendingNotifications[metaSendPduHandle] go in KeyError to avoid the error is not better write like above?: if metaSendPduHandle not in self.__pendingNotifications: Andrea |
From: Steve H. <ste...@gm...> - 2014-06-03 00:24:02
|
Thanks Ilya. On Fri, May 30, 2014 at 7:51 PM, Ilya Etingof <il...@gl...> wrote: > > Hi Steve, > > Here’s an except from pysnmp-apps package's setup.py related to py2exe > invocation: > > if "py2exe" in sys.argv: > import py2exe > # fix executables > params['console'] = params['scripts'] > del params['scripts'] > # add files not found my modulefinder > params['options'] = { > 'py2exe': { > 'includes': [ > 'pysnmp.smi.mibs.*', > 'pysnmp.smi.mibs.instances.*', > 'pysnmp.entity.rfc3413.oneliner.*' > ], > 'bundle_files': 1, > 'compressed': True > } > } > > try: > import pysnmp_mibs > except ImportError: > print('NOT including pysnmp-mibs!') > else: > print('Including pysnmp-mibs....') > params['options']['py2exe']['includes'].append('pysnmp_mibs.*') > > params['zipfile'] = None > > print("!!! Make sure your pysnmp/pysnmp-mibs/pyasn1 packages are NOT > .egg'ed!!!") > > So the trick is to explicitly include dynamically loaded Python modules > into py2exe pack. > > -ilya > > On 28 May 2014, at 06:27, Steve Hutchins <ste...@gm...> wrote: > > Hi, I get this error when running from py2exe generated executable. > My platform is: Windows 7, python 2.7 with pysnmp 2.4.5 (installed by pip) > > --- Here's my python script (main.py) which is a small extract to > reproduce problem in a larger program: > > import pysnmp.smi.builder > builder = pysnmp.smi.builder.MibBuilder() > builder.loadModules('SNMPv2-MIB') > > --- Here's my py2exe script: > > from distutils.core import setup > import py2exe > setup(console=['main.py']) > > --- Here's the output: > > >main.exe > Traceback (most recent call last): > File "main.py", line 5, in <module> > File "pysnmp\smi\builder.pyc", line 270, in loadModules > pysnmp.smi.error.SmiError: MIB file "SNMPv2-MIB.py[co]" not found in > search path > > > I have searched on this error and seen list entry 'Re: [pysnmp-dev] py2exe > binary error with pysnmp 4.2.3' but this infers that it has subsequently > been fixed in 4.2.4 rc2. > If I run 'python main.py' from the command line it works ok. > > Is there anything I can do to force the load of SNMPV2-MIB.pyc or compile > the SNMPV2-MIB.py at runtime to get around this? > > > |
From: Ilya E. <il...@gl...> - 2014-05-30 07:51:28
|
Hi Steve, Here’s an except from pysnmp-apps package's setup.py related to py2exe invocation: if "py2exe" in sys.argv: import py2exe # fix executables params['console'] = params['scripts'] del params['scripts'] # add files not found my modulefinder params['options'] = { 'py2exe': { 'includes': [ 'pysnmp.smi.mibs.*', 'pysnmp.smi.mibs.instances.*', 'pysnmp.entity.rfc3413.oneliner.*' ], 'bundle_files': 1, 'compressed': True } } try: import pysnmp_mibs except ImportError: print('NOT including pysnmp-mibs!') else: print('Including pysnmp-mibs....') params['options']['py2exe']['includes'].append('pysnmp_mibs.*') params['zipfile'] = None print("!!! Make sure your pysnmp/pysnmp-mibs/pyasn1 packages are NOT .egg'ed!!!") So the trick is to explicitly include dynamically loaded Python modules into py2exe pack. -ilya On 28 May 2014, at 06:27, Steve Hutchins <ste...@gm...> wrote: > Hi, I get this error when running from py2exe generated executable. > My platform is: Windows 7, python 2.7 with pysnmp 2.4.5 (installed by pip) > > --- Here's my python script (main.py) which is a small extract to reproduce problem in a larger program: > > import pysnmp.smi.builder > builder = pysnmp.smi.builder.MibBuilder() > builder.loadModules('SNMPv2-MIB') > > --- Here's my py2exe script: > > from distutils.core import setup > import py2exe > setup(console=['main.py']) > > --- Here's the output: > > >main.exe > Traceback (most recent call last): > File "main.py", line 5, in <module> > File "pysnmp\smi\builder.pyc", line 270, in loadModules > pysnmp.smi.error.SmiError: MIB file "SNMPv2-MIB.py[co]" not found in search path > > > I have searched on this error and seen list entry 'Re: [pysnmp-dev] py2exe binary error with pysnmp 4.2.3' but this infers that it has subsequently been fixed in 4.2.4 rc2. > If I run 'python main.py' from the command line it works ok. > > Is there anything I can do to force the load of SNMPV2-MIB.pyc or compile the SNMPV2-MIB.py at runtime to get around this? |
From: Steve H. <ste...@gm...> - 2014-05-28 02:28:24
|
Hi, I get this error when running from py2exe generated executable. My platform is: Windows 7, python 2.7 with pysnmp 2.4.5 (installed by pip) --- Here's my python script (main.py) which is a small extract to reproduce problem in a larger program: import pysnmp.smi.builder builder = pysnmp.smi.builder.MibBuilder() builder.loadModules('SNMPv2-MIB') --- Here's my py2exe script: from distutils.core import setup import py2exe setup(console=['main.py']) --- Here's the output: >main.exe Traceback (most recent call last): File "main.py", line 5, in <module> File "pysnmp\smi\builder.pyc", line 270, in loadModules pysnmp.smi.error.SmiError: MIB file "SNMPv2-MIB.py[co]" not found in search path I have searched on this error and seen list entry 'Re: [pysnmp-dev] py2exe binary error with pysnmp 4.2.3' but this infers that it has subsequently been fixed in 4.2.4 rc2. If I run 'python main.py' from the command line it works ok. Is there anything I can do to force the load of SNMPV2-MIB.pyc or compile the SNMPV2-MIB.py at runtime to get around this? |