Ok, I've streamlined the code to fit your guidelines. Now there is no error message, but the script cannot initiate. I get this:
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
And this is where it ends. I wonder what might be up.
On the other hand, when run normally as executable it did yield a new .S11 file for me. Yay! I'm gonna test it and see if it was improved. However, an analogous .S22 file was also created, even though there is no code specified for the .S22 file. I would like to insert different files into that one, obviously. So, do I just repeat the process with .S22 and simply select the file while keeping the earlier .S11 one? DTX2 apparently creates S11 files on the go from S22 files by doing the conversion on its own, I'm not sure about that, though.
EDIT: Ok, tested the file in DTX2 and it's no good. The editor doesn't see the new files, they would probably need to be structured and named within the archive, that's why I was hoping to get that editor to work... The only change that I can see in the new S22 file is that a single (unknown sound) has appeared in the "Others" tab, that sound being the one you get when you obtain an Extra Life. So it IS possible to insert the files, but just inserting them isn't enough, they need to be structured internally, which you can't do without an editor. Or maybe it's just that the format isn't good? I'll try and see with some other files taken out of the archive and renamed, if they don't appear either, it's the fault of the file format.
EDIT2: Yep, that was it. I inserted an old file disguised as a new one and it did appear in the "Others" tab. So for now I just need to check the audio properties of the files and make sure my new sounds are saved with appropriate parameters. I wonder if CoolEdit will do the job?
EDIT3: Ok, so it turns out I was completely wrong and the file was correct in the first place. Duh! I just needed to select the .S11 file as the main sound file, not the .S22 one which doesn't exist yet. Heh. Sorry about all the edits, I'm making an ass of myself with my impatience
So provided the SXX files are indeed fine, I'll need to find a way for HAXMED32 to be able to search out and interpret these new sounds, so that I can assign them to D1 robots and doors. And THAT might be the tricky part.