I'm experimenting with image processing in python and for two days i was stuck with a problem.
I realized that naming a file to struct.py gave the error "numpy.core.multiarray failed to import" when trying the simple script below:
import numpy as np
k = np.ones((9,9))
print(k)
the same code worked when i created a file with another name.
Now I'm looking for an answer as to why that happened.
I created a test file "struct.py" to try different structuring elements for morphological operations. In all my other test files numpy worked correctly, but for some reason, in that "struct.py" script I got an error saying that "numpy.core.multiarray failed to import". I was so invested into solving that problem that during the solving process i didn't think to test if numpy worked in my other scripts (where they had worked before)
I reinstalled python several times, switched IDE, tried to code locally instead of using a version controller but all of these things seemed pretty unnecessary for me to do because i didn't see how that could be the reason for numpy not to work.
Today i saw that there is a python module called struct, and that me using that name for my script must be the cause of the problem, but I still don't understand why numpy stopped working because of that. Is numpy dependent on the struct module? How could this happen?
Also this is my first time actually posting an issue on stackoverflow, please let me know if i should change the contents of my post or delete unnecessary information or add more.