Re: [Tutor] IndexError: list index out of range

2013-11-29 Thread eryksun
On Fri, Nov 29, 2013 at 8:17 PM, richard kappler wrote: > > args = shlex.split(cmd) > output,error = subprocess.Popen(args,stdout = subprocess.PIPE, stderr= > subprocess.PIPE).communicate() Output to stderr doesn't necessarily mean a command failed. The process returncode is what you need to insp

Re: [Tutor] IndexError: list index out of range

2013-11-29 Thread Danny Yoo
> > > Here's another reason for avoiding eval(). Presumably a['hypotheses'] is > set by the code you download and then eval. That makes it completely > opaque -- you can't easily see what it is doing, and if it plays up, you > can't do anything about it. It's a complete black box that either works

Re: [Tutor] IndexError: list index out of range

2013-11-29 Thread Steven D'Aprano
On Fri, Nov 29, 2013 at 08:17:54PM -0500, richard kappler wrote: > I have a script that makes use of the Google speech recognition API as > follows: [...] > args = shlex.split(cmd) > output,error = subprocess.Popen(args,stdout = subprocess.PIPE, stderr= > subprocess.PIPE).communicate() > > if not

[Tutor] IndexError: list index out of range

2013-11-29 Thread richard kappler
I have a script that makes use of the Google speech recognition API as follows: import shlex print " say something" os.system('sox -r 16000 -t alsa default recording.flac silence 1 0.1 1% 1 1.5 1%') cmd='wget -q -U "Mozilla/5.0" --post-file recording.flac --header="Content-Type: audio/x-flac; rat

Re: [Tutor] empty delimiters, and None

2013-11-29 Thread eryksun
On Fri, Nov 29, 2013 at 5:44 PM, Steven D'Aprano wrote: > Originally it was set to the empty string '' which tells Python to > return the current locale. Rather, an empty string instructs it to set the locale based on the environment. The default value of None queries the category's locale. _

Re: [Tutor] empty delimiters, and None

2013-11-29 Thread Steven D'Aprano
On Fri, Nov 29, 2013 at 08:19:37AM -0500, uga...@talktalk.net wrote: [...] > After much continued searching I then found this > Bug #803791 report which describes (as an aside) the exact same issue > together with a solution. It might help if you provide a link to that bug report. Remember, you

Re: [Tutor] empty delimiters, and None

2013-11-29 Thread eryksun
On Fri, Nov 29, 2013 at 8:19 AM, wrote: > > On trying to run the script (before the fix) I had the following traceback > message: > File "measure.py", line 35, in > locale.setlocale(locale.LC_ALL, '') > File > "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/locale.py", >

Re: [Tutor] TypeError: range() integer end argument expected, got float.

2013-11-29 Thread Steven D'Aprano
On Fri, Nov 29, 2013 at 02:24:49PM -0500, spine...@aol.com wrote: > Hi > > > Newbie at this. I am getting this error: > TypeError: range() integer end argument expected, got float. Note carefully that the error here is with the range() function. In your code, you have: > for payment in ran

Re: [Tutor] TypeError: range() integer end argument expected, got float.

2013-11-29 Thread Dominik George
Hi, > Using python 7.3 I think we must update 'import antigravity' to say something about python-driven flux capacitors :รพ ... > def PaymentTable(balance, annualInterestRate, payment): You should not CamelCase function names. > upperbound = round((balance + (monthlyinterest * 12)) / 12, 0) Yo

Re: [Tutor] Pretty printing XML using LXML on Python3

2013-11-29 Thread SM
Thank you, eryksun. using tounicode seems to work on this small piece of code. It still has issues with my code which is generating a big XML code. I will figure out why. -SM On Thu, Nov 28, 2013 at 2:45 PM, eryksun wrote: > On Thu, Nov 28, 2013 at 2:12 PM, SM wrote: > > Run with Python3: > >

[Tutor] empty delimiters, and None

2013-11-29 Thread ugajin
I run Inkscape (an Open Source vector drawing application) on OSX (Snow leopard) installed via .dmg pkg. The application ships with a collection of Python extensions, one of which Measure Path, failed to execute. I could not find a reference for this issue in the Inkscape archives, and I trie

[Tutor] TypeError: range() integer end argument expected, got float.

2013-11-29 Thread spinefxr
Hi Newbie at this. I am getting this error: TypeError: range() integer end argument expected, got float. Using python 7.3 here is my code def PaymentTable(balance, annualInterestRate, payment): month = 0 while month < 12: balance = balance - payment interest =

Re: [Tutor] Allocation of serial ports

2013-11-29 Thread Phil
On 11/29/2013 06:17 PM, Dominik George wrote: Hi, So, how can I ensure that port A is always ttyUSB0 http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/ Thank you Dominik, the link answers my question exactly. -- Regards, Phil ___

Re: [Tutor] pygame error

2013-11-29 Thread Steven D'Aprano
On Thu, Nov 28, 2013 at 12:43:17AM +0530, Vipul Sharma wrote: > Hello ! I am a beginner in pygame, i was just trying a simple pygame > program where I wanted to load an image (.png) from the same directory > where my actual source code was. > I wrote this line in my source code to load the image :

Re: [Tutor] Python scope and variable binding

2013-11-29 Thread spir
On 11/29/2013 06:20 AM, eryksun wrote: On Wed, Nov 27, 2013 at 10:04 AM, Arnaud Legout wrote: [...] For what it's worth, a personal point of view on Python class defs. I ended up undertanding class definitions as code blocks the following way: Imagine Python has kinds of free sections of co

Re: [Tutor] Allocation of serial ports

2013-11-29 Thread Dominik George
Hi, >So, how can I ensure that port A is always ttyUSB0 http://hintshop.ludvig.co.nz/show/persistent-names-usb-serial-devices/ -nik ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/

[Tutor] Allocation of serial ports

2013-11-29 Thread Phil
Thank you for reading this. This question is not specifically related to Python, however, someone may be able to point me in the right direction. The operating system in use is Linux. I have a twin USB to serial adaptor that gives me ttyUSB0 and ttyUSB1 and my programme uses both of those po