I need help in python. I tried to put this code in python shell:
from naoqi import ALProxy
tts = ALProxy("ALTextToSpeech", "127.0.0.1",9559)
tts.say("Hello, world!")
and I get this error:
Traceback (most recent call last):
File "C:/Users/USER/Desktop/say.py", line 2, in <module>
tts = ALProxy("ALTextToSpeech", "127.0.0.1",9559)
File "C:/Users/USER/Desktop\naoqi.py", line 227, in __init__
inaoqi.proxy.__init__(self, args[0], args[1], args[2])
File "C:\Python27\lib\site-packages\inaoqi.py", line 318, in __init__
this = _inaoqi.new_proxy(*args)
RuntimeError: ALBroker::createBroker
Cannot connect to tcp://127.0.0.1:9559
This order happen whether I use virtual robot or real, I use choregraphe 1.14.5 version and python version 2.7.13
The connection is almost never done to 127.0.0.1:9559:
If you're connecting to a real robot, you should replace 127.0.0.1 by it's IP address (or it's domain name, e.g. "nao.local", but may or may not work depending of your local network configuration; when it does work it's more convenient)
If you're connecting to Choregraphe's virtual robot, you should replace 9559 by the virtual robot's port, which you can find in Choregraphe's preferences, at the bottom of the "Virtual Robot" tab, as seen in this image.
Related
I'm trying to connect to the virtual robot on Choregraphe.
The virtual robot is running on Port 58386 on my computer.
This is the code:
from naoqi import ALProxy
tts = ALProxy("ALTextToSpeech", "127.0.0.1", 58386)
tts.say("Hello, world!")
This is the error thrown:
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
tts = ALProxy("ALTextToSpeech", "127.0.0.1", 58386)
File "C:\Python27\lib\site-packages\naoqi.py", line 344, in __init__
inaoqi.proxy.__init__(self, args[0], args[1], args[2])
File "C:\Python27\lib\site-packages\inaoqi.py", line 318, in __init__
this = _inaoqi.new_proxy(*args)
RuntimeError: ALProxy::ALProxy
Can't find service: ALTextToSpeech
I've tried looking for this error, but couldn't find the solution anywhere. What am I doing wrong here? Any help is much appreciated.
Speech synthesis on virtual robots is not supported.
You can still simulate dialogues using ALDialog API.
Choregraphe can show the output in its dialog widget, and let you input text too.
I'm trying to communicate with an instrument (Agilent 33220A arbitrary waveform generator) using GPIB and I use the GPIB-USB-HS interface plugged into a USB port on my computer.
The instrument is correctly listed when I use NIMAX explorer (there is also a Thorlabs PM100D connected by USB):
However, I cannot connect to it using PyVISA.
Here is the code:
import visa
rm=visa.ResourceManager()
rm.list_resources()
The output is:
('USB0::0x1313::0x8078::P0003982::INSTR', 'ASRL1::INSTR', 'ASRL3::INSTR', 'ASRL6::INSTR')
As you can see, the PM100D connected by USB is correctly listed, but not the Agilent connected on GPIB 10.
I tried to connect directly:
rm.open_resource('GPIB0::10::INSTR')
But I got an IO error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\users\nanotube\appdata\local\programs\python\python36\lib\site-packages\pyvisa\highlevel.py", line 1623, in open_resource
info = self.resource_info(resource_name, extended=True)
File "c:\users\nanotube\appdata\local\programs\python\python36\lib\site-packages\pyvisa\highlevel.py", line 1583, in resource_info
ret, err = self.visalib.parse_resource_extended(self.session, resource_name)
File "c:\users\nanotube\appdata\local\programs\python\python36\lib\site-packages\pyvisa\ctwrapper\functions.py", line 1381, in parse_resource_extended
alias_if_exists)
File "c:\users\nanotube\appdata\local\programs\python\python36\lib\site-packages\pyvisa\ctwrapper\highlevel.py", line 188, in _return_handler
raise errors.VisaIOError(ret_value)
pyvisa.errors.VisaIOError: VI_ERROR_RSRC_NFOUND (-1073807343): Insufficient location information or the requested device or resource is not present in the system.
I use Python 3.6.0 on Windows 7 Pro 64 bits OS. PyVisa version is 1.8.
I don't understand what I'm missing here. Does anyone have an idea ?
Many thanks !
I think this should work for you
rm.open_resource('USB0::0x1313::0x8078::P0003982::INSTR')
So im trying to connect to a CoaP Resource using this python library https://github.com/chrysn/aiocoap . The library uses python 3.4 and i have 3.4 installed and set as the interpreter to use with this (Im on Windows 7 btw). Still im getting this error message, when executing the clientGET.py file. Same for the server file.
C:\Python34\python.exe C:/Learning/PyCoap/aiocoap/clientGET.py
Traceback (most recent call last):
File "C:/Learning/PyCoap/aiocoap/clientGET.py", line 34, in <module>
asyncio.get_event_loop().run_until_complete(main())
File "C:\Python34\lib\asyncio\base_events.py", line 268, in run_until_complete
return future.result()
File "C:\Python34\lib\asyncio\futures.py", line 277, in result
raise self._exception
File "C:\Python34\lib\asyncio\tasks.py", line 236, in _step
result = next(coro)
File "C:/Learning/PyCoap/aiocoap/clientGET.py", line 20, in main
protocol = yield from Context.create_client_context()
File "C:\Learning\PyCoap\aiocoap\aiocoap\protocol.py", line 510, in create_client_context
transport, protocol = yield from loop.create_datagram_endpoint(protofact, family=socket.AF_INET6)
File "C:\Python34\lib\asyncio\base_events.py", line 675, in create_datagram_endpoint
waiter)
File "C:\Python34\lib\asyncio\selector_events.py", line 68, in _make_datagram_transport
address, waiter, extra)
File "C:\Python34\lib\asyncio\selector_events.py", line 911, in __init__
super().__init__(loop, sock, protocol, extra)
File "C:\Python34\lib\asyncio\selector_events.py", line 452, in __init__
self._extra['sockname'] = sock.getsockname()
OSError: [WinError 10022] Ein ungultiges Argument wurde angegeben
Process finished with exit code 1
I didn't explore this in a real Python, as I don't have a Windows machine with Python 3.4 handy, but it seems to me that this could be a bug in asyncio. Its UDP socket creation probably simply doesn't work on Windows. Do some experimenting on the lower level, looking at what aiocoap is doing, and try to prove me wrong.
It's supposed to work, documentation only mentions ProactorEventLoop as not supporting UDP.
The error condition is described in Socket.error: Invalid Argument supplied .
aiocoap.protocol.Context.create_client_context() seems to be doing the right thing according to asyncio documentation, but _SelectorTransport.__init__() will always call sock.getsockname() before any packets are sent, at which point the socket will not be bound to an address (according to the linked SO question) and getsockname() will fail on Windows.
You might want to retry with a current version of Python and aiocoap (current development version, after 0.4a1). Windows used not to be supported in aiocoap, and is still not supporting all of CoAP, but now uses a socket implementation that is aware of some limitations in the Windows socket API.
i need to debug a program i wrote in Eclipse with PyDev plugin. However I can not debug it because Eclipse obviously does not have the permission to do so.
I always get the following error when debugging reaches the send() function.
socket.error: [Errno 1] Operation not permitted
Running Eclipse with gksudo does not work either. It opens, but it says the editor could not be found.
Could not open the editor: No editor descriptor for id
org.python.pydev.editor.PythonEditor
How do I fix this?
I can't post the full code, it's too long. Here is a kind of breakdown, which causes the same error. Eclipse is not allowed the execute the send() function. Executing it with sudo in the command shell works.
from scapy.all import *
from scapy.layers.inet import IP, UDP
class SomeIP(Packet):
name = "SomeIP Packet"
fields_desc=[XShortField("X", 0x1000),
XShortField("Y", 0x1000)]
SIP = SomeIP()
packet = IP(src="129.168.101.164",dst="192.168.101.143")/UDP(sport=1000, dport=1000)/SIP
send(packet, verbose=False)
Here is the error I get - the first line can be ignored.
WARNING: No route found for IPv6 destination :: (no default route?)
Traceback (most recent call last):
File "scapy_test.py", line 19, in <module>
send(packet, verbose=False)
File "/usr/lib/python2.7/dist-packages/scapy/sendrecv.py", line 251, in send
__gen_send(conf.L3socket(*args, **kargs), x, inter=inter, loop=loop, count=count,verbose=verbose, realtime=realtime)
File "/usr/lib/python2.7/dist-packages/scapy/arch/linux.py", line 307, in __init__
self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))
File "/usr/lib/python2.7/socket.py", line 187, in __init__
_sock = _realsocket(family, type, proto)
socket.error: [Errno 1] Operation not permitted
Could you use another port number? If I understand your code correctly you try to open a port on number 1000. Since port numbers up to 1024 can only be used by root, setting the port number to something higher than 1024 could maybe solve the problem.
I have tried below lined of code on RHEL it works so great. On Linux I just have to acquire the Kerberos ticket.
mport ldap
import ldap.sasl
conn=ldap.initialize('ldap://auto.test-auto.com',trace_level=2)
conn.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
conn.set_option(ldap.OPT_REFERRALS,0)
sasl = ldap.sasl.gssapi()
conn.sasl_interactive_bind_s('', sasl)
Then I copied same thing in to a windows 2k3 server where ActivePython-2.7","python-ldap-2.4.10", "openssl-0.9.8o","setup-sasl-1.5.27" are installed.
Traceback (most recent call last):
File "C:\susanta\test-sasl.py", line 10, in <module>
conn.sasl_interactive_bind_s('', sasl)
File "C:\Python27\lib\site-packages\ldap\ldapobject.py", line 229, in sasl_interactive_bind_s
return self._ldap_call(self._l.sasl_interactive_bind_s,who,auth,RequestControlTuples(serverctrls),RequestControlTuples(clientctrls),sasl_flags)
File "C:\Python27\lib\site-packages\ldap\ldapobject.py", line 99, in _ldap_call
result = func(*args,**kwargs)
LOCAL_ERROR: {'desc': 'Local error'}
Could some one help me out?
Are you using Cyrus SASL as backend? If so, it compiled against MIT or Heimdal. You don't have access to the TGT. Search for registry key: session key tgt.
But Cyrus SASL is not really usable on Windows if you use GSS-API unless you try Kerberos for Windows.