I am trying to get a Python module called MTpy to run on my computer; this package allows handling and processing of magnetotelluric (geophysical) data. I am using Python 3.5 with the Anaconda/Spyder IDE under Windows 10. I am just getting started with Python so I apologize if my question seems trivial!
My problem is, I can import the mtpy module and all of its submodules, but then I cannot call any of the functions contained in these subfolders.
For instance, mtpy contains a submodule called analysis.
I can successfully run:
import mtpy.analysis
Running
help(mtpy.analysis)
will return:
Help on package mtpy.analysis in mtpy:
NAME
mtpy.analysis
PACKAGE CONTENTS
distortion
geometry
niblettbostick
pt
staticshift
zinvariants
FILE
c:\users\sheldon\anaconda3\lib\site-packages\mtpy-0.0.1-py3.5.egg \mtpy\analysis\__init__.py
However when trying to access the distortion.py function contained in the analysis folder, I get the following error message:
Traceback (most recent call last):
File "<ipython-input-56-16963e2f7b1c>", line 1, in <module>
mtpy.analysis.distortion()
AttributeError: module 'mtpy.analysis' has no attribute 'distortion'
FYI, both my module (mtpy) and submodule folders (e.g. analysis) contain the init file.
Many thanks for your help!
Cheers,
Sheldon
distortion.py isn't a function it's a sub package of analysis and it's not callable. You can methods which is defined in mtpy.analysis.distortion. You can get more info on python 3 modules tutorial.
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With