I am trying to use the netsnmp library to snmpset a attribute I get an error
robm#PC2303VM:~/code/python/snmp$ ./tester2.py
File "./tester2.py", line 5
ipaddr=netsnmp.Varbind('.1.3.6.1.2.1.69.1.3.1.0',172.168.100.2,'IPADDRESS')
^
SyntaxError: invalid syntax
now from the command line
snmpset -v2c -c private 10.1.1.8 .1.3.6.1.2.1.69.1.3.1.0 a 172.168.100.2
works just fine and quoting "172.168.100.2" gives a different error
TypeError: expected string or Unicode object, NoneType found
#!/usr/bin/python
import netsnmp
ipaddr=netsnmp.Varbind('.1.3.6.1.2.1.69.1.3.1.0',172.168.100.2,'IPADDRESS')
netsnmp.snmpset(ipaddr, Version=2, DestHost="10.1.1.8", Community="private")
filename=netsnmp.Varbind('.1.3.6.1.2.1.69.1.3.2.0', './robertme/Q2Q_REL_7_2_2_2015_04_07_T1935.bin','STRING')
netsnmp.snmpset(filename, Version=2, DestHost='10.1.1.8', Community='private' )
any Ideas on how to format that correctly?
Related
I am running a program 'MSMBuilder', it works well on the last week but suddenly an error came out, saying 'importing 'simtk.openmm' is deprecated. import 'openmm' instead'.
But there is no command such as 'import simtk.openmm' in my code.
Where this error came from?
Here is my code..
from msmbuilder.io import gather_metadata, save_meta, NumberedRunsParser
##Construct and save the dataframe
parser= NumberedRunsParser(
traj_fmt="trajectory-{run}.xtc",
top_fn="top.pdb",
step_ps=50,
)
meta = gather_metadata("trajs/*.xtc", parser)
save_meta(meta)
I am trying to import blf file using can.BLFReader module.
buf python shows 'AttributeError'.
this is the code.
import can
filename = "test.blf"
can_log = can.BLFReader(filename)
for msg in logging:
print(msg)
AttributeError: module 'can' has no attribute 'BLFReader'
and the file name is not 'can'
what is the reason?
It seems to be a problem with python3 version if you run as you can see in the attached image with python it will work
I have some python3 code interacting with a virtualbox machine via Pyvbox.
vm = vbox.find_machine(vm_name)
session = vm.create_session()
guest_session = session.console.guest.create_session(vm_username, vm_password)
guest_session.execute('C:\\Program Files\\Internet Explorer\\iexplore.exe', [url])
With this code snippet which executes fine but always throws an error (from the gues_session.execute):
TypeError: string argument without an encoding
I've tried encoding the URL with python3 libraries but with no luck.
i'm having a os library error, and it seems that there aren't much info about it on the net. When i try to create a folder in ubuntu 14.04 using my python script:
from os import *
ncpath = "lol"
if not path.exists(ncpath):
makedirs(path,0755)
this error is returned:
File "/home/user/anaconda2/lib/python2.7/posixpath.py", line 85, in split
i = p.rfind('/') + 1
AttributeError: 'module' object has no attribute 'rfind'
can someone help me figure out what's going on ?
Here:
makedirs(path,0755)
You are passing the path module itself instead ncpath which is your string.
I have a rPi running raspbmc and I created autoexec.py which runs on startup. Inside autoexec.py, I put the following code:
import os
import shutil
shutil.copyfile(/mnt/usb/scripts/guisettings.xml, /home/pi/.xbmc/userdata/guisettings.xml)
However, I am getting an error every time I attempt to run this script. I have checked the log files and it only shows the following:
-->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.SyntaxError'>
Error Contents: ('invalid syntax', ('autoexec.py', 4, 17, 'shutil.copyfile(/mnt/usb/scripts/guisettings.xml, /home/pi$
SyntaxError: ('invalid syntax', ('autoexec.py', 4, 17, 'shutil.copyfile(/mnt/usb/scripts/guisettings.xml, /home/pi/.x$
-->End of Python script error report<--
What am I doing wrong here? I have been attempting this for the past hour.
You need to quote literal strings in Python:
shutil.copyfile('/mnt/usb/scripts/guisettings.xml',
'/home/pi/.xbmc/userdata/guisettings.xml')