Hallo,
I tried to set the port value of a XMLRPC client and server script in
GRC with a parameter.
In GRC I set a parameter "port" with type "int" and default value 8080.
The server script worked fine, but running the client script I get
following error:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/gnuradio/qtgui/range.py", line
196, in changed
self.notifyChanged(self.rangeType(value))
File "/usr/lib/python2.7/dist-packages/gnuradio/qtgui/range.py", line
242, in counterChanged
self.notifyChanged(self.rangeType(value))
File "/home/christian/xmlrpc_client_test.py", line 91, in set_v_value
self.xmlrpc_client_0.set_value(self.v_value)
File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python2.7/xmlrpclib.py", line 1303, in single_request
h = self.make_connection(host)
File "/usr/lib/python2.7/xmlrpclib.py", line 1389, in make_connection
self._connection = host, httplib.HTTPConnection(chost)
File "/usr/lib/python2.7/httplib.py", line 751, in __init__
(self.host, self.port) = self._get_hostport(host, port)
File "/usr/lib/python2.7/httplib.py", line 792, in _get_hostport
raise InvalidURL("nonnumeric port: '%s'" % host[i+1:])
httplib.InvalidURL: nonnumeric port: 'port'
looking to the XML of both Blocks I saw the
/usr/share/gnuradio/grc/blocks/xmlrpc_client.xml
###################################################
##Simple XMLRPC Client
###################################################
...
<make>xmlrpclib.Server('http://$(addr()):$(port)')</make>
...
/usr/share/gnuradio/grc/blocks/xmlrpc_server.xml
###################################################
##Simple XMLRPC Server
###################################################
...
<make>SimpleXMLRPCServer.SimpleXMLRPCServer(($addr, $port),
allow_none=True)
...
so I changed the
...<make>xmlrpclib.Server('http://$(addr()):$(port)')</make>
to <make>xmlrpclib.Server('http://$(addr()):' +str($(port)))</make>
Is this right way to do so, or is there an easier way to pass the
variable in GRC to the XMLRPC Client Block?
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio