I'm using nxt-python to connect to my nxt brick from my raspberry pi.
After some struggle with the python 3.2 versions of the bluetooth and usb libraries it requires i've managed to get it to connect via bluetooth and ask for a passkey. After some more struggle i found that i could type bluetooth-agent PASSKEY & (and replace PASSKEY with the passkey) in the terminal before running the python script that connects with the nxt brick and as far as i know that works fine. But now it throws an error. Connecting with USB throws a different error.
Here's the error i get with both methods (USB & BT) and debug enabled:
USB: True BT: True Fantom: False FUSB: False FBT: False
Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/nxt/locator.py", line 138, in find_one_brick
if name and info[0].strip('\0') != name:
TypeError: Type str doesn't support the buffer API
Failed to connect to possible brick
Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/nxt/locator.py", line 131, in find_one_brick
info = b.get_device_info()
File "/usr/local/lib/python3.2/dist-packages/nxt/brick.py", line 27, in poll
self.sock.send(ogram.bytes())
File "/usr/local/lib/python3.2/dist-packages/nxt/bluesock.py", line 57, in send
l0 = len(data.encode('utf-8')) & 0xFF
AttributeError: 'bytes' object has no attribute 'encode'
Failed to connect to possible brick
No brick was found.
Is the brick turned on?
For more diagnosing use the debug=True argument or
try the 'nxt_test' script located in /bin or ~/.local/bin
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.2/dist-packages/nxt/locator.py", line 154, in find_one_brick
raise BrickNotFoundError
nxt.locator.BrickNotFoundError
Because i know python i could probably fix the errors by just editing the source code, but i'm affraid i'll break something. I've tried editing it (keeping backups of every file i edit) and then it gets past a couple of lines before throwing another different error.
EDIT
When i try to import using python 2 it gives me this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/nxt/__init__.py", line 15, in <module>
from nxt.locator import find_one_brick, Method
File "/usr/local/lib/python2.7/dist-packages/nxt/locator.py", line 49
if not silent: print("USB module unavailable, not searching there", file=sys.stderr)
^
SyntaxError: invalid syntax
I've downloaded the v2.2.2 stable instead of cloning the master commit and it runs fine under python2. Too bad it isn't python3 though.
Related
1) python newbie
2) tasked with getting a script together that would compile various stats from our brocade switches
trying to run this script
https://github.com/zapman449/brocade_switchshow_aliases
3) get it set up per the Readme. Config file is set up (I think) properly)
4) BUT - I get the following errors - and not sure why. Any help would be appreciated
[someguy#myserver SAN_Scripts]$ ./get-brocade.py fcr_fd_41
<function parse_switch_line at 0x1429578>
Switch Username: someguy
Switch password for user someguy:
Traceback (most recent call last):
File "./get-brocade.py", line 265, in <module>
main()
File "./get-brocade.py", line 261, in main
get_switchshow(conn, switch)
File "./get-brocade.py", line 198, in get_switchshow
if len(words) == 3 :
TypeError: object of type 'NoneType' has no len()
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib64/python2.6/threading.py", line 532, in __bootstrap_inner
File "/usr/lib/python2.6/site-packages/paramiko/transport.py", line 1609, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error'
[someguy#myserverSAN_Scripts]$
I am trying to set up the ChirpSDK, but every time I configure and run the code, I get this error:
Traceback (most recent call last):
File "test.py", line 3, in <module>
chirp = ChirpSDK()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 395, in __init__
self.read_chirprc(block)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 501, in read_chirprc
raise IOError('Could not find a ~/.chirprc file')
OSError: Could not find a ~/.chirprc file
Exception ignored in: <function ChirpSDK.__del__ at 0x10fa31af0>
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 422, in __del__
self.close()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 470, in close
if self._sdk:
AttributeError: 'ChirpSDK' object has no attribute '_sdk'
I realize that the error is saying that my .chirprc file is not being recognized, but I have no idea how to remedy this. I created a .chirprc file in my /Users/username/ path, and named it c.chirprc (as the Chirp getting started article suggests), but I am still getting this error. Is there another part that I am missing? Am I reading the instructions wrong?
Thanks
The Chirp configuration file should be placed at /Users/<username>/.chirprc on macOS.
If you run ls -l ~/.chirprc in the terminal, do you get any results? If it displays no such file or directory then you have not created the file correctly.
I have created a set of python scripts that scrape information out of a website using Internet Explorer. This methodology while not ideal, is the only way I could get it to work as the site does not work well with other browsers and has single-sign on authentication which was difficult to deal with through requests. Anyways, it works. I'd like to be able to share with coworkers without them needing to install python or modify scripts.
I was able to create an executable of the scripts that works on my computer through pyinstaller. When I share with coworkers, though, the get an error "local variable 'browser' referenced before assignment." I tried referencing the IEWebdriverService.exe the binaries field of the pyinstaller .spec file. This caused the size of the .exe to grow so it did something..but it didn't solve the problem.
This is my first time creating an executable and I have really no idea how the IE Driver works so I'm stuck at the moment. Any help would be greatly appreciated. I'm open to using another tool than pyinstaller if that helps, I just found it the easiest to use of the alternatives. I'm using Python 3.5.
thanks.
Edit - Error Log
run # 1
['Part Number = 12649189']
Error
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.ie.se
rvice.Service object at 0x0000000004D00D30>>
Traceback (most recent call last):
File "site-packages\selenium\webdriver\common\service.py", line 173, in __del_
_
File "site-packages\selenium\webdriver\common\service.py", line 145, in stop
AttributeError: 'Service' object has no attribute 'process'
['Part Number = 12649189']
Error
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.ie.se
rvice.Service object at 0x0000000004D00D30>>
Traceback (most recent call last):
File "site-packages\selenium\webdriver\common\service.py", line 173, in __del_
_
File "site-packages\selenium\webdriver\common\service.py", line 145, in stop
AttributeError: 'Service' object has no attribute 'process'
['Part Number = 12649189']
Error
Exception ignored in: <bound method Service.__del__ of <selenium.webdriver.ie.se
rvice.Service object at 0x0000000004D00D30>>
Traceback (most recent call last):
File "site-packages\selenium\webdriver\common\service.py", line 173, in __del_
_
File "site-packages\selenium\webdriver\common\service.py", line 145, in stop
AttributeError: 'Service' object has no attribute 'process'
Traceback (most recent call last):
File "Parent_Part_W_UI.py", line 138, in <module>
File "Parent_Part_W_UI.py", line 23, in __init__
File "Parent_Part_W_UI.py", line 40, in init_window
File "Parent_Part_W_UI.py", line 122, in execute_main
UnboundLocalError: local variable 'browser' referenced before assignment
I am new to jira-python and have run into an issue with using jirashell.
jira-python was installed from documentation given here: http://jira.readthedocs.org/en/latest/
When I try to start jirashell using:
ubuntu#ip-10-0-0-12:~$ jirashell -s https://jira.atlassian.com
I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/jirashell", line 11, in <module> sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/jira/jirashell.py", line 248, in main
jira = JIRA(options=options, basic_auth=basic_auth, oauth=oauth)
File "/usr/local/lib/python2.7/dist-packages/jira/client.py", line 202, in __init__self._create_oauth_session(oauth)
File "/usr/local/lib/python2.7/dist-packages/jira/client.py", line 1871, in _create_oauth_session
oauth['consumer_key'],
KeyError: u'consumer_key'
I have also tried to get to a server using basic auth but that returns the same error. Using curl works fine, but I wanted to see the objects that are getting returned and get help as I develop by python-jira integration.
Thank you for any insight.
I'm trying to get a simple Pyro example running (taken from this page), this is the code:
import Pyro.core
import Pyro.naming
class JokeGen(Pyro.core.ObjBase):
def joke(self, name):
return "Sorry "+name+", I don't know any jokes."
daemon=Pyro.core.Daemon()
ns=Pyro.naming.NameServerLocator().getNS()
daemon.useNameServer(ns)
uri=daemon.connect(JokeGen(),"jokegen")
daemon.requestLoop()
When I run this script with Python 2.6.5 and Python 2.6.6 (tried both on Ubuntu 10.04 and Debian Squeeze), I'm always getting this error:
Traceback (most recent call last):
File "/home/ingo/tools/python/pyroserver.py", line 9, in <module>
ns=Pyro.naming.NameServerLocator().getNS()
File "/usr/lib/pymodules/python2.6/Pyro/naming.py", line 176, in getNS
reply = self.sendSysCommand(NS_SYSCMD_LOCATION,host,port,trace,1,bcaddr)
File "/usr/lib/pymodules/python2.6/Pyro/naming.py", line 76, in sendSysCommand
raise Pyro.errors.NamingError("could not find NameServer")
Pyro.errors.NamingError: could not find NameServer
What's wrong with the script? How can I create that nameserver?
Run pyro-ns in another terminial first. That is the Pyro object broker.