- Strength to Increase Rep
- +4
- Strength to Decrease Rep
- -1
- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
55 Posted Topics
[B]Hi all.. I need to do a condition check in a script. The same condition check needs to be repeated in another script. So, I am looking for a way, where i can set, say a flag in the first script ,upon meeting the condition, and be able to access … | |
hi all... how to find the localhost ip address in python [B]import socket socket.gethostbyname(socket.gethostname())[/B] gives me 127.0.0.1 instead of my ip address any help........... | |
hi, using ftplib.storbinary(), i am able to successfully upload files of size 60KB, but not of size 7,218 KB and also 26 KB... I am wondering why is this happening??? should file sizes be a multiple of 10...or what is the actual problem??????????? any reply would be greatly helpful....... I … | |
Hi all... I am trying to upload 4 files on a local disk, onto a remote ftp server. All of them are in the same folder(in local machine). I am using the storbinary function of ftplib. Following are the file sizes: 1-- 70 KB 2-- 60 KB 3-- 73 KB … | |
Hi all, i have different modules developed so far, and a main script needs to call the modules based on user's choice. will doing like this work?? using raw_input(), i wait for user choice, and once a choice is made, corresponding module is called. if main.py, does an 'import xxx.py' … | |
Hi all, Here is a part of my code: [CODE]#-- if the ports are mapped properly if(map_dict1[int(MIO_outports1[i])] == int(Exp_map_inport[i]) ): flag = 1 elif(map_dict2[int(MIO_outports1[i])] == int(Exp_map_inport[i])): flag = 1 else: flag = 0 [/CODE] But I am not able to navigate to the 'elif' part. I am getting : [CODE] … | |
Hi, I want to do something like this: I have two lists: list1 = range(6) list2 = range(10,15) i want a dictionary like this: adict ={0:10, 1:11, 2:12, 3:13, 4:14, 5:15 } I did the following: [CODE]list1 = range(6) list2 = range(10,15) adict = dict(zip(list1,list2))[/CODE] i get : [B]TypeError: list … | |
Hello, can anyone help me regarding how this can be done? I need to declare an 'array' which has 95 indices, and each entry holds 8 bits each of data. am doing this with: PORT_MAP_LEN = 764/8 bit_map_len = [0]*PORT_MAP_LEN but it is giving me list index out of range … | |
Hi, I am working with [B]python2.4 on windows[/B], and want pysnmp to be imported. Have downloaded [B]pysnmp-4.1.14a.tar.gz[/B] and [B]pyasn1-0.0.12a.tar.gz[/B] and put it under [B]D:\Python24\Lib\site-packages\[/B]. Still i am getting the import error. from pysnmp.entity.rfc3413.oneliner import cmdgen ImportError: No module named pysnmp.entity.rfc3413.oneliner What should I do to make pysnmp importable? | |
Hi all, I need to set some variables via Pysnmp which take 'unsigned int' only. Is python int by default a 32 bit- signed int? How do I convert it into 16 and 8 bit- unsigned ints? I need to read two registers consequently( which are of 8 bits each) … | |
Hi all, Is there any way to do forward referencing or function prototyping in python..? Being an interpreted language, is lack of forward referencing a drawback of python? | |
using pysnmp I am querying a variable which gives the IP address. I want to check that address. I do the following [CODE] ........... ............ ............. errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( cmdgen.CommunityData('xxx', 'yyy', 1), cmdgen.UdpTransportTarget((addr,161)), ((1,3,6,1,4,1,18489,1,2,2,2,9,30,0))) print"Error on GET for ccmSDIDULinkUtilEastRemoteIP -%s,%s%(errorIndication,errorStatus) print varBinds print varBinds[0][1] [/CODE] i get … | |
hi all.. I need to issue a 'ping' to an ip address via my script and check whether it is up? can I issue it using os.system? can I capture the output and analyze to see if the host is up?? | |
Hi, I get the log messages 'twice' on the console and only once in the log file. Can any one tell me the reason for this duplication on console? here is how I have set the logger: [ICODE]import logging #--set up logging to file logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', datefmt='%Y-%m-%d … | |
Hi, I have a for loop something like: [CODE]for n in range(no_of_rows): #--configuring ODU Op mode odu_op_mod=list1[n] odu_op_mode= odu_enum["%s"%odu_op_mod] if (odu_op_mod == 'blahblah'): #------------ elif(odu_op_mod == 'aaa'): #-------- elif(odu_op_mode =='xxx'): #----- elif(odu_op_mod == 'yyy'): #------------------- elif(odu_op_mod == 'zzz'): #------------- logging.info("*******************************************************************") subprocess.call(['python link_config_idu12.py %s'%addr],shell=True) [/CODE] I have different lists, list1 #for … | |
I want 1.py to call 2.py. 1.py takes an Ip address as a command line argument. I am trying a '[B]subprocess.call()[/B]' in 1.py to call 2.py. I have defined addr= sys.argv[1] before the [B]main()[/B] of 1.py. I want the same address to be accessed in 2.py. In short, 1.py should … | |
Hi, in the pysnmp tutorial, I couldn't find an equivalent for snmpwalk. What can be used? | |
hi... using pysnmp, an 'snmp get' varBinds gives me an 'octet string' of values like: 1+1 Protection; East-West; Spiral Search; ODU Enable/Disable I need to loop through these strings and see whether a particular string say, 'East-West' is present. I am not finding way to do this. can this octet … | |
[B]hi all using telnetlib, I am issuing a 'top' command on a remote host. Top seems to continue indefinitely. On a terminal, I can use CTRL+c to suspend the process... What can be passed in telnet.write() equivalently to suspend the process , yet retain the output so far... pls help … | |
[B]hi, my problem is as such... I am establishing a telnet session to an IP using telnetlib module. I read the free memory on the board using telnet.write("free\n"). after this i call a system command 'snmpwalk' to walk the MIBs of the IP above. I again need to establish the … | |
Hi... I have a set of strings as below: [CODE]4:14.4-17M,5:14.4-2e13M,6:14.4-4e9M,7:14.4-8e,22:28.4-35M,23:28.4-2e30M,24:28.4-4e26M,25:28.4-8e18M,26:28.4-16e2M,27:28.4-18e,28:14.16-36M,29:14.16-2e32M,30:14.16-4e28M,31:14.16-8e20M[/CODE] I want everything after the ':' to be discarded. i.e., i just want a list of what preceeds ':' (4,5,6,7,22,.................) How can this be done? | |
can anyone suggest a simple method to define an enum in python. as some examples floating on net, i used class Animal: DOG=1 CAT=2 print Animal.DOG but it doesn't seem to be working... | |
telnetlib is helping me to connect to remote host and do the user login. but, when i try doing the super user login, it hangs ............... .............. ............... User="abc" Password="abc" Superuser_id="yyy" su_passwd="xxx" #-- establish a telnet connection to all the remote hosts in the list except the host running script … | |
hi, I just came accross the csv module to deals with csv files in python. suppose my csv file has two rows: 1,2,3,4 5,6,7,8 and i want to access each item at a time, i.e., 1 followed by 2 and so on....what can be done? [B]import csv reader= csv.reader(open('filename.csv','r'),delimiter=' ') … | |
[B]$? in linux gives the exit status of the recently executed command , as i have learnt. suppose i give a cd command at the terminal and if such a directory or file is not present, echo $? following it gives me 1. but, when the same is run via … | |
I need to install python 2.4 on a fedora 3 system. I followed the instructions in [B][url]http://www.python.org/download/releases/2.4/rpms/[/url][/B] i have the following contents in [B]/etc/yum.repos.d/python24.repo[/B] [B][python24] name=Fedora Core 3 - $basearch - Python 2.4 baseurl=http://www.python.org/ftp/python/2.4/rpms/fedora-3/ enabled=1 gpgcheck=1[/B] further following the instructions, [B]rpm --import [url]http://www.python.org/ftp/python/2.4/rpms/KRUD-GPG-KEY[/url][/B] gave me: [B]error: [url]http://www.python.org/ftp/python/2.4/rpms/KRUD-GPG-KEY:[/url] import read failed.[/B] … | |
[B]hi.... i created a telnet connection to a remote server using telnetlib and excuted few commands using telnet.write. can't a python script residing on the remote host be run using telnet.write? i.e, do something like telnet.write("./script_name.py argument1 arguement2........") after the connection is established?[/B] | |
[B]hi all, can anyone tell me how to open a folder on a remote machine connected on same LAN. I need to open a folder in the form "\\remote_machine\folder1\folder2\folder3"[/B] | |
hi all, can anyone tell me hoe to open a file from one machine, when the file is present on a remote machine, specifying it's IP address? | |
[B]How to validate an IP Address using python? It should reject the shorter addresses such as 192.168 instead of padding the rest of the bits the address with 0s[/B] | |
[B]when the parser is populated with options using optparse, in a case where an option say 'ip' is to be used twice, I get an OptionConflictError. when the conflict handler was set to "resolve" as suggested in [URL="http://docs.python.org/library/optparse.html"]http://docs.python.org/library/optparse.html[/URL] , it resolves the situation by removing '-ip' from the earlier options … | |
hi... I have written a script for FTP upload using python.. It worked fine when i tried on local boards, but is giving me an error when trying with a remote board via VPN. this is the error i get: [B](104, 'Connection reset by peer')[/B] the machine i developed script … | |
can anyone show a small sample of how [B]optparse module[/B] can be used to parse a command line arguement? the command line is somewhat like: <scriptname> -ip<ip address> -opt1/opt2 | |
Why am I not able to edit my unix file though i have the permissions -rwxrwxrwx? :( | |
I have python 2.5.2 on my Debian system n want to upgrade it to python 2.6. Got to know that apt-get install package searches for package in /etc/apt/sources.list I have downloaded python 2.6.2. How to add an entry to the file /etc/apt/sources.list ? :( | |
below is how an snmp get is issued using pysnmp errorIndication,errorStatus,errorIndex,varBinds = cmdgen.CommandGenerator().getCmd( cmdgen.CommunityData('xxxx', 'xxxx', 1), cmdgen.UdpTransportTarget(('192.168.5.157', 161)), (1,3,6,1,4,1,18489,1,2,1,4,5,[B]1[/B],0)) In the OID part, the integer in bold keeps changing from 1 to 38. I need to put the above in a loop, instead of issuing 38 seperate gets. how can … | |
[B]hi... I have a value, value=4501-E001 I am concerned about only the value before hyphen i.e., 4501 I need to check whether various values begin with 4501, followed by something, n am not concerned about "something" that follows. How can this splitting be done in python?[/B] | |
hi... how can this be done using python 1.prompting user for a file location from within a script 2.reading the file location entered by the user 3.storing it in a file like object | |
hi... am using pysnmp module to do an snmp get on a USB key status from pysnmp.entity.rfc3413.oneliner import cmdgen #--query on ccmSDIDUKeyStatus errorIndication, errorStatus, errorIndex, varBinds = cmdgen.CommandGenerator().getCmd( cmdgen.CommunityData('xxx', 'xxx', 1), cmdgen.UdpTransportTarget(('192.168.5.157', 161)), (1,3,6,1,4,1,18489,1,2,4,2,8,0)) varBinds gives the following: [(ObjectName('1.3.6.1.4.1.18489.1.2.4.2.8.0'), Integer('2'))] I need to print the key status, based on varBinds, … | |
Is there any method or library to translate pysnmp OIDs to human readable strings?? | |
hi...i am trying to install python 2.6 on my debian system.. I followed the following instructions[B] [url]http://www.fps-gamer.net/installing-python-2-6-on-debian-lenny/[/url] [/B] on doing [B]aptitude install -t testing python-central[/B] i get [B]E: Invalid record in the preferences file, no Package header[/B] can any body pls reason out:( | |
I want some insight into /etc/apt/preferences and /etc/apt/sources.list file on debian | |
while trying to install net-snmp-5.6, i get following error [B]gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.5 -c netsnmp/client_intf.c -o build/temp.linux-i686-2.5/netsnmp/client_intf.o netsnmp/client_intf.c:1:20: error: Python.h: No such file or directory In file included from /usr/local/include/net-snmp/net-snmp-includes.h:69, from netsnmp/client_intf.c:4:[/B] my debian system has python2.5.2 where can I find Python.h header … | |
hi.... I am doing an snmpwalk on MIB variables and dumping the output to a text file. I dont need all the info and need to read only a part of it. How can this be done efficiently in python? | |
i have a problem... within my python script which does an snmpwalk, there should be an intelligence to create a static table which maps OIDs to corresponding text strings, query the table and in the output of snmpwalk, i need to replace the numeric string with its textual string.. for … | |
while trying to configure yapsnmp-0.7.8, i get the following.. checking for patch... patch checking for kstat_open in -lkstat... no checking for socket in -lsocket... no checking for HMAC in -lcrypto... no checking for init_snmp in -lsnmp... no configure: error:[B] Couldn't find libsnmp [/B] what might be the reason? | |
hi... is there any MIB parsing tool which generates an excel file or like that can be queried? | |
hi all... whats the difference between os.popen and subprocess.popen?? what does shell=True in subprocess.call really mean? if os.popen is used for snmpwalk, will there be any problem such as exceeding pipe capacity? what is the capacity of the file objcet connected to pipe using os.popen?/ how much data can it … | |
hi all can u pls help me regarding iterating through an integer variable within a subprocess call here is what i exactly want to do for n in range(1,16): subprocess.call(['snmpset', '-v2c', '-c arct1c', '192.168.5.157', '.1.3.6.1.4.1.18489.1.2.1.5.1.2.0', 'i ','n']) i.e., i want to iterate through snmpwalk..but its not working:( it shows 'bad … | |
can anyone help me regarding how multiple snmp sets can be invoked in python within a for loop? |
The End.