justinsalamon / scaper

A library for soundscape synthesis and augmentation
BSD 3-Clause "New" or "Revised" License
384 stars 56 forks source link

Sox permission denied to temporary file on Windows #20

Closed mthaak closed 6 years ago

mthaak commented 7 years ago

It seems that on Windows Sox has trouble with temporary files due to permissions. Perhaps a parameter can be added to Scaper to set the temporary files folder. Sox has this option with the --temp argument.

WARNING:root:output_file: C:\Users\Martin\AppData\Local\Temp\tmp4q3noewg.wav already exists and will be overwritten on build Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.3\helpers\pydev\pydevd.py", line 1599, in globals = debugger.run(setup['file'], None, None, is_module) File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.3\helpers\pydev\pydevd.py", line 1026, in run pydev_imports.execfile(file, globals, locals) # execute the script File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.3\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "E:/Github/how-noisy/run/create_soundscapes.py", line 84, in txt_path=txtfile) File "e:\github\how-noisy\lib\scaper\scaper\core.py", line 1661, in generate disable_sox_warnings=disable_sox_warnings) File "e:\github\how-noisy\lib\scaper\scaper\core.py", line 1563, in _generate_audio tfm.build(e.value['source_file'], tmpfiles[-1].name) File "E:\Development\Python3\Anaconda3\lib\site-packages\sox\transform.py", line 443, in build "Stdout: {}\nStderr: {}".format(out, err) sox.core.SoxError: Stdout: Stderr: sox FAIL formats: can't open output file `C:\Users\Martin\AppData\Local\Temp\tmp4q3noewg.wav': Permission denied

justinsalamon commented 7 years ago

Thanks for reporting this.

Could you please paste a minimal working example of the code you ran to produce this error? Also, which version of windows did this happen on?

justinsalamon commented 7 years ago

Related: https://github.com/bravoserver/bravo/issues/111

justinsalamon commented 7 years ago

@mthaak I've added some code that potentially fixes the denied access issue, but I can't test it on Windows. Could you please uninstall scaper and install it again using pip (should be v0.1.0rc6), and then try your code again and report back on whether the issue has been addressed? Thanks.

mthaak commented 7 years ago

@justinsalamon On Windows 10 (and installed with pip) it works now! Thank you!

justinsalamon commented 7 years ago

Awesome, thanks for testing it out!

lostanlen commented 6 years ago

Elizabeth Mendoza is running into the exact same issue on her Windows 10 laptop. We're looking into this

justinsalamon commented 6 years ago

@lostanlen I'm investigating a fix

lostanlen commented 6 years ago

great, thanks. I can try out the fix on Elizabeth's Windows machine as you as you have it, and give you feedback

justinsalamon commented 6 years ago

@lostanlen cf. #30