Importing timestamp information with Python

Audio software developers forum.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Hawsun
Posts: 12
Joined: Tue May 07, 2013 9:16 pm
Operating System: Please select

Importing timestamp information with Python

Post by Hawsun » Tue May 07, 2013 9:45 pm

Hi,

I want to see a timestamp with Audacity and found a workaround on the Audacity Wiki (http://wiki.audacityteam.org/wiki/Impor ... nformation).

I installed Python 3.3 and ran "findcues.py". Then the program says as follows;

==================================
>>> import findcues.py
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import findcues.py
File "C:Python33libfindcues.py", line 13
print s
^
SyntaxError: invalid syntax
===================================

I am a fool about the Phython and languages.

Would you help me?
Thank you in Advance.
Last edited by Hawsun on Fri Apr 24, 2015 4:16 pm, edited 2 times in total.
Reason: Topic moved to "General Audio Programming"

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Importing timestamp information with Python

Post by Gale Andrews » Wed May 08, 2013 7:20 am

Perhaps you are not in a python window or you want:

Code: Select all

import findcues


instead. Are you doing exactly as is it says on the Wiki?


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

pfeuh
Posts: 38
Joined: Tue Jun 17, 2008 2:19 pm
Operating System: Please select

Re: Importing timestamp information with Python

Post by pfeuh » Wed May 08, 2013 7:48 am

hello,

In my opinion it's a problem of version. "print" is a keyword in python 2.xx, but it is a function in python 3.xx. It should be used like this: print (param0, param1... , ...)

regards,

Pfeuh

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Importing timestamp information with Python

Post by Gale Andrews » Wed May 08, 2013 8:10 am

pfeuh wrote:In my opinion it's a problem of version. "print" is a keyword in python 2.xx, but it is a function in python 3.xx. It should be used like this: print (param0, param1... , ...)
That's believable, but I don't think many people on this Forum have extensive knowledge of python.

I suggest you test this theory by downloading v2.4.6 which was current when the Wiki article was written. You can get it from http://www.python.org/getit/releases/ . If you cannot compile python and need binaries you may have to go a few releases back from there.

When you have some information on whether the version is the problem or not, I can try to contact "Guenterrote" through the Wiki, but there is no guarantee of reaching him or her.


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Hawsun
Posts: 12
Joined: Tue May 07, 2013 9:16 pm
Operating System: Please select

Re: Importing timestamp information with Python

Post by Hawsun » Wed May 08, 2013 5:12 pm

Thank you, pfeuh.

I am going to change the syntax or the version of Python.

Regards,

Hawsun

Hawsun
Posts: 12
Joined: Tue May 07, 2013 9:16 pm
Operating System: Please select

Re: Importing timestamp information with Python

Post by Hawsun » Wed May 08, 2013 5:15 pm

Hi,

Thank you, Gale.

I am going to try with Python v2.4.6 or modify the syntax.

Regards,

Hawsun.

pfeuh
Posts: 38
Joined: Tue Jun 17, 2008 2:19 pm
Operating System: Please select

Re: Importing timestamp information with Python

Post by pfeuh » Wed May 08, 2013 7:52 pm

Gale Andrews wrote:compile python
Python is a script language, there is nothing to compile. I haven't unfortunatly the knowledge to do what you want me to. I can just say that the "print" problem is a classic one in using script from one version in another one. Python 3.xx comes with a tool to convert scripts from 2.xx to 3.xx

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Importing timestamp information with Python

Post by Gale Andrews » Wed May 08, 2013 11:18 pm

pfeuh wrote:
Gale Andrews wrote:compile python
Python is a script language, there is nothing to compile.
I understood you had to compile python, if you don't have the version of python you want and they have not made a binary of that version.

From http://www.python.org/getit/releases/2.4.6/
Download the release [...] Unpack the archive with tar -zxvf Python-2.4.6.tgz (or bzcat Python-2.4.6.tar.bz2 | tar -xf -). Change to the Python-2.4.6 directory and run the "./configure", "make", "make install" commands to compile and install Python.
pfeuh wrote:I haven't unfortunatly the knowledge to do what you want me to. I can just say that the "print" problem is a classic one in using script from one version in another one. Python 3.xx comes with a tool to convert scripts from 2.xx to 3.xx
Thanks for that input. I guess this is what you mean http://docs.python.org/2/library/2to3.html ?


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Hawsun
Posts: 12
Joined: Tue May 07, 2013 9:16 pm
Operating System: Please select

Re: Importing timestamp information with Python

Post by Hawsun » Thu May 09, 2013 6:44 pm

Hi,

Thank you Gale and pfeuh.

I installed Cygwin and compiled Python 2.4.6.

Then I ran the "findcues.py" and received the message below.

Image

I am disappointed with the results.

Would give me another advice?

Best Wishes,

Hawsun.

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Importing timestamp information with Python

Post by Gale Andrews » Fri May 10, 2013 8:06 am

I get the same errors in Python 2.7.3, but I don't claim to know anything about python scripts.

Can you post a short WAV file on the web somewhere such as sendspace.com or adrive.com or dropbox that has the timestamp information you want to be labelled. I may have a tool that can export the information as a CSV file, which would be a step in the right direction, but I'm not sure.

Meantime I e-mailed "Guenterrote".


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Post Reply