leonjza / ooktools

📡 On-off keying tools for your SD-arrrR

Home Page:https://leonjza.github.io/blog/2016/10/08/ooktools-on-off-keying-tools-for-your-sdr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

not work on python 2.7 and python 3.8

Alpiskris opened this issue · comments

Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/local/lib/python2.7/dist-packages/ooktools/console.py", line 30, in
from .commands import information
File "/usr/local/lib/python2.7/dist-packages/ooktools/commands/information.py", line 33, in
numpy.set_printoptions(threshold=numpy.nan)
File "/usr/lib/python2.7/dist-packages/numpy/core/arrayprint.py", line 246, in set_printoptions
floatmode, legacy)
File "/usr/lib/python2.7/dist-packages/numpy/core/arrayprint.py", line 93, in _make_options_dict
raise ValueError("threshold must be numeric and non-NAN, try "
ValueError: threshold must be numeric and non-NAN, try sys.maxsize for untruncated representation

Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.9/dist-packages/ooktools/console.py", line 27, in
from .commands import converstions
File "/usr/local/lib/python3.9/dist-packages/ooktools/commands/converstions.py", line 31, in
from ..utilities import cleanup_wave_data
File "/usr/local/lib/python3.9/dist-packages/ooktools/utilities.py", line 27, in
import rflib
File "/usr/local/lib/python3.9/dist-packages/rflib/init.py", line 15
print "(%5.3f) %s: %s" % (t, msg, y.encode('hex'))
^
SyntaxError: invalid syntax

Hi,

I have exactly the same issue with python 3.8.7
...
ValueError: threshold must be non-NAN, try sys.maxsize for untruncated representation

I found a workaround that resolve the error.

You should comment out #numpy.set_printoptions(threshold=numpy.nan) which can be found in:
./ooktools/lib/python3.8/site-packages/ooktools/commands/information.py

in line # 33 comment out
#numpy.set_printoptions(threshold=numpy.nan)
and add
numpy.set_printoptions(threshold=sys.maxsize)

Happy to accept a PR to fix this!

I followed @auskimus comment, but I get another error:
NameError: name 'sys' is not defined

By only commenting #numpy.set_printoptions(threshold=numpy.nan) it works without any issues.
I'm using ooktools in a virtualenv using python 3.8.8

it took me a long while to get it working, but as advised by Leon, because the code is old and not maintained, I had to downgrade Numpy to an older version from 2016, the following is the change I made in /usr/local/lib/python2.7/dist-packages/ooktools-1.3-py2.7.egg/ooktools/commands/information.py:

Let numpy print full arrays

numpy.set_printoptions(threshold=numpy.nan)

numpy.set_printoptions(threshold=sys.maxsize)

comment out

Let numpy print full arrays

numpy.set_printoptions(threshold=numpy.nan)

added
numpy.set_printoptions(threshold=sys.maxsize)

Ok, I see now, it's because you're using python2.7, and a 2016 version of numpy.

I'm using python3.8 and I can't install a 2016 version of numpy, no supported I suppose.

ok, I'll try it now

Both 2016 version of numpy, and python2.7, are supported but still working

sorry I meant are not supported

Hi

just in case if things didn't go well;

from future import division
from future import print_function
from future import absolute_import

import click
import numpy
import sys <------------ add import sye

from ..utilities import cleanup_wave_data

Let numpy print full arrays

numpy.set_printoptions(threshold=sys.maxsize) <-------------edit from =numpy.nun to =sys.maxsize

Should be fixed in 1.4 now!