I solved the bind python exception as follows:

1. The bind command cannot be used with a blank argument, or (I think) with
multiple arguments.

Running the command this way:
$gr_modtool bind
GNU Radio module name identified: test01
Which blocks do you want to parse? (Regex):

there does not appear to be any answer that works when the command is
invoked this way. All
attempts throw the python exception. They also leave cruft in the
.python/bindings directory.

2. Instead:
 A) empty out the  ./python/bindings directory
 B) then invoke the bind command using one and only one block name with the
full command:

$gr_modtool bind the_one_block_name

This worked running through my list of blocks.

-- Tom, N5EG







On Sat, Apr 10, 2021 at 11:24 AM Tom McDermott <tom.n...@gmail.com> wrote:

> I tried adding a new super simple OOT project.  Of type general, adding
> one module (cpp) with one parameter.
> No code added anywhere.  I noticed that when adding the dummy module to
> this dummy OOT that I get 3 errors from gr_modtool add:
>
> Failed to run clang-format %s [Errno 2] no such file or directory:
> 'clang-format'
>
> But the .cc and .h files for the module are created.  Trying to run
> gr_modtool against that fails the same as before.
>
> Do I have multiple problems here?
> Am I missing some dependency for clang-format ?
>
> -- Tom, N5EG
>
>
>
>
>
>
> On Sat, Apr 10, 2021 at 12:22 AM Tom McDermott <tom.n...@gmail.com> wrote:
>
>> Thanks, Josh.    The OOT should be pretty standard.  It was built with
>> gr_modtool in 3.7,
>> then ported over to 3.8.  All the modules are in the normal places.
>> My guess is NoneType means that the module was not found, then trying to
>> append .h to
>> that fails.
>>
>> I tried running gr_modtool bind inside the gr_3.9/gr-hpsdr directory and
>> it fails in the exact same way.
>>
>> I guess at this point I'll have to see if there is some way to run
>> gr_modtool in a debugger and step through
>> what it is trying to do and how it is trying to find the modules.
>>
>> -- Tom, N5EG
>>
>>
>> On Fri, Apr 9, 2021 at 1:23 PM Josh Morman <mor...@gmail.com> wrote:
>>
>>> I haven't been able to replicate this on my system with Ubuntu 20.04 and
>>> Python 3.8.5  - created a 3.8 OOT with one block, and followed the steps to
>>> copy the 3.9 content back in, and it got past the `gr_modtool bind` step.
>>>
>>> Is there anything non-standard about your 3.8 OOT - e.g. are the files
>>> in the usual place as generated by modtool?
>>>
>>> On Fri, Apr 9, 2021 at 1:49 PM Tom McDermott <tom.n...@gmail.com> wrote:
>>>
>>>> Hi Josh - for creating the new 3.9 skeleton, I ran gr_modtool from
>>>> within the 3.9 directory.
>>>> For step 4, I ran gr_modtool from within the 3.8 directory (as per the
>>>> guide).
>>>>
>>>> Quite frankly, it looks like gr_modtool is throwing an error when
>>>> trying to
>>>> concatenate the module name and path and the .h suffix and suffering
>>>> a type mismatch  (NoneType vs. str).  Is this possibly a Python 3.x
>>>> version dependency?
>>>>
>>>> -- Tom, N5EG
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Fri, Apr 9, 2021 at 10:37 AM Josh Morman <mor...@gmail.com> wrote:
>>>>
>>>>> You are right - that is an easier process than merging the 3.8 code
>>>>> into 3.9.  The wiki should be correct in this case.
>>>>>
>>>>> Which directory are you running gr_modtool from?  Same directory as
>>>>> you would for doing things like gr_modtool add?
>>>>>
>>>>>
>>>>> On Fri, Apr 9, 2021 at 1:24 PM Tom McDermott <tom.n...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi Josh - thank you for your help !
>>>>>>
>>>>>> I have been following the instructions from the porting guide:
>>>>>>
>>>>>> https://wiki.gnuradio.org/index.php/GNU_Radio_3.9_OOT_Module_Porting_Guide
>>>>>>
>>>>>> ----------------
>>>>>>
>>>>>> Porting from 3.8 to 3.9 can be achieved most simply by creating a new
>>>>>> OOT module (with the same name as the 3.8 OOT but in a different
>>>>>> directory), then performing some manual steps
>>>>>>
>>>>>> 1. Use the 3.9 gr_modtool to generate a module with the same name (in
>>>>>> another directory)
>>>>>>
>>>>>> 2. Copy the python folder from 3.9 OOT into your 3.8 OOT
>>>>>>
>>>>>> 3. (in 3.8 OOT) Add the bindings directory to the python directory
>>>>>> CMakeLists
>>>>>>
>>>>>>    ./python/CMakeLists.txt  → add the line:
>>>>>>            add_subdirectory(bindings)
>>>>>>
>>>>>> 4. (in 3.8 OOT) Call gr_modtool bind for each block in your OOT
>>>>>>
>>>>>> ...
>>>>>>
>>>>>> -----------------
>>>>>> I have not created anything in the 3.9 directory except using
>>>>>> gr_modtool new and add, nor have I copied in any code
>>>>>> from 3.8 directory to the 3.9 directory.  I was under the impression
>>>>>> that step 4 would modify my 3.8 code so that I could
>>>>>> then copy it from the 3.8 directory over to the 3.9 directory.
>>>>>>
>>>>>> There are significant file differences between the newly created 3.9
>>>>>> and the existing 3.8  with conflicts in the /lib directory:
>>>>>> the  hermesNB_impl.h and .cc   and hermesWB.h and .cc files differ
>>>>>> significantly in content.
>>>>>>
>>>>>> Do I need to first look through the code and figure out how to merge
>>>>>> the 3.8 and 3.9 .h and .cc files together?
>>>>>> Then do I put those merged file into the 3.8 or the 3.9 directory?
>>>>>>
>>>>>> -- Tom, N5EG
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Fri, Apr 9, 2021 at 9:27 AM Josh Morman <mor...@gmail.com> wrote:
>>>>>>
>>>>>>> Tom,
>>>>>>>
>>>>>>> If I am following correctly, it looks like you are running
>>>>>>> gr_modtool (which is the 3.9 version since that is what you have 
>>>>>>> installed
>>>>>>> in the VM) in the 3.8 OOT directory?
>>>>>>> What happens when you run `gr_modtool bind` in the gr-hpsdr_3.9
>>>>>>> directory
>>>>>>>
>>>>>>> The process you are following seems sound to have created a 3.9 OOT
>>>>>>> with 3.9 modtool, and then copied code in from 3.8.
>>>>>>>
>>>>>>> Josh
>>>>>>>
>>>>>>> On Fri, Apr 9, 2021 at 12:08 PM Tom McDermott <tom.n...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> I am having difficulty porting an OOT module to gr 3.9.
>>>>>>>> * VM with only gnuradio 3.9.0.0 installed.
>>>>>>>> *The functional 3.8 OOT module is cloned into this VM.
>>>>>>>>
>>>>>>>> Installed is 3.9.0.0
>>>>>>>> Python 3.8.5
>>>>>>>> pygccxml 2.1.0
>>>>>>>> pybind11 2.6.2
>>>>>>>>
>>>>>>>> *  Created the gr-hpsdr_3.9  directory, populated it using
>>>>>>>> gr_modtool newmod, added the
>>>>>>>> two modules hermesNB and hermesWB with constructor parameters.
>>>>>>>>
>>>>>>>> In the 3.8 directory:
>>>>>>>>  hermesNB.h and hermesWB.h  both exist in the /include directory,
>>>>>>>> and
>>>>>>>>  hermesWB_impl.cc and hermesNB_impl.cc both  exist in the /lib
>>>>>>>> directory
>>>>>>>>  Edited the ./python/Cmakelists.txt file to add the bindings
>>>>>>>> subdirectory.
>>>>>>>>  From the directory gr-hpsdr_3.8/gr-hpsdr, I execute gr_modtool bind
>>>>>>>>  It prompts for the block name. I used the base module name without
>>>>>>>> any suffixes:
>>>>>>>>
>>>>>>>> hermesNB
>>>>>>>>
>>>>>>>> (also tried  hermesNB.h, hermesNB_impl.cc, hermesWB, hermewWB.h,
>>>>>>>> hermesWB_impl.cc)
>>>>>>>>
>>>>>>>> I always get the following error message:
>>>>>>>>
>>>>>>>>
>>>>>>>> tom@tom-Standard-PC-Q35-ICH9-2009:~/gr-hpsdr_3.8/gr-hpsdr$
>>>>>>>> gr_modtool bind
>>>>>>>> GNU Radio module name identified: hpsdr
>>>>>>>> Which blocks do you want to parse? (Regex): hermesNB
>>>>>>>> /usr/lib/python3/dist-packages/apport/report.py:13:
>>>>>>>> DeprecationWarning: the imp module is deprecated in favour of 
>>>>>>>> importlib;
>>>>>>>> see the module's documentation for alternative uses
>>>>>>>>   import fnmatch, glob, traceback, errno, sys, atexit, locale, imp,
>>>>>>>> stat
>>>>>>>> Traceback (most recent call last):
>>>>>>>>   File "/usr/bin/gr_modtool", line 18, in <module>
>>>>>>>>     cli()
>>>>>>>>   File "/usr/lib/python3/dist-packages/click/core.py", line 764, in
>>>>>>>> __call__
>>>>>>>>     return self.main(*args, **kwargs)
>>>>>>>>   File "/usr/lib/python3/dist-packages/click/core.py", line 717, in
>>>>>>>> main
>>>>>>>>     rv = self.invoke(ctx)
>>>>>>>>   File "/usr/lib/python3/dist-packages/click/core.py", line 1137,
>>>>>>>> in invoke
>>>>>>>>     return _process_result(sub_ctx.command.invoke(sub_ctx))
>>>>>>>>   File "/usr/lib/python3/dist-packages/click/core.py", line 956, in
>>>>>>>> invoke
>>>>>>>>     return ctx.invoke(self.callback, **ctx.params)
>>>>>>>>   File "/usr/lib/python3/dist-packages/click/core.py", line 555, in
>>>>>>>> invoke
>>>>>>>>     return callback(*args, **kwargs)
>>>>>>>>   File
>>>>>>>> "/usr/lib/python3/dist-packages/gnuradio/modtool/cli/base.py", line 
>>>>>>>> 133, in
>>>>>>>> wrapper
>>>>>>>>     return func(*args, **kwargs)
>>>>>>>>   File
>>>>>>>> "/usr/lib/python3/dist-packages/gnuradio/modtool/cli/bind.py", line 
>>>>>>>> 46, in
>>>>>>>> cli
>>>>>>>>     run(self)
>>>>>>>>   File
>>>>>>>> "/usr/lib/python3/dist-packages/gnuradio/modtool/cli/base.py", line 
>>>>>>>> 152, in
>>>>>>>> run
>>>>>>>>     module.run()
>>>>>>>>   File
>>>>>>>> "/usr/lib/python3/dist-packages/gnuradio/modtool/core/bind.py", line 
>>>>>>>> 61, in
>>>>>>>> run
>>>>>>>>     file_to_process = os.path.join(self.dir, self.info['includedir'],
>>>>>>>> self.info['blockname'] + '.h')
>>>>>>>> TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
>>>>>>>>
>>>>>>>> Thus am stuck at this time.    Is there a new or revised gr_modtool
>>>>>>>> ?
>>>>>>>>
>>>>>>>> -- Tom, N5EG
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>

Reply via email to