Commit 61dc1ff2 authored by Kirill Smelkov's avatar Kirill Smelkov

demo_zbigarray: Fix it for Python3

Wendelin.core already supports Python3 relatively well, but demo_zbigarray.py,
that is invoked only manually, was missing compatibility bits for xrange:

    (neo) (py3.venv) (g.env) kirr@deca:~/src/neo/src/lab.nexedi.com/nexedi/wendelin.core$ ./demo/demo_zbigarray.py gen 1.fs
    I: RAM:  15.29GB
    I: WORK: 30.57GB
    gen signal t=0...4.10e+09  float64  (= 30.57GB)
    Traceback (most recent call last):
      File "/home/kirr/src/wendelin/wendelin.core/./demo/demo_zbigarray.py", line 154, in <module>
        main()
      File "/home/kirr/src/wendelin/venv/py3.venv/lib/python3.9/site-packages/decorator.py", line 232, in fun
        return caller(func, *(extras + args), **kw)
      File "/home/kirr/src/tools/go/pygolang/golang/__init__.py", line 103, in _
        return f(*argv, **kw)
      File "/home/kirr/src/wendelin/wendelin.core/./demo/demo_zbigarray.py", line 142, in main
        gen(sig)
      File "/home/kirr/src/wendelin/wendelin.core/./demo/demo_zbigarray.py", line 74, in gen
        for t0 in xrange(0, len(a), blocksize):
    NameError: name 'xrange' is not defined

-> Fix it.
parent 3d0f134c
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2014-2019 Nexedi SA and Contributors. # Copyright (C) 2014-2022 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com> # Kirill Smelkov <kirr@nexedi.com>
# #
# This program is free software: you can Use, Study, Modify and Redistribute # This program is free software: you can Use, Study, Modify and Redistribute
...@@ -44,6 +44,8 @@ import psutil ...@@ -44,6 +44,8 @@ import psutil
import sys import sys
import getopt import getopt
from six.moves import range as xrange
KB = 1024 KB = 1024
MB = 1024*KB MB = 1024*KB
GB = 1024*MB GB = 1024*MB
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment