Hello, I’m using a Jupyter notebook installed via anaconda. While executing the cell, on the top right side, kernel error(highlighted in red color) appears. When I clicked it, I get an error message « ImportError: DLL load failed while importing win32api: The specified procedure could not be found ». I have uninstalled anaconda and reinstalled Anaconda . And also installed pip install pypiwin32 but still, it’s not working. kindly help me to solve this problem. Thanks in advance.
Hello Pauline,
I think there is a mistake in the code. If I understand well, you want to search a word in a text file. To do so, you have to open the file first.
Hello Romain, Thanks for your reply. I just took the screenshot to show the Kernel error. I also tried to execute the proper code without any error but its not executing. It shows always the same error and when I clicked the error button, it shows import error (import win32api).
Hello Pauline,
I think the error comes from the fact that you don’t open the file.
Try the following command :
f = open(« yourfile.txt », « r »)
Hello Romain, The kernel error appears before I execute the code. I tried to use visual studio code and I got the same error while executing the first line of the code.
Hi Pauline,
You should no longer install win32api
that way. Try using pip install pywin32
instead as this ensures that the latest version is installed.
Hello Oussema, Thanks for the helpful advice. I have successfully installed pywin32. But now the problem is when I execute the code i get this grey blank space instead of output.
Hello Romain, I have uninstalled and installed anaconda and launched Jupyter notebook. Ans also I have installed pywin32 in VS code and restarted computer. Here is the screen shot.
.
My file was not opened and it got stuck.
Have you installed the Jupyter extension for VS Code?
I don’t know. Could you please help me to check/install it?
I checked and its already installed in VS code
It is not clear for me from the screenshot what you’re trying to print. Can you share a better image?
Can you show what the dataframe contains with print(df.head()
for example?
And what do you get when trying to run it from the terminal? python -m try_3
Sorry I don’t understand very well. I’m a beginner. Do I need to run python -m try_3
in vs code terminal? what does try_3 means?
Yes, try_3 is your filename, isn’t it?
Yes, my file name is try_3.
Yes, but you either need to specify the whole file path or navigate to the file location in your terminal before launching that command