I am trying to build a simple dataset for speech recognition using aneas, following the instruction here. However I'm stuck at the forced alignment, here is my code
from aeneas.executetask import ExecuteTask
from aeneas.task import Task
import os
import numpy
config_string = "task_language=eng | is_text_type=plain | os_task_file_format=json"
task = Task (config_string=config_string)
task.audio_file_path_absolute = "D:/documents/AI/open_door.mp3"
task.text_file_path_absolute = "D:/documents/AI/open_door.txt"
task.sync_map_file_path_absolute = "D:/documents/AI/syncmap.json"
ExecuteTask(task).execute()
task.output_sync_map_file()
Which gives the following error:
Traceback (most recent call last):
File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\ffprobewrapper.py", line 222, in read_properties
proc = subprocess.Popen(
File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\audiofile.py", line 357, in read_properties
properties = FFPROBEWrapper(
File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\ffprobewrapper.py", line 233, in read_properties
self.log_exc(u"Unable to call the '%s' ffprobe executable" % (self.rconf[RuntimeConfiguration.FFPROBE_PATH]), exc, True, FFPROBEPathError)
File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\logger.py", line 351, in log_exc
raise raise_type(raise_message)
aeneas.ffprobewrapper.FFPROBEPathError: Unable to call the 'ffprobe' ffprobe executable : [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\documents\AI\forced_alignment.py", line 9, in <module>
task.audio_file_path_absolute = "D:/documents/AI/open_door.mp3"
File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\task.py", line 120, in audio_file_path_absolute
self._populate_audio_file()
File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\task.py", line 241, in _populate_audio_file
self.audio_file.read_properties()
File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\audiofile.py", line 363, in read_properties
self.log_exc(u"Unable to call ffprobe executable", None, True, AudioFileProbeError)
File "C:\Users\ACER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\aeneas\logger.py", line 351, in log_exc
raise raise_type(raise_message)
aeneas.audiofile.AudioFileProbeError: Unable to call ffprobe executable
[Finished in 0.4s]
Intuitively, I think it is because of the file paths, but changing it doesn't seem to work. I have never worked with python before so show me where I did wrong. Thank you.
I'm pretty sure it's because ffprobe isn't in your system's environmental variables.
Have you tried running python -m aeneas.diagnostics and is ffprobe in your path? Look into adding programs to your Path/system environment variables.
Related
I tried to use python to call the “ansys-fluent-core” package, but after I ran it, the following error occurred. I don't know where the problem is. Can you help me and give me some suggestions.
my code:
import ansys.fluent.core as pyfluent
session = pyfluent.launch_fluent(precision="double", processor_count=4, show_gui=True,
mode="solver")
error:
E:\HB-software\Anaconda\anaconda\envs\py38\python.exe C:\Users\86139\PycharmProjects\pythonProject2\main.py
Traceback (most recent call last):
File "C:\Users\86139\PycharmProjects\pythonProject2\main.py", line 2, in <module>
session = pyfluent.launch_fluent(precision="double", processor_count=4, show_gui=True,mode="solver")
File "E:\HB-software\Anaconda\anaconda\envs\py38\lib\site-
packages\ansys\fluent\core\launcher\launcher.py", line 560, in launch_fluent
subprocess.Popen(launch_string, **kwargs)
File "E:\HB-software\Anaconda\anaconda\envs\py38\lib\subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "E:\HB-software\Anaconda\anaconda\envs\py38\lib\subprocess.py", line 1311, in
_execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the specified file.
Process finished with exit code 1
I am trying to get a tree of function-API under FreeCAD which is defined as App inside freecad always.
My goal is to find in the API where the OpenGL context is used and how it is used so I can inject my own OpenGL code/other libraries.
Here is the code
import FreeCAD as App
import FreeCADGui as Gui
from anytree import Node, RenderTree
from anytree.exporter import DotExporter
from inspect import getmembers, isfunction
from pkgutil import iter_modules
directory="E:/TEMP/DOC/"
MainNoid=Node("FREECAD")
def retriveOneObj(_objName,nodename):
mainNode=nodename
_OldNode=nodename
try:
for objS in getmembers(_objName):
Gui.updateGui()
for tobj in getmembers(objS):
if type(tobj) is tuple:
nObj=Node(str(tobj),_OldNode)
else:
nObj=Node(tobj.__name__,_OldNode)
return mainNode
except Exception as err:
print (err)
def retriveAll():
freecad=Node(App.__name__)
allNode=retriveOneObj(App,freecad)
DotExporter(allNode).to_picture(directory+"freecad.png")
retriveAll()
I get the error below :
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "<input>", line 4, in retriveAll
File "D:\Users\...\Downloads\FreeCAD\bin\lib\site-packages\anytree\exporter\dotexporter.py", line 272, in to_picture
check_call(cmd)
File "D:\Users\...\Downloads\FreeCAD\bin\lib\subprocess.py", line 359, in check_call
retcode = call(*popenargs, **kwargs)
File "D:\Users\...\Downloads\FreeCAD\bin\lib\subprocess.py", line 340, in call
with Popen(*popenargs, **kwargs) as p:
File "D:\Users\...\Downloads\FreeCAD\bin\lib\subprocess.py", line 858, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "D:\Users\...\Downloads\FreeCAD\bin\lib\subprocess.py", line 1311, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The file can not be found
This is on Windows10
Note: You need to run this inside FreeCAD and install the libraries using pip found under the \FreeCAD\bin\Scripts folder
I wanted to create a Minecraft Launcher using Python today, but the game cannot be started.
My Code:
import minecraft_launcher_lib
import subprocess
minecraft_directory = "C:\\Users\\Mert KAPLANDAR\\AppData\\Roaming\\.minecraft"
options = minecraft_launcher_lib.utils.generate_test_options()
minecraft_command = minecraft_launcher_lib.command.get_minecraft_command("1.8.9", minecraft_directory, options)
subprocess.call(minecraft_command)
Error:
Traceback (most recent call last):
File "C:\Users\Mert KAPLANDAR\Desktop\launcher.py", line 10, in <module>
subprocess.call(str(minecraft_command))
File "C:\Users\Mert KAPLANDAR\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 349, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\Mert KAPLANDAR\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Mert KAPLANDAR\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Sistem belirtilen dosyayı bulamıyor
#Mert Kaplander, I would believe the error might be because you don't have that version of Minecraft installed. You can check with the following method:
minecraft_launcher_lib.utils.get_installed_versions(minecraft_dir)
example:
import subprocess
import minecraft_launcher_lib
from colorama import Fore, init
for version in minecraft_launcher_lib.utils.get_installed_versions(minecraft_dir):
print(Fore.GREEN+ f"{version}")
Other than that, your code is an exact copy from the documentation. So I don't see an other error.
I'm trying to create a directory in a class constructor but there is a possibility of there is a directory with the same name as I want to create. So I'm trying the following approach.
class SubVideoExtractor:
def __init__(self, out_name=str()):
self.out_abs = os.getcwd() + "/output/" + out_name
try:
os.mkdir(self.out_abs)
except FileExistsError:
subprocess.Popen(f"rm -rf {self.out_abs}").wait()
os.mkdir(self.out_abs)
But when directory already exist, I got FileNotFound error during handling of FileExistsError.
How error looks like:
Traceback (most recent call last):
File "/home/lapestand/DEV/projects/SubVideoExtractor/SubVideoExtractor.py", line 22, in __init__
os.mkdir(self.out_abs)
FileExistsError: [Errno 17] File exists: '/home/lapestand/DEV/projects/SubVideoExtractor/output/16035609841603553594'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 95, in <module>
extractor = SubVideoExtractor(length=VIDEO_LENGTH, _format=VIDEO_FORMAT,
File "/home/lapestand/DEV/projects/SubVideoExtractor/SubVideoExtractor.py", line 24, in __init__
subprocess.Popen(f"rm -rf {self.out_abs}").wait()
File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'rm -rf /home/lapestand/DEV/projects/SubVideoExtractor/output/16035609841603553594'
Why this is happening and how to solve?
You may want to continue even if the folder exists:
os.makedirs(path, exist_ok=True)
But you may prefer to really delete the folder before recreate it:
shutil.rmtree(path)
There are other ways to go about what you're trying to do without catching an exception. That said, after glancing at the docs, it appears you should be passing in an array with your command to Popen as follows:
subprocess.Popen(["rm", "-rf", f"{self.out_abs}"]).wait()
I have never used python before and I want to build a project I found on github but I have not solved a problem there for 2 hours. I don't think it's a problem that I've installed all the packages individually. I've applied all the necessary documents that he narrates, but when I run the following command, I get an error How can I solve this error?
https://github.com/tsurumeso/vocal-remover
Run
python inference.py --input C:\Users\Berkay\Desktop\vocal-remover
error output
PS C:\Users\Berkay\Desktop\vocal-remover> python inference.py --input C:\Users\Berkay\Desktop\vocal-remover loading model... done
C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\librosa\core\audio.py:146: UserWarning: PySoundFile failed. Trying audioread instead.
warnings.warn('PySoundFile failed. Trying audioread instead.')
loading wave source... Traceback (most recent call last):
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\librosa\core\audio.py", line 129, in load
with sf.SoundFile(path) as sf_desc:
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\soundfile.py", line 629, in __init__
self._file = self._open(file, mode_int, closefd)
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\soundfile.py", line 1184, in _open
"Error opening {0!r}: ".format(self.name))
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\soundfile.py", line 1357, in _error_check
raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening 'C:\\Users\\Berkay\\Desktop\\vocal-remover': System error.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "inference.py", line 39, in <module>
args.input, args.sr, False, dtype=np.float32, res_type='kaiser_fast')
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\librosa\core\audio.py", line 147, in load
y, sr_native = __audioread_load(path, offset, duration, dtype)
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\librosa\core\audio.py", line 171, in __audioread_load
with audioread.audio_open(path) as input_file:
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\audioread\__init__.py", line 111, in audio_open
return BackendClass(path)
File "C:\Users\Berkay\AppData\Local\Programs\Python\Python37\lib\site-packages\audioread\rawread.py", line 62, in __init__
self._fh = open(filename, 'rb')
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Berkay\\Desktop\\vocal-remover'
I found the solution to the problem.
False
python inference.py --input C:\Users\Berkay\Desktop\vocal-remover
That's right
python inference.py --input C:\Users\Berkay\Desktop\vocal-remover\music.mp3
I think the problem is that your input is a directory, while I bet it should be some audio file. You should do:
inference.py --input path/to/your/audio.wav