Modify

Ticket #338 (closed defect: fixed)

Opened 3 months ago

Last modified 3 months ago

read() raises a "wave.Error" exception when reading an unsupported file

Reported by: satriano Owned by: barsch
Priority: major Component: ObsPy library
Keywords: read() exception Cc:

Description

Calling obspy.core.stream.read() without specifying the file format results in a series of attempts to open the given file according to the supported formats.

Now, in case of an unsupported file, an exception is raised from the last module which tried to open the file, which is (at least in my case) the module wave. This makes it complicate to properly handle this exception, since one should import the module wave just for this.

I think that read() should raise its own exception when all the reading attempts fail.

Attachments

Change History

comment:1 Changed 3 months ago by megies

Hmm, I can confirm this issue. Using a random unsupported file, even though obspy.wav.core.isWAV returns False it is displaying the error message of obspy.wav.core.readWAV.

comment:2 Changed 3 months ago by barsch

  • Owner set to barsch
  • Status changed from new to closed
  • Resolution set to fixed

In [3423/obspy]:

  • fixes #338 + test case
  • TypeError? with custom message will be raised if file can't be handled by any installed waveform plug-in
  • thanks for reporting!

comment:3 Changed 3 months ago by satriano

It works nicely now! Thank you!!!

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.