2

I am trying to manipulate sound using the Snack Sound Toolkit, however when I try to run their demo code I get an error. I followed the installation instructions like it said in the readme file.

CODE:

#! /usr/bin/env python

from Tkinter import *
from tkSnack import *

root = Tkinter.Tk()

initializeSnack(root)

s = Sound(load='ex1.wav')
c = SnackCanvas(height=100, width=400)
c.pack()
c.create_waveform(0, 0, sound=s, width=400)

Button(root, text='Exit', command=root.quit).pack()

root.mainloop()

ERROR:

 Traceback (most recent call last):
      File "G:\workspace\voice test\MinWave.py", line 8, in <module>
        initializeSnack(root)
      File "C:\Program Files\Python\lib\tkSnack.py", line 21, in initializeSnack
        Tkroot.tk.call('eval', 'package require snack')
    _tkinter.TclError: couldn't load library "C:/Program Files/Python/tcl/snacklib/libsnack.dll": invalid argument

I am running windows 7 x64 with python 2.7.6

Thanks, Logan

Logan
  • 109
  • 8

2 Answers2

1

I have had this exact same problem with a DLL (different DLL). I found the inpspectExd tool, mentioned in this thread, really useful and I think it has helped me figure out what was wrong...

Apart from being quite cool, the inspectExe tool let me see that my DLL was 32-bit and the python distro was 64-bit. It also had a test load feature so I knew the DLL was a good one and could be loaded along with all its dependencies...

My DLL was 32-bit and my Python distribution was 64-bit and 64-bit python can't load a 32-bit DLL... doh!

I'm heavily suspecting my problem is this 64/32 mismatch... still to actually verify this. Perhaps your problem is same 64/32 problem??

Community
  • 1
  • 1
Jimbo
  • 4,352
  • 3
  • 27
  • 44
0

Did you "install" Snack. It requires, as far as I remember, you to copy files manually.

Snack v2.2.10 Install the Snack libraries by moving tkSnack.py to C:\Python23\Lib\\r\n\r and snacklib\ to C:\Python23\tcl\ (modify as necessary). A description of the demos can be found in python-demos.txt

Your code runs fine here. Im Win7 x64 2.7.6 as well

Svend Feldt
  • 758
  • 4
  • 17
  • yes i did that. but just to make sure the \r\n\r isn't part of the file path is it? – Logan Jan 06 '14 at 17:17
  • and for me python is in a folder called 'Python' not 'Python23' but that shouldn't make a difference should it? – Logan Jan 06 '14 at 17:24
  • Have You checked that the dll is there? – Svend Feldt Jan 06 '14 at 18:39
  • yep libsnack is there along with libsnackogg, libsnacksphere, libsound, and two .tcl files pkgIndex.tcl and snack.tcl their file path is C:\Program Files\Python\tcl\snacklib if that helps at all – Logan Jan 06 '14 at 18:53
  • I really don't know, I have moved my Python install to same dir as you, and your script still runs smoooothly.. Sorry – Svend Feldt Jan 06 '14 at 19:33
  • tkSnack.py should be in the Python Lib folder and if you run that it has a self-test mini player that will show if it is all working correctly. I just copied my old copy from a Python 2.7 folder into Python 3.4, fixed up the syntax a little and had it work in Python 3. You must have the tcl parts in \tcl\snack2.2 and tkSnack.py in \Lib. If it doesn;t load snack you can try manually performing the commands in initializeSnack (where it calls Tcl to load the snack package). – patthoyts Nov 26 '14 at 16:36