Errno 2 No such file or directory: 'ffprobe': 'ffprobe' - python

I have to develop an Alexa Skill that use Pydub for edit mp3 file.
Pydub requires ffmpeg and so I have add it in requirements.txt but now, when I try to run my skill, it give me "Sorry, I had trouble doing what you asked. Please try again.".
In CloudWatch the error is: [Errno 2] No such file or directory: 'ffprobe': 'ffprobe' but in requirements.txt there is the ffprobe import.
NB: In local the code runs successfully without any errors
Screenshot:
Error in CloudWatch

I had once a problem with ffprobe (No such file or directory), but when recording an animation using matplotlib. I solved it just by installing ffprobe and adding it to "path" in environment variables (on Windows). Maybe it could work for you.

Related

pydeps fails to generate dependency graph

I'm attempting to use the Python module pydeps (installed with mamba install pydeps) to analyze the dependencies in my project. However, when I run the command pydeps main.py (perhaps "main.py" is not the most informative script name ever), I get the following output:
<pydeps_folder>/pystdlib.py:17: UserWarning: stdlib_list does't support Python 3.10 yet, pydeps will use symbols from 3.9 for now.
warnings.warn(
ERROR: While opening '<working_directory>/main.svg': [Errno 2] No such file or directory: 'xdg-open' (can be caused by not finding the program to open this file)
When I then run the command firefox main.svg, I see a graph containing some of the files in my project, but not all of them, so it seems like pydeps succeeded partially. Do I need xdg-open for pydeps to work? Or is there any way I can make pydeps work by telling it to just generate the svg file and not try to open it?
Answer
xdg-open in this context is used to open the main.svg resulting file. It is a linux utility that opens a file or URL with a preferred/default application. (i.e jpg -> image viewer). In this case it tries to open main.svg with your preferred image/svg file viewer.
It sounds like it errors out when trying to open the final result main.svg, which is what you're doing by executing:
firefox main.svg
Therefore I don't think its a partial result of the dependencies.
References:
xdg-open docs: https://linux.die.net/man/1/xdg-open

Convert video.ts file into video.mp4 using ffmpeg

So I tried to convert a file named video.ts into video.mp4 in Python and am getting the error:
FileNotFoundError: [WinError 2] The system cannot find the file specified
Assuming video.ts is already loaded into the program and subprocess already imported.
This is due to the line:
>>> subprocess.run(['ffmpeg', '-i', 'video.ts', 'video.mp4']) but I don't know what's the problem.
I've opened the video.ts file and it seem to be working fine. Python version (3.8.2)
To anyone having this problem, download ffmpeg (will usually be in a zip), extract, go inside bin directory, and copy path (eg. location of folder\ffmpeg\bin). Then type in environment variables in start menu, add this path to the variable named PATH and save. DONE!
If there's still issues, restart your program, or further, your device

python wheel file install TA_lib*.whl

I am trying to install the 'TA_Lib-0.4.9-cp27-*.whl' file with powershell (windows). I receive the message 'file ... looks like a filename, but the file does not exist'.
I run 'pip install C:\Programs\TA_Lib-0.4.9-cp27-*.whl' from C:\Programs> where the whl file is located.
I use python 2.7, yet I also tried with file 'TA_Lib-0.4.9-cp34-*.whl' with same result.
I looked online and at SO, for similar cases, but so far everything I tried keeps giving me the same red error message 'TA_Lib-0.4.9-cp27-*.whl is not a valid wheel filename'.
EDIT:
the full message I receive in powershell is the following:
'Requirement 'C:\Programs\TA_Lib-0.4.9-cp27-.whl' looks like a filename, but the file does not exist
TA_Lib-0.4.9-cp27-.whl is not a valid wheel filename.'
Thank you for your help and suggestions.
What ended up working for me is to write the full name of the file, instead of using '*' after the beginning of the file name. 'pip install' command works fine with the full name of the wheel (.whl) file - in this instance.

Error when running tests with nose-gae

I've been using nose-gae for awhile, and I just updated to release 0.3.0, which is only 3 days old. I'm running GAE SDK 1.9.17 on Mac OS X Yosemite.
When I run my tests, I get the following error:
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python:
can't open file
'/Library/Frameworks/Python.framework/Versions/2.7/bin/_python_runtime.py':
[Errno 2] No such file or directory
Sure enough, that file doesn't exist. My tests appear to run successfully however (test output below). I don't see any such errors when running the dev_appserver.
I don't know what _python_runtime.py is and what is causing the error. Any help figuring out what is going on would be appreciated.
====
$ nosetests -x tests/functional_tests.py
................/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file '/Library/Frameworks/Python.framework/Versions/2.7/bin/_python_runtime.py': [Errno 2] No such file or directory
...
----------------------------------------------------------------------
Ran 19 tests in 11.032s
OK
This module _python_runtime.py should be in the SDK root folder. (confirmation here https://code.google.com/p/googleappengine/source/browse/trunk/python/)
Are you sure that it is included in your PATH? If yes -- it is best to fill an issue here, such nose-gae still buggy after update.
UPDATE this issue is solved with latest NoseGAE update, which is currently in dev branch here. Just clone it and use sudo python setup.py install to update it.
I think the problem is that nose-gae uses the old devappserver rather than the newer one. The old devappserver was removed from the SDK in 1.9.17.

Error when exporting with pydub - how to install mp3 codecs for pydub?

Im using this library for first time so Im not sure if this is a bug or Im not correctly doing something.
I want to export a file into mp3, the loading works perfectly:
wav=AudioSegment.from_wav(Path) #If I execute only this line, there are no errors.
But when I try to export my file to mp3:
wav.export(r"WavOut.mp3",format="mp3")
It throws the following error:
WindowsError: [Error 2] The system cannot find the file specified
Full error report: http://pastebin.com/3CpZBkEK
I believe I am using the correct syntax.
It creates the mp3 output file but absolutely empty, and the imput path is correct since:
os.startfile(Path) #Will work
Also, I registered ffmpeg, in windows path as:
;c:\ffmpeg\bin #It is currently callable from any cmd prompt in windows.
What can be failing? Thanks!
After more testing, I found out its an encoding problem. If I set the output as "wav" it works. But I dont really know how should I install an mp3 encoder for it to work with pydub, so I changed the question to ask that, since its the real problem. ffmpeg is installed so I dont know what else to do :\
I think it's unable to find the ffmpeg binary. Python has wave support built in, so pydub doesn't require ffmpeg to open/close/modify wave files.
Try assigning the location of the ffmpeg binary before you use it like so:
from pydub import AudioSegment
AudioSegment.converter = "c:\ffmpeg\bin\ffmpeg.exe"
wav = AudioSegment.from_wav(Path) #If I execute only this line, there are no errors.
wav.export(r"WavOut.mp3",format="mp3")
edit: We've change changed the name of the property from AudioSegment.ffmpeg to AudioSegment.converter because we now support both ffmpeg and avconv.
Please check which your version uses before assigning to this property (it's "converter" starting in the 0.9.0 release)

Categories