Hello,

I have been trying to get PyInstaller to package a program that uses ObsPy. 
A short test program is copied below. The program fails on the readSEGY 
line, due to an import error. When I use ArchiveViewer to look at the .pyz 
archive then all of the obspy routines are listed.

If I copy the obspy directory from C:\Python27\Lib\site-packages\ to my 
dist directory then the readSEGY line succeeds, so it looks like something 
has gone wrong in the packaging process. The st.detrend line stills fails, 
and although the final error mentions SciPy I think the problem is still 
related to the packaging.

I presume I need to convert the obspy .pyc files to .pyd files with the 
directory slashes replaced with dots, e.g. obs\core\util\base.pyc would be 
obs.core.util.base.pyd, but I'm unsure how this is done (yep, I have read 
the manual).

Any help is much appreciated,
Ra

Test program (note I have installed obspy as an executable from PyPI):

import numpy as np

# None of these help:
import obspy
import obspy.core
import obspy.core.stream

# This is required (and it works fine):
from obspy.segy.core import readSEGY

def test():
    # readSEGY works if obspy directory copied from site-packages:
    st = readSEGY('data.sgy')
    print st[0]
    print np.mean(st[0])
    # .detrend does not work in compiled version:
    st.detrend()
    print np.mean(st[0])

if __name__ == "__main__":
    test()



Error message:

 
Traceback (most recent call last):
  File "<string>", line 21, in <module>
  File "<string>", line 17, in test
  File "C:\Python27\Lib\site-packages\obspy\core\stream.py", line 2105, in 
detre
nd
    tr.detrend(type=type)
  File "C:\Python27\Lib\site-packages\obspy\core\trace.py", line 1619, in 
detren
d
    func = _getFunctionFromEntryPoint('detrend', type)
  File "C:\Python27\Lib\site-packages\obspy\core\util\base.py", line 343, 
in _ge
tFunctionFromEntryPoint
    raise ImportError(msg % (group.capitalize()))
ImportError: Your current ObsPy installation does not support any Detrend 
functi
ons. Please make sure SciPy is installed properly.

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to