Re: unexpected token `;'

2009-08-25 Thread mmelchert
bbarb...@inescporto.pt wrote:

 Hello to all!
 
 I am struggling with a script in python for a while now, and decided
 to look for some help. I am running a code that takes commands from
 Marsyas(open source for Music analysis).
 
 #!/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
 #!/bin/bashimport math  ==
 import re
 import numpy

have a close look at the == line: I think you wanted it to read
import math rather than #!/bin/bashimport math?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: unexpected token `;'

2009-08-25 Thread Diez B. Roggisch
bbarb...@inescporto.pt wrote:

 Hello to all!
 
 I am struggling with a script in python for a while now, and decided
 to look for some help. I am running a code that takes commands from
 Marsyas(open source for Music analysis).
 
 #!/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
 #!/bin/bashimport math

This is bogus. Replace it with

  #!/usr/bin/python

and put the import math on the next line.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: unexpected token `;'

2009-08-25 Thread Benjamin Kaplan
On Tue, Aug 25, 2009 at 7:25 AM, Diez B. Roggisch de...@nospam.web.dewrote:


  Hello to all!
 
  I am struggling with a script in python for a while now, and decided
  to look for some help. I am running a code that takes commands from
  Marsyas(open source for Music analysis).
 
  #!/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6
  #!/bin/bashimport math

 This is bogus. Replace it with

  #!/usr/bin/python

 and put the import math on the next line.



 Diez


It's not bogus. That is perfectly legitimate for using the user-installed
Python2.6 on OS X. /usr/bin/ is reserved for system programs on that
platform so it will always point to the system python install, which is
2.5.1 on Leopard and 2.3.5 on Tiger. That being said, the #!/bin/bash line
is what's screwing it up.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: unexpected token `;'

2009-08-25 Thread Peter Otten
bbarb...@inescporto.pt wrote:

 I am struggling with a script in python for a while now, and decided
 to look for some help. I am running a code that takes commands from
 Marsyas(open source for Music analysis).

 cmd = sfplay  + colist[2]
 print cmd
 fileout = commands.getoutput(cmd)

You have to ensure here that characters that have a special meaning for the 
shell are escaped correctly. The best approach is probably to use subprocess 
instead of commands:

fileoutput = subprocess.Popen([sfplay, colist[2]],
stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT).communicate()[0]  
  

Peter

-- 
http://mail.python.org/mailman/listinfo/python-list