Why i am getting error in importing this module in pthon program

The ModuleNotFoundError is raised when Python cannot locate an error. The most common cause of this error is forgetting to install a module or importing a module incorrectly. If you are working with an external module, you must check to make sure you have installed it.

Hello @yuvraj.khatri107314,
Looking at your code, there is no import error for the library but an indentation error in your code. Just remove the space before the 2nd line and I think it should run. After doing that if it specifies ModuleNotFoundError then, try installing the particular library in python.
Regards,
Mrudula

Hi @yuvraj.khatri107314
The ModuleNotFoundError is showed when you are importing the module using the wrong path or wrongly spelled the module name. Also module names are case sensitive.
But in your code, error showing is indentation error. So, remove the space at the beginning of the 2nd line and try it again.
Hope, it’ll help.

This Is Because Of The Space You Given Before Calling playsound(‘’) in 2nd line

1 Like

Hi, here I check your error that’s I find the indentation
Error.so please correct your second line ,and run.
If again come error in your program like ModulenotFound then please installed your pip
And import them.

ModuleNotFoundError occurs when you import a module using an incorrect path or a misspelled module name. installed your pip and imported them. If you are working with an external module, you need to check that you have installed it. Module names are also case sensitive. But in your code the error shown is an indentation error. So remove the space at the beginning of the 2nd line and try again.
I hope it will be enough.

HI! @yuvraj.khatri107314
As we have learned that python use indentation to indicate a block of code. But indentation is not required at line 2 when we are providing the link inside “playsound” module. That’s why it shows an indentation error in your code. So just by removing the indentation will fix the error.

The error message “ModuleNotFoundError” typically appears when attempting to import a module using an incorrect path or a misspelled module name. If you are using an external module, ensure that it has been properly installed. Additionally, it is important to note that module names are case sensitive.

However, it appears that in your specific case, the error message is related to indentation. To resolve this, simply remove any extra spaces or tabs at the beginning of the second line and try running the code again. Hopefully, this will resolve the issue.

@yuvraj.khatri107314 because I think you don’t have the module installed in your device, ie playground. In order to add some external module do pip install , if that doesn’t work include the libraries and header files and also correct indentation in this scenario!

The ModuleNotFoundError is raised when Python cannot locate an error. The most common cause of this error is forgetting to install a module or importing a module incorrectly. If you are working with an external module, you must check to make sure you have installed it.

Hi, @yuvraj.khatri107314

A “ModuleNotFoundError” occurs when you try to import a module in Python, but the interpreter cannot find the specified module. This error typically occurs when the module you’re trying to import is not installed or not accessible from the current working directory. It could also occur if you misspelled the module name or if the module is located in a different directory that is not included in the Python search path.

For example, if you try to import a module named “mymodule” using the statement import mymodule, but the interpreter cannot find a module with that name, a ModuleNotFoundError will be raised.

On the other hand, an “IndentationError” occurs when there is an issue with the indentation of your Python code. Python uses indentation to define the structure and grouping of code blocks, so it’s crucial to have consistent and correct indentation. An IndentationError is raised when the indentation is incorrect or inconsistent, such as mixing tabs and spaces, using the wrong number of spaces, or having inconsistent indentation levels within the same block of code.

For example, if you have a block of code where the statements within the block have different indentation levels, or if you mix tabs and spaces for indentation, an IndentationError will be raised.

So, remove the space at the beginning of the 2nd line and try it again.

There is indentation error in your code so kindly remove the spaces at the beginning of 2nd line and give it a try once again