worldveil / dejavu

Audio fingerprinting and recognition in Python
MIT License
6.45k stars 1.44k forks source link

Problem running the sample project #302

Closed shahabes closed 1 year ago

shahabes commented 1 year ago

I'm new using the Dejavu library. I've created a new project and used the library.

from dejavu import Dejavu
config = {
    "database": {
        "host": "127.0.0.1",
        "user": "root",
        "password": "", 
        "database": "dejavu",
        }
    }

djv = Dejavu(config)
djv.fingerprint_directory("mp3", [".mp3"], 0)
print(djv.db.get_num_fingerprints())

After some installations using pip, I face the following problem. I also added the ffmpeg to my path (Windows). Please help me solve the problem.

  main_content = runpy.run_path(main_path,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 291, in run_path
    main_content = runpy.run_path(main_path,
    main_content = runpy.run_path(main_path,
    main_content = runpy.run_path(main_path,
  File "<frozen runpy>", line 98, in _run_module_code
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 88, in _run_code
  File "<frozen runpy>", line 291, in run_path
  File "<frozen runpy>", line 291, in run_path
  File "<frozen runpy>", line 291, in run_path
  File "C:Desktop\dejavu\app.py", line 1, in <module>
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "<frozen runpy>", line 88, in _run_code
    from dejavu import Dejavu
  File "<frozen runpy>", line 88, in _run_code
  File "C:Desktop\dejavu\app.py", line 1, in <module>
  File "C:Desktop\dejavu\app.py", line 1, in <module>
  File "C:Desktop\dejavu\dejavu\__init__.py", line 18, in <module>
  File "C:Desktop\dejavu\app.py", line 1, in <module>
    from dejavu import Dejavu
    from dejavu import Dejavu
  File "C:Desktop\dejavu\dejavu\__init__.py", line 18, in <module>
    from dejavu import Dejavu
  File "C:Desktop\dejavu\dejavu\__init__.py", line 18, in <module>
    from dejavu.logic.fingerprint import fingerprint
  File "C:Desktop\dejavu\dejavu\__init__.py", line 18, in <module>
    from dejavu.logic.fingerprint import fingerprint
  File "C:Desktop\dejavu\dejavu\logic\fingerprint.py", line 6, in <module>
    from dejavu.logic.fingerprint import fingerprint
    from dejavu.logic.fingerprint import fingerprint
  File "C:Desktop\dejavu\dejavu\logic\fingerprint.py", line 6, in <module>
    import matplotlib.pyplot as plt
  File "C:Desktop\dejavu\dejavu\logic\fingerprint.py", line 6, in <module>
  File "C:Desktop\dejavu\dejavu\logic\fingerprint.py", line 6, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\pyplot.py", line 56, in <module>
    import matplotlib.pyplot as plt
    import matplotlib.pyplot as plt
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\pyplot.py", line 56, in <module>
    import matplotlib.pyplot as plt
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\pyplot.py", line 56, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\pyplot.py", line 56, in <module>
    import matplotlib.colorbar
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\colorbar.py", line 19, in <module>
    import matplotlib.colorbar
    import matplotlib.colorbar
    import matplotlib.colorbar
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\colorbar.py", line 19, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\colorbar.py", line 19, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\colorbar.py", line 19, in <module>
    from matplotlib import _api, cbook, collections, cm, colors, contour, ticker
    from matplotlib import _api, cbook, collections, cm, colors, contour, ticker
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\collections.py", line 20, in <module>
    from matplotlib import _api, cbook, collections, cm, colors, contour, ticker
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\collections.py", line 1565,in <module>
    from matplotlib import _api, cbook, collections, cm, colors, contour, ticker
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\collections.py", line 20, in <module>
    from . import (_api, _path, artist, cbook, cm, colors as mcolors, _docstring,
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\collections.py", line 961, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 1860, in <module>
    from . import (_api, _path, artist, cbook, cm, colors as mcolors, _docstring,
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\lines.py", line 1467, in <module>
    class EventCollection(LineCollection):
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 150, in __init_subclass__
    class _CollectionWithSizes(Collection):
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 150, in __init_subclass__
    cls._update_set_signature_and_docstring()
    Artist._update_set_signature_and_docstring()
    class AxLine(Line2D):
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 178, in _update_set_signature_and_docstring
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 171, in _update_set_signature_and_docstring
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 150, in __init_subclass__
    cls._update_set_signature_and_docstring()
    + kwdoc(cls))
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 171, in _update_set_signature_and_docstring
    for prop in ArtistInspector(cls).get_setters()
      ^^^^^^^^^^
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    cls._update_set_signature_and_docstring()
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 1856, in kwdoc
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 1530, in get_setters
    for prop in ArtistInspector(cls).get_setters()
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 178, in _update_set_signature_and_docstring
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 1530, in get_setters
    + kwdoc(cls))
      ^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 1856, in kwdoc
    or self.number_of_parameters(func) < 2
    'Properties:\n' + '\n'.join(ai.pprint_setters(leadingspace=4)))
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 1540, in number_of_parameters
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    or self.number_of_parameters(func) < 2
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 1617, in pprint_setters
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 1540, in number_of_parameters
    'Properties:\n' + '\n'.join(ai.pprint_setters(leadingspace=4)))
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    return len(inspect.signature(func).parameters)
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 1617, in pprint_setters
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 3279, in signature
    accepts = self.get_valid_values(prop)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 1500, in get_valid_values
    return len(inspect.signature(func).parameters)
    accepts = self.get_valid_values(prop)
               ^^^^^^^^^^^^^^^^^^^^^^^
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\artist.py", line 1484, in get_valid_values
  File "C:AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 3279, in signature
    match = re.search(fr"(?m)^ *\*?{param_name} : (.+)", docstring)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\re\__init__.py", line 173, in search
    docstring = inspect.getdoc(func)
                ^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 865, in getdoc
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 3027, in from_callable
    def search(pattern, string, flags=0):

KeyboardInterrupt
    return cleandoc(doc)
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 3027, in from_callable
    return _signature_from_callable(obj, sigcls=cls,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 2514, in _signature_from_callable
    return _signature_from_callable(obj, sigcls=cls,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 2463, in _signature_from_callable
    return _signature_from_function(sigcls, obj,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 2376, in _signature_from_function
    obj = unwrap(obj, stop=(lambda f: hasattr(f, "__signature__")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           ^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 762, in unwrap
  File "C:AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 888, in cleandoc
    parameters.append(Parameter(name, annotation=annotation,
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 2685, in __init__
    while _is_wrapper(func):
    for i in range(1, len(lines)): lines[i] = lines[i][margin:]
                                   ~~~~~^^^
KeyboardInterrupt
    self._kind = _ParameterKind(kind)
          ^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 756, in _is_wrapper
                 ^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\enum.py", line 714, in __call__
    return hasattr(f, '__wrapped__') and not stop(f)
    return cls.__new__(cls, value)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\enum.py", line 1093, in __new__
KeyboardInterrupt
    def __new__(cls, value):

KeyboardInterrupt
Traceback (most recent call last):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 120, in spawn_main
Traceback (most recent call last):
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 120, in spawn_main
    exitcode = _main(fd, parent_sentinel)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 129, in _main
  File "<string>", line 1, in <module>
  File "<string>", line 1, in <module>
    exitcode = _main(fd, parent_sentinel)
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 120, in spawn_main
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 120, in spawn_main
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
    prepare(preparation_data)
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 129, in _main
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 240, in prepare
    exitcode = _main(fd, parent_sentinel)
    exitcode = _main(fd, parent_sentinel)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
    prepare(preparation_data)
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 129, in _main
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 129, in _main
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 240, in prepare
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 291, in _fixup_main_from_path
    prepare(preparation_data)
    prepare(preparation_data)
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 240, in prepare
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 240, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
    main_content = runpy.run_path(main_path,
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 291, in _fixup_main_from_path
    _fixup_main_from_path(data['init_main_from_path'])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 291, in _fixup_main_from_path
  File "<frozen runpy>", line 291, in run_path
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 291, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "<frozen runpy>", line 98, in _run_module_code
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 88, in _run_code
    main_content = runpy.run_path(main_path,
  File "<frozen runpy>", line 291, in run_path
  File "C:Desktop\dejavu\app.py", line 1, in <module>
    main_content = runpy.run_path(main_path,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 98, in _run_module_code
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 291, in run_path
  File "<frozen runpy>", line 88, in _run_code
    from dejavu import Dejavu
  File "<frozen runpy>", line 291, in run_path
  File "<frozen runpy>", line 98, in _run_module_code
  File "C:Desktop\dejavu\app.py", line 1, in <module>
  File "C:Desktop\dejavu\dejavu\__init__.py", line 18, in <module>
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "C:Desktop\dejavu\app.py", line 1, in <module>
    from dejavu import Dejavu
  File "<frozen runpy>", line 88, in _run_code
    from dejavu.logic.fingerprint import fingerprint
    from dejavu import Dejavu
  File "C:Desktop\dejavu\app.py", line 1, in <module>
  File "C:Desktop\dejavu\dejavu\__init__.py", line 18, in <module>
  File "C:Desktop\dejavu\dejavu\logic\fingerprint.py", line 5, in <module>
    from dejavu import Dejavu
  File "C:Desktop\dejavu\dejavu\__init__.py", line 18, in <module>
    from dejavu.logic.fingerprint import fingerprint
  File "C:Desktop\dejavu\dejavu\__init__.py", line 18, in <module>
    import matplotlib.mlab as mlab
  File "C:Desktop\dejavu\dejavu\logic\fingerprint.py", line 6, in <module>
    from dejavu.logic.fingerprint import fingerprint
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\__init__.py", line 174, in <module>
    from dejavu.logic.fingerprint import fingerprint
  File "C:Desktop\dejavu\dejavu\logic\fingerprint.py", line 5, in <module>
    import matplotlib.pyplot as plt
  File "C:Desktop\dejavu\dejavu\logic\fingerprint.py", line 5, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\pyplot.py", line 56, in <module>
    import matplotlib.mlab as mlab
    from . import _api, _version, cbook, _docstring, rcsetup
    import matplotlib.mlab as mlab
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\__init__.py", line 1517, in<module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\rcsetup.py", line 28, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\__init__.py", line 272, in <module>
    import matplotlib.colorbar
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\colorbar.py", line 19, in <module>
    from matplotlib._fontconfig_pattern import parse_fontconfig_pattern
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\_fontconfig_pattern.py", line 26, in <module>
    from matplotlib import _api, cbook, collections, cm, colors, contour, ticker
    _check_versions()
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\collections.py", line 20, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\__init__.py", line 257, in _check_versions
    _value_escape = partial(re.compile(r'(?=[%s])' % _value_punc).sub, r'\\')
    from matplotlib.cm import _colormaps as colormaps
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    from . import (_api, _path, artist, cbook, cm, colors as mcolors, _docstring,
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\cm.py", line 235, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\re\__init__.py", line 227, in compile
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\lines.py", line 17, in <module>
    from . import ft2font
KeyboardInterrupt
    _colormaps = ColormapRegistry(_gen_cmap_registry())
    from .markers import MarkerStyle
                                  ^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\cm.py", line 44, in _gen_cmap_registry
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
    return _compile(pattern, flags)
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 936, in exec_module
    colors.LinearSegmentedColormap.from_list(name, spec, _LUTSIZE))
  File "C:AppData\Local\Programs\Python\Python311\Lib\re\__init__.py", line 294, in _compile
  File "<frozen importlib._bootstrap_external>", line 1032, in get_code
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 1130, in get_data
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\colors.py", line 1065, in from_list
KeyboardInterrupt
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\re\_compiler.py", line 747, in compile
    r, g, b, a = to_rgba_array(colors).T
                 ^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\matplotlib\colors.py", line 499, in to_rgba_array
    code = _code(p, flags)
           ^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\re\_compiler.py", line 580, in _code
    rgba = np.column_stack([c, np.ones(len(c))])
                               ^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\numeric.py", line 150, in ones
    _compile(code, p.data, flags)
  File "C:AppData\Local\Programs\Python\Python311\Lib\re\_compiler.py", line 155, in _compile
    @set_array_function_like_doc

KeyboardInterrupt
    _compile(code, av[1], flags)
  File "C:AppData\Local\Programs\Python\Python311\Lib\re\_compiler.py", line 86, in _compile
    charset, hascased = _optimize_charset(av, iscased, tolower, fixes)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\re\_compiler.py", line 337, in _optimize_charset
    data = _mk_bitmap(charmap)
           ^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\re\_compiler.py", line 386, in _mk_bitmap
    return [_int(s[i - _CODEBITS: i], 2)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\re\_compiler.py", line 386, in <listcomp>
    return [_int(s[i - _CODEBITS: i], 2)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
Traceback (most recent call last):
  File "<string>", line 1, in <module>
Traceback (most recent call last):
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 120, in spawn_main
Traceback (most recent call last):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 120, in spawn_main
  File "<string>", line 1, in <module>
  File "<string>", line 1, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 120, in spawn_main
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 120, in spawn_main
    exitcode = _main(fd, parent_sentinel)
    exitcode = _main(fd, parent_sentinel)
    exitcode = _main(fd, parent_sentinel)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
    exitcode = _main(fd, parent_sentinel)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 129, in _main
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 129, in _main
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 129, in _main
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 129, in _main
    prepare(preparation_data)
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 240, in prepare
    prepare(preparation_data)
    prepare(preparation_data)
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 240, in prepare
    prepare(preparation_data)
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 240, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 291, in _fixup_main_from_path
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 240, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 291, in _fixup_main_from_path
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 291, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 291, in run_path
    _fixup_main_from_path(data['init_main_from_path'])
    main_content = runpy.run_path(main_path,
  File "<frozen runpy>", line 98, in _run_module_code
    main_content = runpy.run_path(main_path,
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 291, in _fixup_main_from_path
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 88, in _run_code
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 291, in run_path
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 291, in run_path
  File "C:Desktop\dejavu\app.py", line 1, in <module>
    main_content = runpy.run_path(main_path,
  File "<frozen runpy>", line 88, in _run_code
  File "<frozen runpy>", line 98, in _run_module_code
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:Desktop\dejavu\app.py", line 1, in <module>
    from dejavu import Dejavu
  File "<frozen runpy>", line 88, in _run_code
  File "<frozen runpy>", line 291, in run_path
  File "C:Desktop\dejavu\dejavu\__init__.py", line 9, in <module>
  File "C:Desktop\dejavu\app.py", line 1, in <module>
    from dejavu import Dejavu
  File "C:Desktop\dejavu\dejavu\__init__.py", line 9, in <module>
  File "<frozen runpy>", line 98, in _run_module_code
    import dejavu.logic.decoder as decoder
    from dejavu import Dejavu
    import dejavu.logic.decoder as decoder
  File "C:Desktop\dejavu\dejavu\logic\decoder.py", line 6, in <module>
  File "<frozen runpy>", line 88, in _run_code
  File "C:Desktop\dejavu\app.py", line 1, in <module>
    import numpy as np
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\__init__.py", line 152, in <module>
  File "C:Desktop\dejavu\dejavu\logic\decoder.py", line 6, in <module>
    import numpy as np
    from dejavu import Dejavu
  File "C:Desktop\dejavu\dejavu\__init__.py", line 9, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\__init__.py", line 152, in <module>
  File "C:Desktop\dejavu\dejavu\__init__.py", line 9, in <module>
    import dejavu.logic.decoder as decoder
  File "C:Desktop\dejavu\dejavu\logic\decoder.py", line 6, in <module>
    from . import random
    from . import random
    import dejavu.logic.decoder as decoder
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\random\__init__.py", line 180, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\random\__init__.py", line 180, in <module>
    import numpy as np
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\__init__.py", line 154, in <module>
    from . import _pickle
    from . import _pickle
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\random\_pickle.py", line 3, in <module>
  File "C:Desktop\dejavu\dejavu\logic\decoder.py", line 6, in <module>
    from . import ma
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\ma\__init__.py", line 42, in <module>
    import numpy as np
    from ._pcg64 import PCG64, PCG64DXSM
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\random\_pickle.py", line 4, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\__init__.py", line 154, in <module>
    from . import core
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\ma\core.py", line 24, in <module>
  File "<frozen importlib._bootstrap>", line 405, in parent
KeyboardInterrupt
    from . import ma
    from ._sfc64 import SFC64
    import inspect
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\ma\__init__.py", line 42, in <module>
  File "<frozen importlib._bootstrap>", line 405, in parent
KeyboardInterrupt
    from . import core
  File "C:AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\ma\core.py", line 24, in <module>
    import inspect
  File "C:AppData\Local\Programs\Python\Python311\Lib\inspect.py", line 138, in <module>
    import dis
  File "C:AppData\Local\Programs\Python\Python311\Lib\dis.py", line 8, in <module>
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 936, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1032, in get_code
  File "<frozen importlib._bootstrap_external>", line 1131, in get_data
KeyboardInterrupt
    from opcode import *
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 936, in exec_module
  File "<frozen importlib._bootstrap_external>", line 1032, in get_code
  File "<frozen importlib._bootstrap_external>", line 1130, in get_data
KeyboardInterrupt
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 120, in spawn_main
    exitcode = _main(fd, parent_sentinel)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 129, in _main
    prepare(preparation_data)
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 240, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 291, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen runpy>", line 291, in run_path
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "C:Desktop\dejavu\app.py", line 12, in <module>
    djv.fingerprint_directory("mp3", [".mp3"], 0)
  File "C:Desktop\dejavu\dejavu\__init__.py", line 82, in fingerprint_directory
    pool = multiprocessing.Pool(nprocesses)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\context.py", line 119, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\pool.py", line 215, in __init__
    self._repopulate_pool()
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\pool.py", line 306, in _repopulate_pool
    return self._repopulate_pool_static(self._ctx, self.Process,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\pool.py", line 329, in _repopulate_pool_static
    w.start()
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\process.py", line 121, in start
    self._popen = self._Popen(self)
                  ^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\context.py", line 336, in _Popen
    return Popen(process_obj)
           ^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 158, in get_preparation_data
    _check_not_importing_main()
  File "C:AppData\Local\Programs\Python\Python311\Lib\multiprocessing\spawn.py", line 138, in _check_not_importing_main
    raise RuntimeError('''
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable.
shahabes commented 1 year ago

I found the solution. I wrapped the code in a function and run it in main.

from dejavu import Dejavu

def fingerprint():
    config = {
        "database": {
            "host": "localhost",
            "user": "root",
            "password": "",
            "database": "dejavu",
        }
    }

    djv = Dejavu(config)
    djv.fingerprint_directory("mp3", [".wav"], 0)
    print(djv.db.get_num_fingerprints())

if __name__ == '__main__':
    fingerprint()

It worked like a charm.