Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C:\Users\rohan\AppData\Local\Programs\Python\Python37\python.exe D:/Pycharm/PycharmProjects/pythonProject/final.py
Looking for faces in test_image.jpg
- Found Chris hemsworth
- Found unknown
Traceback (most recent call last):
  File "D:/Pycharm/PycharmProjects/pythonProject/final.py", line 101, in <module>
    playsound(f"D:/Pycharm/PycharmProjects/pythonProject/audio_assets/{n}.mp3")
  File "D:\Pycharm\PycharmProjects\pythonProject\playsound.py", line 35, in _playsoundWin
    winCommand('open "' + sound + '" alias', alias)
  File "D:\Pycharm\PycharmProjects\pythonProject\playsound.py", line 31, in winCommand
    raise PlaysoundException(exceptionMessage)
playsound.PlaysoundException: 
    Error 275 for command:
        open "D:/Pycharm/PycharmProjects/pythonProject/audio_assets/Chris hemsworth.mp3" alias playsound_0.6112692669817884
    Cannot find the specified file.  Make sure the path and filename are correct.

Process finished with exit code 1


What I have tried:

When I give the output files manually it works. But I want the code to generate the out put file based on the label.
Posted
Updated 18-Feb-22 0:28am
Comments
Richard MacCutchan 18-Feb-22 6:52am    
See my update below.

open "D:/Pycharm/PycharmProjects/pythonProject/audio_assets/Chris hemsworth.mp3" alias playsound_0.6112692669817884

Cannot find the specified file.  Make sure the path and filename are correct.

We cannot help with that as we have no idea where that file is, nor any method of finding out.

[edit]
I think I missed something above. It looks like you are passing extra text in the open call thus:
Python
open("D:/Pycharm/PycharmProjects/pythonProject/audio_assets/Chris hemsworth.mp3" alias playsound_0.6112692669817884)

which is invalid. So look at line 35 in playsound.py to see exactly what is happening.
[/edit]
 
Share this answer
 
v2
Read the error message. It's pretty clear:
Error 275 for command:
        open "D:/Pycharm/PycharmProjects/pythonProject/audio_assets/Chris hemsworth.mp3" alias playsound_0.6112692669817884
    Cannot find the specified file.  Make sure the path and filename are correct.

We can't access your system so we can't check your path and spelling - but that's where I would start!
 
Share this answer
 
Change this

D:/Pycharm/PycharmProjects/pythonProject/audio_assets/Chris hemsworth.mp3


To this

D:/Pycharm/PycharmProjects/pythonProject/audio_assets/"Chris Hemsworth".mp3


should solve your problem, it would be great if you change Chris hemsworth.mp3 to Chrishemsworth.mp3
 
Share this answer
 
v2
Comments
Richard MacCutchan 18-Feb-22 6:46am    
That will not make any difference, spaces are allowed in file names used inside applications.
_Asif_ 18-Feb-22 7:56am    
On windows spaces between file names and folder names do create problems. For this particular problem, the application is not able to find the file and the most probable cause is space.

https://stackoverflow.com/questions/43510438/how-to-run-an-executable-that-contains-a-space-in-path-from-command-line-on-wind
Richard MacCutchan 18-Feb-22 8:28am    
No, that is only a problem when typing names with embedded spaces in a cmd window. That is because cmd parses all input, using spaces as field separators. When using any of the open functions in an application the string is not parsed into separate fields.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900