Re: Deploying on Windows servers : advice sought a module

2011-03-09 Thread Rory Campbell-Lange
sys.path and loads the main script. ... Hi Waldemar. Thanks for your advice. I'll have another play with py2exe. Many thanks Rory -- Rory Campbell-Lange r...@campbell-lange.net -- http://mail.python.org/mailman/listinfo/python-list

Deploying on Windows servers : advice sought a module

2011-03-08 Thread Rory Campbell-Lange
tomate the hg pull/update process. Windows servers use Tim Golden's WMI modules and the pywin32 extensions. -- Rory Campbell-Lange r...@campbell-lange.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Get name of file from directory into variable

2010-08-03 Thread Rory Campbell-Lange
.listdir and fnmatch.fnmatch functions internally, so is definitely the way to go. http://docs.python.org/library/glob.html -- Rory Campbell-Lange r...@campbell-lange.net -- http://mail.python.org/mailman/listinfo/python-list

Re: Sort the values of a dict

2009-12-19 Thread Rory Campbell-Lange
7;m a bit rusty, and have just picked up the new "Learning Python" book but I'm finding that it isn't providing a useful refresher to the language or a particularly good introduction to version 3. Have you any suggestions. Regards Rory -- Rory Campbell-Lange r...@campbell-la

Re: Sort the values of a dict

2009-12-18 Thread Rory Campbell-Lange
or x in pres: > ... res.append((x, d[x])) > ... > >>> res > [(2, ('u', 9, 8)), (5, ('r', 21, 10)), (1, ('a', 1, 12))] How about >>> mylist = [z for z in zip(list(d), list(d.values()))] and then sort on your sort criteria, either i

Re: Line indexing in Python

2009-12-18 Thread Rory Campbell-Lange
butes -- Rory Campbell-Lange Director r...@campbell-lange.net Campbell-Lange Workshop www.campbell-lange.net 0207 6311 555 3 Tottenham Street London W1T 2AF Registered in England No. 04551928 -- http://mail.python.org/mailman/listinfo/python-list

Re: Line indexing in Python

2009-12-18 Thread Rory Campbell-Lange
to do with the output from your programme. -- Rory Campbell-Lange r...@campbell-lange.net Campbell-Lange Workshop www.campbell-lange.net 0207 6311 555 3 Tottenham Street London W1T 2AF Registered in England No. 04551928 -- http://mail.python.org/mailman/listinfo/python-list

Re: Local class variables? (mod_python problem)

2007-02-23 Thread Rory Campbell-Lange
r example. However, I presume that is not the desired > usecase, from what I can extract from your posts I presume it's case two. Many thanks for your reply. The use case is per request, and I would be grateful to learn more about thread-local storage. Kind regards Rory -- Rory Campbell-Lange <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Local class variables? (mod_python problem)

2007-02-22 Thread Rory Campbell-Lange
On 22/02/07, Rory Campbell-Lange ([EMAIL PROTECTED]) wrote: > In essence we use class variables as follows: > > class Part (object): > totalgia = 0 > def __init__(self, gia): > self.gia = gia # gross internal area >

Re: Local class variables? (mod_python problem)

2007-02-22 Thread Rory Campbell-Lange
Kind regards Rory On 22/02/07, Rory Campbell-Lange ([EMAIL PROTECTED]) wrote: > We have a set of classes using static methods to retain reference > variables between operations. The problem is that the static variables > are not reset between operations when used through mod_python. &g

Local class variables? (mod_python problem)

2007-02-22 Thread Rory Campbell-Lange
a.incrementer() a.addone() b = TryMe() b.incrementer() b.addone() print 'a:', a print 'b:', b -- Rory Campbell-Lange <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Maths error

2007-01-08 Thread Rory Campbell-Lange
much appreciated; Rory -- Rory Campbell-Lange <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: read sys.stdin, then raw_input

2006-03-02 Thread Rory Campbell-Lange
> ... > # rebind sys.stdin to my tty > sys.stdin = open("/dev/tty") -- Rory Campbell-Lange <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie errors :-( Need help

2006-03-02 Thread Rory Campbell-Lange
at could be > the reason? > > fibo.fib(1000) > 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987Traceback (most recent call > last): > File "", line 1, in ? > File "fibo.py", line 8, in fib > return result > NameError: global name &

Re: read sys.stdin, then raw_input

2006-03-02 Thread Rory Campbell-Lange
To clarify, how can I get a normal terminal prompt for raw_input to enable me to insert a value into variable 'sel'? The program wants to keep reading from the piped file, it seems. Rory On 01/03/06, Rory Campbell-Lange ([EMAIL PROTECTED]) wrote: > I'm stumped. I'm p

read sys.stdin, then raw_input

2006-03-02 Thread Rory Campbell-Lange
raw_input('Selection? : ') Selection? : Traceback (most recent call last): File "/tmp/z.py", line 5, in ? sel = raw_input('Selection? : ') EOFError: EOF when reading a line Advice much appreciated. Rory -- Rory Campbell-Lange <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

newbie : prune os.walk

2005-03-10 Thread Rory Campbell-Lange
t, dirs, files ... /tmp/test ['one', 'two'] ['1', '2', '3', '4'] /tmp/test/one ['subone'] ['1', '2', '3', '4'] /tmp/test/one/subone [] [] /tmp/test/two [] ['5', '6', '7', '8'] -- Rory Campbell-Lange <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Sorting dictionary by 'sub' value

2005-03-08 Thread Rory Campbell-Lange
t; decorated = [(value[9]['date'], key) > for key, value in v.iteritems()] > decorated.sort() > result = [key for key, date in decorated] On 08/03/05, Batista, Facundo ([EMAIL PROTECTED]) wrote: > >>> temp_list = [ (x[1][1], x[0]) for x in d.items() ] ... > >>> temp_list.sort() > >>> for (tmp, key) in temp_list: -- Rory Campbell-Lange <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Sorting dictionary by 'sub' value

2005-03-08 Thread Rory Campbell-Lange
, 'date': (0x9004) ASCII=2004:12:07 00:18:20 @ 514, 'x' : (0x011A) Ratio=72 @ 174, 'model' : (0x0110) ASCII=PENTAX Optio 330 @ 156, 'size': 367415L, 'orientation' : (0x0112) Short=1 @ 42} Thanks, Rory -- Rory Campbell-Lange <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie CGI problem

2005-02-20 Thread Rory Campbell-Lange
On 18/02/05, Peter Otten ([EMAIL PROTECTED]) wrote: > Rory Campbell-Lange wrote: > > > #!/usr/bin/python > > import cgi > > print "Content-type: text/html\n\n" > > print "hi" > > > > Gives me the following in my browser: &g

Newbie CGI problem

2005-02-18 Thread Rory Campbell-Lange
#!/usr/bin/python import cgi print "Content-type: text/html\n\n" print "hi" Gives me the following in my browser: ''' hi Content-type: text/html hi ''' Why are there two 'hi's? Thanks, Rory -- Rory Campbell-Lange <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question about class operator overloading

2005-02-16 Thread Rory Campbell-Lange
ful for your help. Rory On 15/02/05, Steven Bethard ([EMAIL PROTECTED]) wrote: > Rory Campbell-Lange wrote: > >I am anxious about how best to set and access items one level down in a > >data structure if I am using __setitem__ and __getitem__. ... > >object['three'

Re: Newbie question about class operator overloading

2005-02-15 Thread Rory Campbell-Lange
calls refer to self.data; is it sensible and right to be able to refer to self.data[n]? Rory On 15/02/05, Rory Campbell-Lange ([EMAIL PROTECTED]) wrote: > Hi. I'm just starting to use python. > > I am anxious about how best to set and access items one level down in a > data struct

Newbie question about class operator overloading

2005-02-15 Thread Rory Campbell-Lange
else: return self.data[key] -- Rory Campbell-Lange <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list