3

This is in reference to: "wave" library will not open 8 kHz wave file

My post was first edited by another user, and then closed for no stated reason.

The question was my attempt to understand why the Python2.7 'wave' library will not successfully open an 8 kHz file (this is a very common format for U.S. Telecommunications)

A one-line code example was provided as well as the error response from the interpreter.

If the sample file is required, I'm going to need a pointer on how to upload/share it. My searches on that topic have turned up nothing.

If this is the incorrect forum for this question, please excuse my mistake and point me towards the proper venue

2
  • 4
    Your question hinges on a specific file not being readable by the Python stdlib wave module. That makes it really hard to reproduce. Unless you can convey some other info about it, you may have to accept the question can't be made on topic. Sorry.
    – Martijn Pieters Mod
    Commented Jan 23, 2020 at 20:54
  • 5
    Ah, the traceback gave someone enough info there. I should have searched the exception message there. Your WAV format is not supported by the library.
    – Martijn Pieters Mod
    Commented Jan 23, 2020 at 20:56

2 Answers 2

9

I would have close-voted this question for at least two different reasons:

  1. It appears that you are looking for help with some code, but there is neither a specific error message nor code that is not working. Both are required for assistance with debugging; see How to create a Minimal, Reproducible Example.

  2. It is not clear exactly what I could do to produce a satisfactory answer. Your question states:

    I'd like to check the 'correctness' of the file

    I don't know what correctness is, and unless I know that, I cannot help you check it.

11
  • There was a code sample and a very specific error message. IMO it's quite clear what OP meant by "correctness", it was specified in the preceding paragraph.
    – deceze Mod
    Commented Jan 24, 2020 at 10:02
  • A stack trace is not an error message. If a question is not formatted in a manner where the useful information is able to be extracted easily and clearly such that it can be unambiguously answered, I think it should be closed. The post has since been significantly re-formulated. I still would like to see a reproducible example - perhaps a link to a sample file that could be run.
    – theMayer
    Commented Jan 24, 2020 at 13:06
  • Additionally, lack of any apparent research effort has long led to question closure on this site... I don't know that I agree or disagree with that, but that seems to be the case more often than not. It seems that we would need to allow broader questions in general, which might produce a lot of low-quality or irrelevant answers.
    – theMayer
    Commented Jan 24, 2020 at 13:10
  • 6
    "A stack trace is not an error message." — Wut?! That is the canonical and best kind of error message you can ask for in python.
    – deceze Mod
    Commented Jan 24, 2020 at 13:10
  • Yeah, I suppose that's one of the many reasons I stay away from python :P
    – theMayer
    Commented Jan 24, 2020 at 13:11
  • In this case, had the specific error been highlighted (which appears maybe to be buried on the third or fourth line of the stack trace), it might have been more obvious what was going on. As it is, I didn't even realize that there was one line of code present there.
    – theMayer
    Commented Jan 24, 2020 at 13:12
  • 3
    I don't know what languages and error reporting you're used to, but Python error traces are extremely informative and readable if you know how to read them. The error message is the last line, everything before shows how the code got there. — I agree that there could be a blank line between code and trace though.
    – deceze Mod
    Commented Jan 24, 2020 at 13:13
  • Java, JavaScript, C#, and Ada are the languages I'm most familiar with - the standard format for all of those languages is to list a specific error (albeit sometimes cryptic) followed by the stack trace. So, perhaps call it a cognitive bias - but one in this case which hid the error message effectively from me, and I'm guessing others as well. To be fair, when I review close vote queue, I only stick to the languages and tags I'm familiar with, so as not to unduly close-vote a perfectly fine question.
    – theMayer
    Commented Jan 24, 2020 at 13:16
  • You may want to weigh in on this then: meta.stackoverflow.com/q/393298/476
    – deceze Mod
    Commented Jan 24, 2020 at 13:17
  • @deceze I don’t think that’s related. The question you link is only about Triage. The close vote review queue already allows filtering. That said, I’m…not too sure I understand the language-specific confusion. I used to program in C#; now primarily in C and C++. But either way, a stack trace is always the canonical way of reporting an error condition. Except maybe in assembly, where I’d look for a core dump. :-)
    – Cody Gray Mod
    Commented Jan 24, 2020 at 20:57
  • The confusion for me arises as, like most things with python, it’s stack trace is upside down. A stack trace is not an error message. It is a list of calls that produced an exception. While helpful, if there is no exception present, in and of itself it is quite useless.
    – theMayer
    Commented Jan 24, 2020 at 21:35
4

While, yes, you'd need the actual file you're testing with to really reproduce the problem, that is in itself a hurdle that's basically impossible to overcome. Even if you did share the file somewhere, I would most certainly not download it on principle of computer hygiene. I believe you included all the information you reasonably could, and I think it makes a worthwhile question, and I feel the closure was silly. I have reformulated your post a bit to make it absolutely clear what is being asked and have voted to reopen it.

7
  • 1
    Fair enough that the original closure might've not been the best, but I fail to see the issue with Martijn's dupe closure, the duplicate post is the same issue (wave not supporting the given WAV format), and OP has already specified they can use Audacity, which is exactly what the dupe suggests to do to change the format Commented Jan 24, 2020 at 10:12
  • OP says that they used Audacity to check the file once manually, I don't hear from that that they want to do this every time. They're still looking for a programmatic way using Python to check the format of a file. Martijn's dupe says to use Audacity to change the format of the file to enable Python to read it. Which is not what OP is asking for or a solution that would help OP.
    – deceze Mod
    Commented Jan 24, 2020 at 10:17
  • In which case... they're either looking for a solution on how to parse and validate a wav file (too broad), or looking for a library to do it (off-topic) Commented Jan 24, 2020 at 10:21
  • 5
    They're not explicitly asking for external libraries. They're demonstrating an issue with the builtin library and are asking for a solution to that problem. That may involve calling the library differently in some way, or it may involve using something else entirely. Maybe the answer is simply "it's not possible". But IMO it doesn't squarely fall into any off-topic reason.
    – deceze Mod
    Commented Jan 24, 2020 at 10:23
  • ¯\_(ツ)_/¯ fair enough Commented Jan 24, 2020 at 10:24
  • 1
    A sobering answer. Why could I not do this rationalisation myself before reading this answer? Because I was focused on looking for things to dislike of course.
    – Gimby
    Commented Jan 24, 2020 at 13:52
  • Thanks to @deceze for reviving the post, I'm the OP. For the record, 8 kHz G.711 files are PCM encoded en.wikipedia.org/wiki/G.711 The wave module (at least for Python2.7) apparently doesn't handle this, the 'why' is something I have no history on. 8 kHz, mono PCM encoding has existed since 'modern' telephony, and the G.711 compression algorithm was released in 1972. Commented Jan 24, 2020 at 19:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .