Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; '(at': 0.03; '"""': 0.05; 'attribute': 0.05; 'error:': 0.05; 'importerror:': 0.05; 'modify': 0.05; 'much!': 0.05; 'skip:" 60': 0.05; 'arguments': 0.07; 'purpose.': 0.07; 'try:': 0.07; 'wrapper': 0.07; 'python': 0.09; '(1,': 0.09; '__init__': 0.09; 'appropriate.': 0.09; 'assumed': 0.09; 'convenience': 0.09; 'derived': 0.09; 'disconnect': 0.09; 'dst,': 0.09; 'franklin': 0.09; 'hierarchical': 0.09; 'imported': 0.09; 'instance.': 0.09; 'name)': 0.09; 'name):': 0.09; 'software;': 0.09; 'src,': 0.09; 'subclass': 0.09; 'tuple': 0.09; 'zero.': 0.09; 'def': 0.10; 'assume': 0.11; 'fitness': 0.13; 'useful,': 0.13; 'advance.': 0.15; 'passing': 0.15; '(len': 0.16; '54,': 0.16; 'copying.': 0.16; 'disconnected': 0.16; 'dst):': 0.16; 'endp': 0.16; 'inputs': 0.16; 'interpreting': 0.16; 'len': 0.16; 'maillist': 0.16; 'outputs': 0.16; 'port)': 0.16; 'valueerror,': 0.16; 'warranty;': 0.16; 'later': 0.16; 'wrote:': 0.17; '<': 0.17; 'pointer': 0.17; 'thu,': 0.17; 'version.': 0.17; 'foundation,': 0.18; 'hack': 0.18; 'code,': 0.18; 'requests': 0.18; 'feb': 0.19; 'email addr:gmail.com>': 0.20; 'to:name:python-list@python.org': 0.20; 'sort': 0.21; 'trying': 0.21; 'import': 0.21; 'not,': 0.21; 'latter': 0.22; 'object.': 0.22; 'provided,': 0.22; 'skip:s 70': 0.22; '\xa0if': 0.22; 'skip:_ 20': 0.22; '>': 0.23; 'raise': 0.24; 'external': 0.24; 'allows': 0.25; 'least': 0.25; 'header:In- Reply-To:1': 0.25; '----------': 0.26; 'skip:" 20': 0.26; 'appreciated.': 0.26; 'skip:m 30': 0.26; '(most': 0.27; '----': 0.27; 'c++': 0.27; 'skip:s 60': 0.27; 'message- id:@mail.gmail.com': 0.27; 'run': 0.28; 'post': 0.28; 'block,': 0.29; 'forces': 0.29; 'i/o': 0.29; 'implied': 0.29; 'option)': 0.29; 'skip:& 70': 0.29; 'warranty': 0.29; 'date:': 0.29; 'url:mailman': 0.29; 'case,': 0.29; 'skip:_ 10': 0.29; 'skip:& 10': 0.29; 'class': 0.29; 'classes': 0.30; "skip:' 10": 0.30; 'call.': 0.30; 'skip:& 30': 0.30; 'code': 0.31; 'url:python': 0.32; 'file': 0.32; "skip:' 20": 0.32; 'running': 0.32; 'url:listinfo': 0.32; 'legacy': 0.33; 'traceback': 0.33; 'ubuntu': 0.33; 'to:addr:python-list': 0.33; 'skip:& 20': 0.33; 'skip:d 20': 0.34; 'version': 0.34; 'received:google.com': 0.34; 'thanks': 0.34; 'along': 0.35; 'needed': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'subject:': 0.36; 'except': 0.36; 'but': 0.36; 'url:org': 0.36; 'method': 0.36; 'should': 0.36; 'thank': 0.36; 'one,': 0.37; 'two': 0.37; 'skip:v 20': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'more': 0.63; 'replying': 0.64; 'here': 0.65; 'license': 0.65; 'published': 0.71; 'wire': 0.71; 'subject::': 0.83; '2013': 0.84; 'anywhere.': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=/VvRbHGma2ohUTO0durrpIlW0IgNluPFlJRvAeHRT+4=; b=TQw6lJ6VLjjrxOusO7/rBffeZHVvbLc1YyfkqWNJBRjSmLYu8jA6abE4DXpwLzc68C BQ5laeyCj1m0EQA8SOQuffsCZ5wN1OErPk1hfokH4Knixc1342EdXo/Q7eHBYeNpViKs O70JaH7G4s0DFQz1MWD3yyAPAH6lFNJUAy+hmkOtIeaY7LxSTcD2EoL4cB2p7IzVqI46 TFz9rR+1vTuQ+OkHY5ssV4vT+PCmAKp+eAurDAqhhUK+oXB63hhGQvkefqUD7xpjDjkW 6s0VFKlROVWbSFNVB6W5S6v+lBHWpl02+Gg4kndHKKqqEYpQobj+F/xuZSA6VwTPQcYv WPsQ== X-Received: by 10.60.7.67 with SMTP id h3mr20226669oea.31.1360872022424; Thu, 14 Feb 2013 12:00:22 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20130214194229.DE5Y4.84913.root@cdptpa-web10-z01> References: <20130214194229.DE5Y4.84913.root@cdptpa-web10-z01> From: Matt Jones Date: Thu, 14 Feb 2013 14:00:02 -0600 Subject: Fwd: Re: To: "python-list@python.org" Content-Type: multipart/alternative; boundary=e89a8f9240787b3b4004d5b4b5a9 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 445 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360872026 news.xs4all.nl 6840 [2001:888:2000:d::a6]:60047 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38882 --e89a8f9240787b3b4004d5b4b5a9 Content-Type: text/plain; charset=ISO-8859-1 Sending back to the maillist *Matt Jones* ---------- Forwarded message ---------- From: Date: Thu, Feb 14, 2013 at 1:42 PM Subject: Re: Re: To: Matt Jones thanks for replying Matt. I am using version 2.7.3. im not sure if this is right but here is the code from "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/hier_block2.py" # Copyright 2006,2007 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. # from gnuradio_core import hier_block2_swig try: import pmt except ImportError: from gruel import pmt # # This hack forces a 'has-a' relationship to look like an 'is-a' one. # # It allows Python classes to subclass this one, while passing through # method calls to the C++ class shared pointer from SWIG. # # It also allows us to intercept method calls if needed # class hier_block2(object): """ Python wrapper around the C++ hierarchical block implementation. Provides convenience functions and allows proper Python subclassing. """ def __init__(self, name, input_signature, output_signature): """ Create a hierarchical block with a given name and I/O signatures. """ self._hb = hier_block2_swig(name, input_signature, output_signature) def __getattr__(self, name): """ Pass-through member requests to the C++ object. """ if not hasattr(self, "_hb"): raise RuntimeError("hier_block2: invalid state--did you forget to call gr.hier_block2.__init__ in a derived class?") return getattr(self._hb, name) def connect(self, *points): """ Connect two or more block endpoints. An endpoint is either a (block, port) tuple or a block instance. In the latter case, the port number is assumed to be zero. To connect the hierarchical block external inputs or outputs to internal block inputs or outputs, use 'self' in the connect call. If multiple arguments are provided, connect will attempt to wire them in series, interpreting the endpoints as inputs or outputs as appropriate. """ if len (points) < 1: raise ValueError, ("connect requires at least one endpoint; %d provided." % (len (points),)) else: if len(points) == 1: self._hb.primitive_connect(points[0].to_basic_block()) else: for i in range (1, len (points)): self._connect(points[i-1], points[i]) def _connect(self, src, dst): (src_block, src_port) = self._coerce_endpoint(src) (dst_block, dst_port) = self._coerce_endpoint(dst) self._hb.primitive_connect(src_block.to_basic_block(), src_port, dst_block.to_basic_block(), dst_port) def _coerce_endpoint(self, endp): if hasattr(endp, 'to_basic_block'): return (endp, 0) else: if hasattr(endp, "__getitem__") and len(endp) == 2: return endp # Assume user put (block, port) else: raise ValueError("unable to coerce endpoint") def disconnect(self, *points): """ Disconnect two endpoints in the flowgraph. To disconnect the hierarchical block external inputs or outputs to internal block inputs or outputs, use 'self' in the connect call. If more than two arguments are provided, they are disconnected successively. """ if len (points) < 1: raise ValueError, ("disconnect requires at least one endpoint; %d provided." % (len (points),)) else: if len (points) == 1: self._hb.primitive_disconnect(points[0].to_basic_block()) else: for i in range (1, len (points)): self._disconnect(points[i-1], points[i]) def _disconnect(self, src, dst): (src_block, src_port) = self._coerce_endpoint(src) (dst_block, dst_port) = self._coerce_endpoint(dst) self._hb.primitive_disconnect(src_block.to_basic_block(), src_port, dst_block.to_basic_block(), dst_port) def msg_connect(self, src, srcport, dst, dstport): self.primitive_msg_connect(src.to_basic_block(), srcport, dst.to_basic_block(), dstport); def msg_disconnect(self, src, srcport, dst, dstport): self.primitive_msg_disconnect(src.to_basic_block(), srcport, dst.to_basic_block(), dstport); def message_port_register_hier_in(self, portname): self.primitive_message_port_register_hier_in(pmt.pmt_intern(portname)); def message_port_register_hier_out(self, portname): self.primitive_message_port_register_hier_out(pmt.pmt_intern(portname)); Thank you very much! ---------------------------------------------------------------------------------------- ---- Matt Jones wrote: > Please post the code, or a link to the code... > > Also, what version of python are you running this code over? > > *Matt Jones* > > > On Thu, Feb 14, 2013 at 12:26 PM, wrote: > > > using ubuntu 12.10 i am trying to run a python block, namely OP25, in > > GNU Radio Companion v3.6.3-35-g4435082f. i get the following error: > > > > Executing: "/home/matt/op25_grc.py" > > > > Imported legacy fsk4 > > Using Volk machine: ssse3_32 > > Traceback (most recent call last): > > File "/home/matt/op25_grc.py", line 493, in > > tb = op25_grc() > > File "/home/matt/op25_grc.py", line 231, in __init__ > > self.wxgui_fftsink2_0_0.set_callback(wxgui_fftsink2_0_0_callback) > > File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/hier_block2.py", > > line 54, in __getattr__ > > return getattr(self._hb, name) > > AttributeError: 'gr_hier_block2_sptr' object has no attribute > > 'set_callback' > > > > i cannot find any sort of solution on the web anywhere. any sort of help > > will be much appreciated. thanks in advance. > > > > -- > > http://mail.python.org/mailman/listinfo/python-list > > > > --e89a8f9240787b3b4004d5b4b5a9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Sending back to the maillist

Matt Jones


---------- Forwarded message ----------<= br>From: <md123@nycap.rr.com>
Date: T= hu, Feb 14, 2013 at 1:42 PM
Subject: Re: Re:
To: Matt Jones <matt.walker.jones@gmail.com>


thanks for replyi= ng Matt. =A0I am using version 2.7.3. =A0im not sure =A0if this is right bu= t here is the code from "/usr/local/lib/python2.7/dist-packages/gnurad= io/gr/hier_block2.py"



# Copyright 2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =A0See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. =A0If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
#

from gnuradio_core import hier_block2_swig
try:
=A0 =A0 import pmt
except ImportError:
=A0 =A0 from gruel import pmt

#
# This hack forces a 'has-a' relationship to look like an 'is-a= ' one.
#
# It allows Python classes to subclass this one, while passing through
# method calls to the C++ class shared pointer from SWIG.
#
# It also allows us to intercept method calls if needed
#
class hier_block2(object):
=A0 =A0 """
=A0 =A0 Python wrapper around the C++ hierarchical block implementation. =A0 =A0 Provides convenience functions and allows proper Python subclassing= .
=A0 =A0 """

=A0 =A0 def __init__(self, name, input_signature, output_signature):
=A0 =A0 =A0 =A0 """
=A0 =A0 =A0 =A0 Create a hierarchical block with a given name and I/O signa= tures.
=A0 =A0 =A0 =A0 """
=A0 =A0 =A0 =A0 self._hb =3D hier_block2_swig(name, input_signature, output= _signature)

=A0 =A0 def __getattr__(self, name):
=A0 =A0 =A0 =A0 """
=A0 =A0 =A0 =A0 Pass-through member requests to the C++ object.
=A0 =A0 =A0 =A0 """
=A0 =A0 =A0 =A0 if not hasattr(self, "_hb"):
=A0 =A0 =A0 =A0 =A0 =A0 raise RuntimeError("hier_block2: invalid state= --did you forget to call gr.hier_block2.__init__ in a derived class?")=
=A0 =A0 =A0 =A0 return getattr(self._hb, name)

=A0 =A0 def connect(self, *points):
=A0 =A0 =A0 =A0 """
=A0 =A0 =A0 =A0 Connect two or more block endpoints. =A0An endpoint is eith= er a (block, port)
=A0 =A0 =A0 =A0 tuple or a block instance. =A0In the latter case, the port = number is assumed
=A0 =A0 =A0 =A0 to be zero.

=A0 =A0 =A0 =A0 To connect the hierarchical block external inputs or output= s to internal block
=A0 =A0 =A0 =A0 inputs or outputs, use 'self' in the connect call.<= br>
=A0 =A0 =A0 =A0 If multiple arguments are provided, connect will attempt to= wire them in series,
=A0 =A0 =A0 =A0 interpreting the endpoints as inputs or outputs as appropri= ate.
=A0 =A0 =A0 =A0 """

=A0 =A0 =A0 =A0 if len (points) < 1:
=A0 =A0 =A0 =A0 =A0 =A0 raise ValueError, ("connect requires at least = one endpoint; %d provided." % (len (points),))
=A0 =A0 =A0 =A0 else:
=A0 =A0 =A0 =A0 =A0 =A0 if len(points) =3D=3D 1:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 self._hb.primitive_connect(points[0].to_bas= ic_block())
=A0 =A0 =A0 =A0 =A0 =A0 else:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for i in range (1, len (points)):
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 self._connect(points[i-1], points[i= ])

=A0 =A0 def _connect(self, src, dst):
=A0 =A0 =A0 =A0 (src_block, src_port) =3D self._coerce_endpoint(src)
=A0 =A0 =A0 =A0 (dst_block, dst_port) =3D self._coerce_endpoint(dst)
=A0 =A0 =A0 =A0 self._hb.primitive_connect(src_block.to_basic_block(), src_= port,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dst_= block.to_basic_block(), dst_port)

=A0 =A0 def _coerce_endpoint(self, endp):
=A0 =A0 =A0 =A0 if hasattr(endp, 'to_basic_block'):
=A0 =A0 =A0 =A0 =A0 =A0 return (endp, 0)
=A0 =A0 =A0 =A0 else:
=A0 =A0 =A0 =A0 =A0 =A0 if hasattr(endp, "__getitem__") and len(e= ndp) =3D=3D 2:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return endp # Assume user put (block, port)=
=A0 =A0 =A0 =A0 =A0 =A0 else:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 raise ValueError("unable to coerce end= point")

=A0 =A0 def disconnect(self, *points):
=A0 =A0 =A0 =A0 """
=A0 =A0 =A0 =A0 Disconnect two endpoints in the flowgraph.

=A0 =A0 =A0 =A0 To disconnect the hierarchical block external inputs or out= puts to internal block
=A0 =A0 =A0 =A0 inputs or outputs, use 'self' in the connect call.<= br>
=A0 =A0 =A0 =A0 If more than two arguments are provided, they are disconnec= ted successively.
=A0 =A0 =A0 =A0 """

=A0 =A0 =A0 =A0 if len (points) < 1:
=A0 =A0 =A0 =A0 =A0 =A0 raise ValueError, ("disconnect requires at lea= st one endpoint; %d provided." % (len (points),))
=A0 =A0 =A0 =A0 else:
=A0 =A0 =A0 =A0 =A0 =A0 if len (points) =3D=3D 1:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 self._hb.primitive_disconnect(points[0].to_= basic_block())
=A0 =A0 =A0 =A0 =A0 =A0 else:
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for i in range (1, len (points)):
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 self._disconnect(points[i-1], point= s[i])

=A0 =A0 def _disconnect(self, src, dst):
=A0 =A0 =A0 =A0 (src_block, src_port) =3D self._coerce_endpoint(src)
=A0 =A0 =A0 =A0 (dst_block, dst_port) =3D self._coerce_endpoint(dst)
=A0 =A0 =A0 =A0 self._hb.primitive_disconnect(src_block.to_basic_block(), s= rc_port,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= dst_block.to_basic_block(), dst_port)

=A0 =A0 def msg_connect(self, src, srcport, dst, dstport):
=A0 =A0 =A0 =A0 self.primitive_msg_connect(src.to_basic_block(), srcport, d= st.to_basic_block(), dstport);

=A0 =A0 def msg_disconnect(self, src, srcport, dst, dstport):
=A0 =A0 =A0 =A0 self.primitive_msg_disconnect(src.to_basic_block(), srcport= , dst.to_basic_block(), dstport);

=A0 =A0 def message_port_register_hier_in(self, portname):
=A0 =A0 =A0 =A0 self.primitive_message_port_register_hier_in(pmt.pmt_intern= (portname));

=A0 =A0 def message_port_register_hier_out(self, portname):
=A0 =A0 =A0 =A0 self.primitive_message_port_register_hier_out(pmt.pmt_inter= n(portname));


Thank you very much!
---------------------------------------------------------------------------= -------------

---- Matt Jones <matt.wal= ker.jones@gmail.com> wrote:
> Please post the code, or a link to the code...
>
> Also, what version of python are you running this code over?
>
> *Matt Jones*
>
>
> On Thu, Feb 14, 2013 at 12:26 PM, <md123@nycap.rr.com> wrote:
>
> > =A0 using ubuntu 12.10 i am trying to run a python block, namely = OP25, in
> > GNU Radio Companion v3.6.3-35-g4435082f. i get the following erro= r:
> >
> > Executing: "/home/matt/op25_grc.py"
> >
> > Imported legacy fsk4
> > Using Volk machine: ssse3_32
> > Traceback (most recent call last):
> > File "/home/matt/op25_grc.py", line 493, in <module&= gt;
> > tb =3D op25_grc()
> > File "/home/matt/op25_grc.py", line 231, in __init__ > > self.wxgui_fftsink2_0_0.set_callback(wxgui_fftsink2_0_0_callback)=
> > File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/hie= r_block2.py",
> > line 54, in __getattr__
> > return getattr(self._hb, name)
> > AttributeError: 'gr_hier_block2_sptr' object has no attri= bute
> > 'set_callback'
> >
> > i cannot find any sort of solution on the web anywhere. any sort = of help
> > will be much appreciated. thanks in advance.
> >
> > --
> > http://mail.python.org/mailman/listinfo/python-list > >
> >


--e89a8f9240787b3b4004d5b4b5a9--