Python Forum
How Do I Get the IDE to Find My Imports
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How Do I Get the IDE to Find My Imports
#11
(Feb-20-2019, 02:59 AM)petec Wrote: I have created copies of the folders anywhere I think it could be searching.

Actually this may be part of the problem, e.g. why it finds gr, but not what gr imports.

(Feb-20-2019, 02:59 AM)petec Wrote: I have a very short (20 lines or so) program that runs under 2.7 but not 3.7.

You must understand that even if you fix the imports (it finds the desired modules) it still will not work, because there are syntax differences between 2 and 3. For example these issues demonstrates changes that were made/must be made between gnuradio 3.7 and 3.8, so that 3.8 would work with python3

That said I'm not sure (i.e. I may be wrong, but I don't have time and desire to dig further) gnuradio is intended to work with different interpreter from the one that was bundled with it.

(Feb-19-2019, 06:13 PM)petec Wrote: Somehow I just think that if I could get the python 2.7 version of IDLE to run or if I can figure out why python 3.7 won't chain through the import(s) I might break my log jam

I am bit confused - you said if you click on the file it works (using python2 - I guess the one that comes bundled). But not works when open it in python3 IDLE (I guess - system wide installation). Now you say it doesn't work with python2, when open in IDLE.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#12
I didn't have the copies at first. I copied them trying to follow the python docs about finding import files. The problem might be with the wild card "import *". I believe in my experiments I was able to import just one specific file. But I have tried so many things over many hours so I could be wrong about that....just maybe.

As for more problems trying GNR with P3.7, I am sure you are right. I will never get it to work.

I have tried to use the version of IDLE that was bundled in 2.7 but I can't get it to run. There is a BAT file that sets up paths for IDLE but stepping through it one statement at a time seems OK but when the last statement says "start" nothing happens the window goes blank.

I CAN perform exactly the same sequence with the P3.7 version of IDLE and at that point the IDLE (3.7) shell opens.

"Python 2, Python 3, IDLE2, IDLE3, click to run vs run from IDLE". All this is getting hard for me to keep straight but:
Windows has been told to associate file types .py with P2. So clicking on the file runs P2.
The only IDLE I can run is 3 so if I open the file in I3 and try to run it errors out at the first import.
If I try to run the file with P3 the same thing happens.

I believe the release of GNURadio 3.8 is "lost". The last references I can find seem to be November 2017. If I knew what I was doing I might volunteer my time to help them.

Since ultimately my project will be hosted on a Raspberry Pi, and my RPi arrived a few days ago, maybe I should take the plunge to the RPi. I had hoped to do most of the development on this desktop.

Thanks for all your help and patience

Pete.
Reply
#13
Please be aware that just under the main python directory for each install, there is a directory named scripts the pip to use that is associated with that version of python will be in that directory. So if the version is not in your path, you can still install if you execute pip directly from the scripts directory Do a listing first as there may be two versions, pip.exe and pip3.exe if so, use pip3 for python 3. Also, if you execute:
pip list
# or if there is a pip3:
pip3 list
you will get a list of all installed packages.
Reply
#14
I am in a real quandary. I am about to abandon all attempts to use GNURadio and Python. I have spent 40 or 50 hours trying to untangle problems getting them to run. The lack of documentation makes the problem unfathomable.
In my last post I said I was going to leapfrog the problem of GNURadio, Python, and Windows and go straight to my intended final host, Raspberry Pi and Linux. Well I did the routine and got to GNURadio and it failed in an entirely different way. Searching reveals that this failure is well documented for over a year and no one has put out a workaround (that I can find).

I think it is time for me to quit trying to rely on other people's software. When it doesn't work I am at a loss to find a solution. It is time to strip away the GNURadio, Python, third party "blocks" and write all the code myself. And I'm thinking assembly code for the ARM. The majority of code that I have written in over 60 year has been assembly code. At that level, when I write a statement I know exactly what the processor will do. I don't have to be concerned with how many machine instructions some compiler will slap together or what path is needed to pull in some one else's undocumented code.

The unfortunate part of this is, I was going to make the result available to anyone. That could be difficult if it is hard coded.

Don't ding me too hard for the rant please.
Reply
#15
GNU Radio docs:
GNU Radio Manual and C++ API Reference: https://www.gnuradio.org/doc/doxygen/
GNU Radio python documentation: https://www.gnuradio.org/doc/sphinx/
GNU Radio Links wiki: https://wiki.gnuradio.org/index.php/Main_Page

Please keep in mind that GNU Radio python is a wrapper around the C++ software, so to get down to the nitty-gritty you may need to look at the C++ docs in addition to the python wrapper doc.

Also be aware that there is no relationship between python-forum.io and GNU Radio, nor between python-forum.io and Python.org, other than our mutual interest in Python programming, and a link to python-forum.io on the python.org page.
Reply
#16
Thanks Larz60.
I think I am burned out reading those docs trying to relate to my problems.
I started the thread here because the problem seemed to be with Python failing on the import.
Buran convinced me that it was GNURadio and I should wait for GNURadio 3.8 but the last mention of it was November 2017, "coming soon". I think I need something sooner.

I am exploring more nitty-gritty down to trying to get the basic Osmocom libs working.

Thanks for the help.
Pete
I'm not going to live long enough to do all I want to do.
Reply
#17
You can always get an older version of GNU Radio and use it until the new one comes out.
I understand the frustration with trying to get something installed, but once installed, you
usually never have to go the painfulness again as updates are 'usually' less painful.

You did re-interest me in Amateur Radio, I have been a Ham since 1969, (extra class) and have been inactive for the
past couple of years. I think you have reignited the fire, or at least heated up the embers, in me, so i will probably install GNU Radio in the next few days, and will record every step so I can create a tutorial. I'd tell you my call sign, but don't think the forum is a good place for that.

Tell me what RF device you were planning to use with the software, if you've already decided on one.
Reply
#18
I just installed gnuradio on linux mint without a hitch.
here's what I did There was a detailed install list which I attempted to copy, but is was immediately closed at end of install, so I didn't manage.
perhaps googling for your OS may find a similar installer, or at lease detailed install instructions.
Reply
#19
To summarize:
My install went without a hitch also.
Both on Windows and on Raspberry Pi.
The Windows version works fine but I wanted to edit top_block.py in IDLE.
The IDLE that came with Python 3 cannot be used because it can't import the GNURadio files.
I can't get the version of IDLE that came with Python 2 to run so I can't edit top_block.py.

So I installed GNURadio on my brand new Raspberry Pi (3 B+).
It will run most flow graphs except any that use either "osmocom Source" or "RTL-SDR Source" For those I get the error documented below.
Corrupted double-linked for Raspbian Stretch when running osmocom_fft (and any other program using osmosdr.source
I'm not going to live long enough to do all I want to do.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Imports that work with Python 3.8 fail with 3.9 and 3.10 4slam 1 2,543 Mar-11-2022, 01:50 PM
Last Post: snippsat
  Imports in my first package cuppajoeman 1 1,912 Jun-28-2021, 09:06 AM
Last Post: snippsat
  script with imports works but pytest gives "ModuleNotFoundError"? Hpao 0 1,544 Jun-27-2021, 08:30 PM
Last Post: Hpao
  Help wanted with python imports petros21 3 2,478 Apr-07-2021, 07:16 PM
Last Post: snippsat
Question How to include Modules not found (conditional imports) in my setup.py when I want to cff 0 3,765 Mar-17-2021, 11:57 AM
Last Post: cff
  threading across imports Nickd12 2 2,101 Nov-09-2020, 01:59 AM
Last Post: Nickd12
  refreshing imports seandepagnier 4 2,672 Sep-20-2020, 11:51 PM
Last Post: seandepagnier
  Multimode imports fine as script but not after compiling into exe chesschaser 0 2,371 Aug-13-2020, 01:28 PM
Last Post: chesschaser
  absolute imports between folders mikisDW 0 1,500 Aug-05-2020, 12:26 PM
Last Post: mikisDW
  Understanding the concept ( Modules , imports ) erfanakbari1 1 2,136 Nov-25-2019, 01:59 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020