discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: Import Block "bad import syntax"


From: Elmore Family
Subject: Re: Import Block "bad import syntax"
Date: Wed, 11 Nov 2020 14:10:25 -0500

Barry,

1) I tried this and I can specify import testpy without getting a bad syntax error. I generated my softrock module in exactly the same manner but still get the bad syntax error.

Note that my document does say import testpy, not import squareme as you mentioned. Also, in order for it to work in test_var testpy.squareme(12) is correct.

2) When I originally created softrock I did so in a directory called Softrock. Upon seeing that testpy worked I moved the gr-softrock directory to ~/ but still no joy.

3) My intent is to create a module which will communicate with my softrock xcvr through its' USB interface using a PTT button and some means of frequency adjustment (slider or text entry). I specifically want to be able to issue PTT and Frequency commands. As a test I created an OOT module following the OOT tutorial and placed some USB code retrieved from Quisk code and was able to issue a PTT command. However, I couldn't seem to go much farther with my ideas without considerable difficulty if at all. So I abandoned this approach. That's when I came across the idea of using a noblock module so that I didn't need to deal with in/out and could put any code in there that I need.

4) I tried creating an Embedded Python Module some time ago but encountered numerous errors including Import Error: No module named epy_block_0, and Attribute Error. The latter I could not resolve after much anguish and abandoned this approach.

Note that this is the first I have worked with gnuradio or Python. I have found gnuradio to be a particularly difficult nut to crack. My professional background (now retired) was in Embedded Programming mostly in C and Assembly.

73,
Jim WA4YWM

-----Original Message----- From: Barry Duggan
Sent: Wednesday, November 11, 2020 10:46 AM
To: Elmore Family
Cc: Discuss Gnuradio
Subject: Re: Import Block "bad import syntax"

Hi Jim,

1) Have you done
https://wiki.gnuradio.org/index.php/TutorialPythonFunctions with the
changes I suggested? Did it work?

2) Did you create ~/gr-softrock in the same manner as that tutorial?

3) What is your module going to do? Is it just an audio input from a USB
dongle such as the 'Plugable USB Audio Adapter' I use on my rPi? If so,
you can use the Audio Source block with the appropriate device name for
the USB device. Look at
https://wiki.gnuradio.org/index.php/Simulation_example:_AM_transmitter_and_receiver#AM_transmitter
for an example.

4) Otherwise, it would probably be a lot simpler to use an Embedded
Python Block (https://wiki.gnuradio.org/index.php/Embedded_Python_Block)
for your softrock_usb.py program.

Keep me posted.

P.S. If you 'reply all' it will get included in the Discuss Gnuradio thread.
---
Barry Duggan KV4FV
https://github.com/duggabe

On 11/10/20 9:46 PM, Elmore Family wrote:
Barry,

Nice to be in touch with a fellow ham.

I am using 3.7.5 loaded using apt-get install.

I have been through the OOT tutorial, built the module in the tutorial as a test. Also, added some code to it to communicate with the Softrock via USB.

However, I can't accomplish much more. Using a noblock module I think will solve my problem.

But back to the basic question - how is import softrock bad syntax?

73,
Jim WA4YWM

-----Original Message----- From: Barry Duggan
Sent: Tuesday, November 10, 2020 10:22 PM
To: wa4ywm@comcast.net
Cc: Discuss Gnuradio
Subject: Re: Import Block "bad import syntax"

Hi Jim,

The tutorial you cited has been deprecated in GR 3.8. Also, it doesn't
work as written! At this point we have chosen not to update or correct
it. The recommended tutorial is
https://wiki.gnuradio.org/index.php/OutOfTreeModules

What version of GR do you have on your rPi, and how did you load it?

For the tutorial you referenced, your Import should be for testpy and
not squareme. Also, for the Variable test_var, the value should be
squareme(12) without the "testpy." in front of it.

73,
---
Barry Duggan KV4FV
https://github.com/duggabe

---
On Mon, 9 Nov 2020 10:13:53 -0500, Elmore's wrote:

I have a problem as indicated in the subject line that has me totally
baffled.

I have created a noblock module with gr_modtool called softrock. This
module has been successfully created and lives in
/usr/local/lib/python2.7/dist-packages/softrock. It contains a file
softrock_usb.py.

I have an existing flowgraph in which I select an Import block. In the
Import line in Properties I type “import softrock” (without quotes). I
get the error “bad import syntax”.

I used the document TutorialPythonFunctions from the gnuradio wiki as
guidance for this task.

I have performed extensive searching for this issue but everything
points back to simply adding the word “import” in front of the module name.

I have tried completely clearing the text box thinking that there might
be extraneous characters present.

This seems so simple that I am baffled why it isn’t working.

My platform is a Raspberry Pi 3 with Raspbian Jessie.

Thanks for any help you might give me.

Jim



--
This email has been checked for viruses by AVG.
https://www.avg.com



reply via email to

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