Re: [Tutor] Set LD_LIBRARY_PATH and equivalents platform-independently

2013-01-16 Thread Dave Angel
On 01/16/2013 07:05 PM, Alan Gauld wrote: On 16/01/13 21:06, Albert-Jan Roskam wrote: Is there a builtin function that can set LD_LIBRARY_PATH or equivalents platform-independently? No. But there is putenv() in the os module. But how well it works across OS I'm not sure. I don't recall eno

Re: [Tutor] Set LD_LIBRARY_PATH and equivalents platform-independently

2013-01-16 Thread Alan Gauld
On 16/01/13 21:06, Albert-Jan Roskam wrote: Is there a builtin function that can set LD_LIBRARY_PATH or equivalents platform-independently? No. But there is putenv() in the os module. But how well it works across OS I'm not sure. HTH -- Alan G Author of the Learn to Program web site http://ww

Re: [Tutor] how to track an entry in a large text file

2013-01-16 Thread Mitya Sirenef
On 01/16/2013 04:22 PM, 3n2 Solutions wrote: Say I have a text file (example below) that has multiple records with the same format but not always the same number of lines. Each record is separated by the line that starts with “Examining file” as in below example. If you notice, the 3D Val is not

Re: [Tutor] Json encode and decode on Puython 2.4

2013-01-16 Thread Prasad, Ramit
Steven D'Aprano wrote: > > On 17/01/13 08:50, Prasad, Ramit wrote: > > > Python 2.4 is quite old and simplejson supports 2.5+. I can see a > > yield in the encoder code, so it is unlikely to be easy to modify > > and get working with 2.4. > > Python 2.4 supports yield. Thanks for the correction

Re: [Tutor] Json encode and decode on Puython 2.4

2013-01-16 Thread Steven D'Aprano
On 17/01/13 08:15, Dotan Cohen wrote: Hi all, I'm just getting into porting some PHP scripts to Python. One issue that I'm having is that the scripts need to run on a host with Python 2.4 that has neither the json nor simplejson packages available. I figure that I'll have to include the loads() a

Re: [Tutor] Json encode and decode on Puython 2.4

2013-01-16 Thread Steven D'Aprano
On 17/01/13 08:50, Prasad, Ramit wrote: Python 2.4 is quite old and simplejson supports 2.5+. I can see a yield in the encoder code, so it is unlikely to be easy to modify and get working with 2.4. Python 2.4 supports yield. -- Steven ___ Tutor ma

Re: [Tutor] how to track an entry in a large text file

2013-01-16 Thread Oscar Benjamin
On 16 January 2013 21:22, 3n2 Solutions <3n2soluti...@gmail.com> wrote: > Say I have a text file (example below) that has multiple records with > the same format but not always the same number of lines. Each record > is separated by the line that starts with “Examining file” as in below > example.

Re: [Tutor] learning to program in cython

2013-01-16 Thread Oscar Benjamin
On 16 January 2013 21:54, Abhishek Pratap wrote: > Hi Guys > > With the help of an awesome python community I have been able to pick up the > language and now willing to explore other cool extensions of it. Good work! > > I routinely have large loops which could be ported to cython for speed. >

Re: [Tutor] Json encode and decode on Puython 2.4

2013-01-16 Thread Dotan Cohen
On Wed, Jan 16, 2013 at 11:50 PM, Prasad, Ramit wrote: > Python 2.4 is quite old and simplejson supports 2.5+. I can see a > yield in the encoder code, so it is unlikely to be easy to modify > and get working with 2.4. According to a stack overflow question > you may want to look at older releases

[Tutor] learning to program in cython

2013-01-16 Thread Abhishek Pratap
Hi Guys With the help of an awesome python community I have been able to pick up the language and now willing to explore other cool extensions of it. I routinely have large loops which could be ported to cython for speed. However I have never written a single line of cython code. Any pointers on

Re: [Tutor] Json encode and decode on Puython 2.4

2013-01-16 Thread Prasad, Ramit
Dotan Cohen wrote: > > Hi all, I'm just getting into porting some PHP scripts to Python. One > issue that I'm having is that the scripts need to run on a host with > Python 2.4 that has neither the json nor simplejson packages > available. I figure that I'll have to include the loads() and dumps()

[Tutor] how to track an entry in a large text file

2013-01-16 Thread 3n2 Solutions
Say I have a text file (example below) that has multiple records with the same format but not always the same number of lines. Each record is separated by the line that starts with “Examining file” as in below example. If you notice, the 3D Val is not there for the second record. How do I report t

[Tutor] Set LD_LIBRARY_PATH and equivalents platform-independently

2013-01-16 Thread Albert-Jan Roskam
Hello, Is there a builtin function that can set LD_LIBRARY_PATH or equivalents platform-independently? It would be nice use such a function in a setup script. The code below illustrates what I mean, although it's entirely untested. import sys import os def setPath(loc):     """Set LD_LIBRARY_PA

Re: [Tutor] Question regarding lists and manipulating items in lists.

2013-01-16 Thread Steven D'Aprano
On 16/01/13 11:23, Scurvy Scott wrote: After playing with your example I keep being told that list has no attribute int_to_note. I know what the problem is, I just don't know how to fix it. Oops, sorry about that, that is my fault. I did warn that my code was untested! If you know what the pr

Re: [Tutor] text files

2013-01-16 Thread Alan Gauld
On 16/01/13 02:31, Gina wrote: new_file = open("the_file_upper.txt", "w+") In general consider the w+ file option to be for advanced use only. Either open it for reading or writing, don't try to do both at the same time. It's a bit like sitting on a tree branch with a saw to cut it down. If