Forum Discussion
clbfkp
5 months agoRegular Visitor
Fabric User Define Functions
I'm attempting to create a user defined function as a proof of concept. I've selected the library I want from the dropdown (python-pptx) but still receive an error when I try to import and use it as...
stoic-harsh
Super User
5 months agoHey clbfkp,
The error occurs because the package name and the module name for this library are different. This is common in Python.
# You install it as:
pip install python-pptx
--------------------------------
# But you import it in code as:
import pptx, or
from pptx import PresentationThe "python-" prefix in the PyPI is just a naming convention used by the author. It simply tells that it is a Python library. Module name inside the package is "pptx", which is what Python looks for when you write an import statement.
Same pattern is seen in other popular libraries, for example, python-dotenv is imported as dotenv, pillow is imported as PIL, scikit-learn as sklearn.
Hope this helps!