discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Import error using an OOT


From: Johannes Demel
Subject: Re: Import error using an OOT
Date: Mon, 12 Dec 2022 18:00:20 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

Hi all,

it looks like there's a path issue.

In line 34 in "run_response.py" you do
```
parser.read('./ft8_qso.conf')
```
There's a good chance, that you did not load this file.
I assume this is:
https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.read

> If none of the named files exist, the ConfigParser instance will
> contain an empty dataset. An application which requires initial values
> to be loaded from a file should load the required file or files using
> read_file() before calling read() for any optional files:

The `./` part in you file name is relative to the folder where you run Python. It is not relative to the `.py` file.

Anyways, You might want to check which file gets read when etc.

Cheers
Johannes

On 12.12.22 15:27, Elmore Family wrote:
You are confusing main() in run_response.py with the ‘main’ section in ft8_qso.conf. parser.get in line 36 is looking for the ‘main’ section but throws the NoSectionError.
Why can’t the parser see the ‘main’ section?
When I said I have run an OOT before, I meant another OOT which runs well in this same app. However, this is irrelevant since we are not talking about the same problem.
Jim
*From:* Cinaed Simson
*Sent:* Monday, December 12, 2022 12:57 AM
*To:* Elmore Family
*Cc:* discuss-gnuradio@gnu.org
*Subject:* Re: Import error using an OOT
The main method is defined beginning on line 216 and called 4 times on lines 36-39.

And it appears the configparser is throwing the NoSectionError.

Try commenting out line 36 to see if line 37 throws the same exception.

When you said is has run before, did it run under python3.9?

-- Cinaed


On 12/11/22 19:11, Elmore Family wrote:
I have attached the 2 files in question. Look at the beginning of run_response.py. It uses ConfigParser to access the ft8_qso.conf configuration file. This line seems to be the problem: my_call = str(parser.get('main', 'my_call_sign')). But ‘main’ is a section in the ft8_qso.conf file. Why can’t it find ‘main’?
Jim
*From:* Cinaed Simson
*Sent:* Sunday, December 11, 2022 8:52 PM
*To:* Elmore Family
*Cc:* discuss-gnuradio@gnu.org
*Subject:* Re: Import error using an OOT
The problem appears to be in the python code

  response.py

- there is no 'main()' method.

-- Cinaed

On 12/11/22 09:48, Elmore Family wrote:
Here is the result:

pi@raspberrypi:~ $ python3
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ft8
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/dist-packages/ft8/__init__.py", line 23, in <module>
from .run_response import run_response
File "/usr/local/lib/python3.9/dist-packages/ft8/run_response.py", line 36, in <module>
my_call = str(parser.get('main', 'my_call_sign'))
File "/usr/lib/python3.9/configparser.py", line 781, in get
d = self._unify_values(section, vars)
File "/usr/lib/python3.9/configparser.py", line 1149, in _unify_values
raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'main'

Jim

*From:* Cinaed Simson
*Sent:* Sunday, December 11, 2022 12:15 AM
*To:* discuss-gnuradio@gnu.org
*Subject:* Re: Import error using an OOT
Type

   python3

then enter

  import ft8

and see if it works.

-- Cinaed


On 12/9/22 18:33, Elmore's wrote:
I have created an OOT which when I incorporate it in my flowgraph shows the following error:
Failed to evaluate import expression ‘import ft8’
The yaml file is:
id: ft8_run_response
label: ft8
category: '[ft8]'
templates:
  imports: import ft8
  make: ft8.run_response(${ft8_button})
  callbacks:
  - set_ft8(${ft8_button})
#  Make one 'parameters' list entry for every parameter you want settable from the GUI.
#     Keys include:
#     * id (makes the value accessible as keyname, e.g. in the make entry)
#     * label (label shown in the GUI)
#     * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...)
#     * default
parameters:
- id: ft8_button
  label: ft8_button
  dtype: raw
  default: 0
#  'file_format' specifies the version of the GRC yml format used in the file
#  and should usually not be changed.
file_format: 1
I have developed and used an OOT before without an issue. I looked at the previous OOT and reviewed the GNU Radio docs on OOTs without seeing anything different.
I am using Python 3.92 with GNU radio 3.9.4.0 on a Raspberry Pi.
I hope someone can show me the error of my ways.
Jim

<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
  Virus-free.www.avg.com 
<http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>




Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]