I write a very simple code with obspy to read miniSeed files and plotting.
the code is listed below:
import obspy
st = obspy.read(‘temp.seed’)
st.plot()
the input fine ‘temp.seed’ is put in the current directory.
This code can run normally under pycharm. But after packaged with pyinstaller, I meet errors
The enviroment I use is : python==3.3.1; pyinstaller==4.2;python==3.8.1;obspy==1.2.2
I use this command to package my code: pyinstaller -c test.py
When completing the package, I copy obspy directory to dist/test directory and run test.exe
The following is the error message:
File “test.py”, line 3, in
File “”, line 2, in read
File “obspy\core\util\decorator.py”, line 300, in _map_example_filename
return func(*args, **kwargs)
File “obspy\core\stream.py”, line 212, in read
st = _generic_reader(pathname_or_url, _read, **kwargs)
File “obspy\core\util\base.py”, line 702, in _generic_reader
generic = callback_func(pathnames[0], **kwargs)
File “”, line 2, in _read
File “obspy\core\util\decorator.py”, line 210, in uncompress_file
result = func(filename, *args, **kwargs)
File “obspy\core\stream.py”, line 256, in _read
stream, format = _read_from_plugin(‘waveform’, filename, format=format,
File “obspy\core\util\base.py”, line 450, in _read_from_plugin
raise TypeError(‘Unknown format for file %s’ % filename)
TypeError: Unknown format for file temp.seed
[10948] Failed to execute script test
I have been confused by this problem for days and tried to use different versions of the package, but failed again and again.
BTW: I also tried to read waveform files of SAC format, meet the same errors, it seems that after packaged by pyinstaller, the obspy can’t read any type of data.
Hope to get helpful instruction here…