[Tutor] File locking: cross platform?

2009-02-20 Thread Bernard Rankin
Hello, What is the correct way to implement cross-platform "flock like" file locking? Specifically, how would i acquire "exclusive read-write" and "shared read-only" locks for a CGI script that I expect to run on both Windows and Linux servers. Thank you, :)

Re: [Tutor] calling other process?

2009-02-08 Thread Bernard Rankin
> > I sympatjise but to be honest I never use the backtick trick except at > the >>> prompt as a quick and dirty hack. It ranks alongside the _ variable > in my book as an interactive utility but it's too easy to miss or misread to > use > > in real code. > > But even popen is easier, I

Re: [Tutor] calling other process?

2009-02-08 Thread Bernard Rankin
> > Is: > > > > from subprocess import Popen > > output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0] > > > > Really the replacement for: > > > > output = `mycmd myarg` > > Yes, because it works more consistently and reliably across > operating systems for one reason. Its also much

[Tutor] calling other process?

2009-02-08 Thread Bernard Rankin
Hello, I've been reading the Python docs on how to call a 2nd program and getting it's output, and would up here: http://docs.python.org/library/subprocess.html Is: from subprocess import Popen output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0] Really the replacement for: out

Re: [Tutor] regex: not start with FOO

2009-02-03 Thread Bernard Rankin
> > I'd like to match any line that does not start with FOO. (Using just a > > reg-ex > rule) > > > > 1) What is the effective difference between: > > > > (?!^FOO).* > > > > ^(?!FOO).* > > One difference is that the first will match starting anywhere in a > string, while the second will matc

Re: [Tutor] regex: not start with FOO

2009-02-03 Thread Bernard Rankin
> > I'd like to match any line that does not start with FOO. (Using just a > > reg-ex > rule) > > > > 1) What is the effective difference between: > > > > (?!^FOO).* > > > > ^(?!FOO).* > > One difference is that the first will match starting anywhere in a > string, while the second will matc

Re: [Tutor] regex: not start with FOO

2009-02-02 Thread Bernard Rankin
> > I'd like to match any line that does not start with FOO. (Using just a > > reg-ex > rule) > > > > 1) What is the effective difference between: > > > > (?!^FOO).* > > > > ^(?!FOO).* > > > > 2) Is there a better way to do this? > > > > myline = 'FOO things in line' > > >>> myline.startswi

[Tutor] regex: not start with FOO

2009-02-02 Thread Bernard Rankin
Hello, I'd like to match any line that does not start with FOO. (Using just a reg-ex rule) 1) What is the effective difference between: (?!^FOO).* ^(?!FOO).* 2) Is there a better way to do this? Thanks, :) ___ Tutor maillist - Tutor

Re: [Tutor] building Python 2.6?

2009-01-29 Thread Bernard Rankin
> > Python 2.5 builds fine, but I am getting an error when I run "make" for > > 2.6.1 > > > > Here is the command line I am using: > > ../configure -prefix=/home/username/local-python/ --enable-unicode=ucs4 > > > > (I don't know what the ucs4 thing is, but all the HOWTOs I saw say to use >

[Tutor] building Python 2.6?

2009-01-28 Thread Bernard Rankin
Hello, I am trying to build python 2.6 on a machine (web server) that I do not have root access to. (has 2.4 installed) Python 2.5 builds fine, but I am getting an error when I run "make" for 2.6.1 Here is the command line I am using: ../configure -prefix=/home/username/local-python/ --enable-u