Feb-19-2019, 04:54 AM
I have a .py program that runs using Python 2.7 but fails in Python 3.7.2.
It fails at the first import statement.
I started asking for help in thread:
https://python-forum.io/Thread-How-Do-I-...My-Imports
I started to wander around too much in that thread and I have tried many things since the last post.
I am pursuing the potential problem outlined in the title of this post. I simplified the program from that post. The one I am trying to run is below. If I run it with python 2.7 it runs fine. If I run it with python 3.7.2 the window opens then closes. If I load it into IDLE (python 3.7 version) and try to run it I get:
"Traceback (most recent call last):
File "(long path removed)gnuradio\gr\__init__.py", line 37, in <module>
from runtime_swig import *
ModuleNotFoundError: No module named 'runtime_swig'
(lots more error message removed)
It looks like "from gnuradio import gr" causes it to go to __init__.py which then has a step at line 37 which says "from runtime_swig import *" however gr desn't have runtime_swig. It has runtime_swig.py, runtime_swig.pyc, and runtime_swig.pyo.
Somehow python 2.7 doesn't mind this but python 3.7 does.
Any ideas?
It fails at the first import statement.
I started asking for help in thread:
https://python-forum.io/Thread-How-Do-I-...My-Imports
I started to wander around too much in that thread and I have tried many things since the last post.
I am pursuing the potential problem outlined in the title of this post. I simplified the program from that post. The one I am trying to run is below. If I run it with python 2.7 it runs fine. If I run it with python 3.7.2 the window opens then closes. If I load it into IDLE (python 3.7 version) and try to run it I get:
"Traceback (most recent call last):
File "(long path removed)gnuradio\gr\__init__.py", line 37, in <module>
from runtime_swig import *
ModuleNotFoundError: No module named 'runtime_swig'
(lots more error message removed)
It looks like "from gnuradio import gr" causes it to go to __init__.py which then has a step at line 37 which says "from runtime_swig import *" however gr desn't have runtime_swig. It has runtime_swig.py, runtime_swig.pyc, and runtime_swig.pyo.
Somehow python 2.7 doesn't mind this but python 3.7 does.
Any ideas?
from gnuradio import gr from gnuradio import audio from gnuradio import analog class my_top_block(gr.top_block): def __init__(self): gr.top_block.__init__(self) sample_rate = 32000 ampl = 0.1 src0 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 350, ampl) src1 = analog.sig_source_f(sample_rate, analog.GR_SIN_WAVE, 440, ampl) dst = audio.sink(sample_rate, "") self.connect(src0, (dst, 0)) self.connect(src1, (dst, 1)) if __name__ == '__main__': try: my_top_block().run() except [[KeyboardInterrupt]]: pass