kahst / BirdNET-Analyzer

BirdNET analyzer for scientific audio data processing.
Other
870 stars 158 forks source link

server.py does not return results, but fails with an error. Problem with paths. #476

Open OniDaito opened 1 month ago

OniDaito commented 1 month ago

Describe the bug The server.py cannot correctly process the results. With the default settings the server produces errors and no results for any birds.

To Reproduce Run the server as follows:

python server.py --host 192.168.2.185 --port 9013

Submit a wav file to the server just like the client.py, using the python requests library:

 multipart_form_data = {"audio": (filename, audio_bytes), "meta": (None, json.dumps(mdata))}
response = requests.post(url, files=multipart_form_data)

Watch the response on the server end:

 UP AND RUNNING! LISTENING ON 192.168.2.185:9013
 ####################  2024-10-19 22:11:41.837621  ####################
 {'pmode': 'avg', 'num_results': 5, 'save': False}
 INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
 Analyzing /tmp/tmpy_6rgrl0.wav
 Error: Cannot save result for /tmp/tmpy_6rgrl0.wav.

Take a look at the error_log.txt

Traceback (most recent call last):
File "/home/oni/birdnet/analyze.py", line 545, in analyzeFile
saveResultFiles(results, result_file_names, fpath)
File "/home/oni/birdnet/analyze.py", line 198, in saveResultFiles
os.makedirs(cfg.OUTPUT_PATH, exist_ok=True)
File "<frozen os>", line 225, in makedirs
FileExistsError: [Errno 17] File exists: '/tmp/tmp66xk5gz8.txt'

Expected behavior No errors and a list of 5 bird species.

Additional context I'm running the server on an Arch Linux box. I'm recording some wav files and sending them to the server. In the past, the docker version I've used has worked quite well. I'm running this server using python in a virtual environment.

I can see that the server.py is attempting to create a directory with the same name as the temporary wav file. Could this be causing the issue?