Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File not found #4

Open
ryanbrooks816 opened this issue Dec 6, 2022 · 2 comments
Open

File not found #4

ryanbrooks816 opened this issue Dec 6, 2022 · 2 comments

Comments

@ryanbrooks816
Copy link

Calculating fingerprint by fpcalc for 754942426.wav
Traceback (most recent call last):
  File "E:\...\compare.py", line 20, in <module>
    correlate(SOURCE_FILE, TARGET_FILE)
  File "E:\...\correlation.py", line 107, in correlate
    fingerprint_source = calculate_fingerprints(source)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\...\correlation.py", line 30, in calculate_fingerprints
    fpcalc_out = str(subprocess.check_output(['fpcalc', '-raw', '-length', str(sample_time), filename])).strip().replace('\\n', '').replace("'", "")
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\***\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 465, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\***\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 546, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\***\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1022, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\***\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1491, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified
@nam-usth
Copy link

nam-usth commented Dec 12, 2022

Hi there, you also need to download the file chromaprint-fpcalc-1.5.1-windows-x86_64.zip (1.5 MB) from https://acoustid.org/chromaprint

Then please unzip the binary file (.exe) into the same folder with the compare.py.

After that, you should see the fpcalc.exe is in the same place with compare.py and correlation.py. Hence in line 30 in correlation.py, the subprocess can be able to call the fpcalc for your audio file

@nam-usth
Copy link

nam-usth commented Dec 12, 2022

And if you found the same error as me while comparing audio files like:

    ...
  File "H:\audio-compare\correlation.py", line 37, in calculate_fingerprints
    fingerprints = list(map(int, fpcalc_out[fingerprint_index:].split(',')))

ValueError: invalid literal for int() with base 10: '3497912292\\r'

You can add the .replace("\\r", "") to line 30 in correlation.py. Your line 30 should end up like this:
fpcalc_out = str(subprocess.check_output(['fpcalc', '-raw', '-length', str(sample_time), filename])).strip().replace('\\n', '').replace("'", "").replace("\\r", "")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants