0

I met an oserror that showed error opening

This code is a loop to generate a list of wav files with same name every loop. But the loop stopped at sample 10 (total sample 32) at loop 14, which means the loop works well in the past 13 loops.

Traceback (most recent call last):
  File "main.py", line 68, in <module>
    a.train(dataloader, cfg.STAGE)
  File "/home/guest/trainer.py", line 255, in train
    save_RIR_results(real_Rcpu, fake, epoch, self.RIR_dir)
  File "/home/guest/utils.py", line 186, in save_RIR_results
    r = WaveWriter(real_Rpath, channels=1, samplerate=fs)
  File "/home/guest/miniconda3/envs/rir/lib/python3.6/site-packages/wavefile/wavefile.py", line 199, in __init__
    filename, _sferrormessage(_lib.sf_error(self._sndfile))))
OSError: Error opening '../output/RIRsample10.wav': System error.

I searched online but no one had the same problem with me. Most of them just wrote the wrong directory. But I pretty sure my directory is correct.

I am really confused about this.

Thank you so much for your help.

Halona
  • 1
  • 2

1 Answers1

0

I have fixed this problem. This might be caused by the limited number of open files.

Check it by the command below.

ulimit -a

The open files number is 1024 (default)

Then type in the terminal

sudo nano /etc/security/limits.conf

Add the following line to /etc/security/limits.conf

*   hard    nofile   64000

Then login as root

su - RootUserName

Edit following two files for RootUserName append .bashrc and .bash_profile file by running

echo "ulimit -n 64000" >> .bashrc ; echo "ulimit -n 64000" >> .bash_profile

Log out, then log back in and verify that the changes have been made correctly:

ulimit -a | grep open

According to the reply.

Halona
  • 1
  • 2