Re: length of a tuple or a list containing only one element

2008-11-03 Thread Tim Chase
For making a literal tuple, parentheses are irrelevant; only the commas matter: I don't think I'd go so far as to say that the parentheses around tuples are *irrelevant*...maybe just relevant in select contexts >>> def foo(*args): ... for i, arg in enumerate(args): ... prin

Re: Simple textual calendar

2008-11-03 Thread Tim Chase
Yes, I saw the calendar module, but, as I said, this isn't homework or something like that. It is an example which I've setted myself to try to solve to see how it would go. Calendar just gives me the solution :-( Part of the answer to a problem is knowing when not to duplicate effort that's al

Re: Simplifying anonymous inner classes?

2008-11-03 Thread Tim Chase
Is there a more Pythonic way to instantiate sub-classes and provide instance-specific implementations without the overhead of an unused "anonymous" class cluttering my code/namespace? I agree with Carl Banks that what you do is already fairly Pythonic: explicit is better than implicit, and simpl

Re: length of a tuple or a list containing only one element

2008-11-03 Thread Tim Chase
For making a literal tuple, parentheses are irrelevant; only the commas matter: I don't think I'd go so far as to say that the parentheses around tuples are *irrelevant*...maybe just relevant in select contexts >>> def foo(*args): ... for i, arg in enumerate(args): ... print

Re: storing a string data in access

2008-11-03 Thread Tim Arnold
ng a data. How can I do this? > > t = "string representing a datum" > access.Fields("Time").value = t maybe OP means t = "string representing a date", but I'm just guessing. --Tim Arnold -- http://mail.python.org/mailman/listinfo/python-list

Re: buffer

2008-11-03 Thread Tim Roberts
ript can then generate the NEXT page. The key is that each page stands alone. You don't hold the data in between. You make a new database query each time a new request comes in. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Parse each line by character location

2008-11-04 Thread Tim Chase
I hope this is the right place to ask, but I am trying to come up with a way to parse each line of a file. Unfortunately, the file is neither comma, nor tab, nor space delimited. Rather, the character locations imply what field it is. For example: The first ten characters would be the record num

Re: script that parses command line, and execfile('')

2008-11-04 Thread Tim Chase
Sandip Bhattacharya wrote: On Nov 4, 12:43 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: def main(argv=None): if argv is None: argv = sys.argv[1:] ... Wouldn't that make optparse miss the first parameter sys.argv[1] mistaking it to be the name of the current program? Nope...opt

Re: Parse each line by character location

2008-11-04 Thread Tim Chase
recno_idx = slice(0,10) client_idx = slice(10, 11) volume_idx = slice(11,11+10) order_type_idx = slice(11+10, 11+10+3) . !? That seems to me confusingly far from a working solution, at least in comparison to recno_idex = the_line[0:10] client_idx = the_li

Re: Extract frame from wmv

2008-11-05 Thread Tim Golden
Martin wrote: I need to extract a frame from a wmv file and save it as a jpg. In fact I need to extract a frame from each one of a collection of several thousand wmv files, but that's beside the point. I've actually written a script that does exactly this using the pyglet module. But while it

Re: Extract frame from wmv

2008-11-05 Thread Tim Golden
Martin wrote: I've looked at Pymedia but I have to admit I couldn't work it out. Commandline might be good, but I'm really hoping someone can point me in the right direction, as this is not my area of expertise. Nor mine :) Just so people can help you out, can you be more precise in your req

Re: Rewriting a bash script in python

2008-11-05 Thread Tim Rowe
or implementation problem, so rather than recoding it it might be worth looking at various approaches to requirements capture and specification. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: locating the chorus in a MIDI song?

2008-11-05 Thread Tim Rowe
likely) to find the bridge than find a chorus.. By the way, some of the papers referenced seem confused between refrains (which form part of the verses) and choruses (which are separate musical units). -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

modifying a codec

2008-11-05 Thread Tim Arnold
.write(line) fd1.close() The codec is doing its job, but I want to override the codepoint for this character (plus others) to use the html entity instead (from \227 to — in this case). I see hints writing your own codec and updating the decoding_map, but I could us

Re: (Windows) "Dropping" stuff onto a Python script

2008-11-06 Thread Tim Golden
[EMAIL PROTECTED] wrote: Hello people, I'd like to have the functionality known from "real" executables that if I drag-drop a file icon on top of the app, the app starts and has the file's path as command-line argument. However, this doesn't seem to work with Python scripts because Windows sees

Re: Rewriting a bash script in python

2008-11-06 Thread Tim Rowe
nts capture methodologies too, so rapid prototyping is up there with the rest of them. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: Extract frame from wmv

2008-11-06 Thread Tim Golden
Martin wrote: Lawrence D'Oliveiro wrote: In message <[EMAIL PROTECTED]>, Tim Golden wrote: Alternatively, you might be able to commandline control mencoder or ffmpeg itself to do this. Not sure, but there must be *something* among those millions of command-line options!

Re: More __init__ methods

2008-11-06 Thread Tim Golden
Mr.SpOOn wrote: Hi, I know there can be only one __init__ method (at least, I think). Often I need an object to be created in different ways, for example passing a string as argument, or an integer, or another object. To achieve this I put the default value of the arguments to None and then I so

Re: CGI Python problem

2008-11-06 Thread Tim Chase
I've placed this file in both public_html and as a test in public_html/ cgi-bin directories in my local user account (I dont have root access - its a corparate network). The file definitely has read and execute permission (744) as have the assoicated directories. My guess would be the permission

Re: CGI Python problem

2008-11-06 Thread Tim O'Toole
Thanks for replying Tim, Here is the permissions, which I think are definitely right now: drwxrwxrwx 8 4.0K Nov 6 13:34 public_html/ drwxrwxrwx 2 4.0K Nov 6 13:35 cgi-bin/ [inside public_html] -rw-r-xr-x 1 117 Nov 6 11:39 test_pl.cgi* [inside cgi-bin] -rw

Re: More __init__ methods

2008-11-06 Thread Tim Golden
Mr.SpOOn wrote: On Thu, Nov 6, 2008 at 4:59 PM, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: class A(object): def __init__(self, a, b, c): self.a = a # ... @classmethod def from_string(cls, s): # ... return cls(a, b, c) Thanks. I think it's time to

Re: CGI Python problem

2008-11-06 Thread Tim Chase
Here is the permissions, which I think are definitely right now: drwxrwxrwx 8 4.0K Nov 6 13:34 public_html/ drwxrwxrwx 2 4.0K Nov 6 13:35 cgi-bin/ [inside public_html] -rw-r-xr-x 1 117 Nov 6 11:39 test_pl.cgi* [inside cgi-bin] -rw-r-xr-x 1 168

Re: CGI Python problem

2008-11-06 Thread Tim O'Toole
With regard to phpinfo(), its shows the mod_cgi is loaded, but neither mod_perl or mod_python is loaded (I read on the python.org site that mod_python can interfere with running python through mod_python). As for writing some perl, not too sure how to do that, but from the information in phpinfo I

Re: CGI Python problem

2008-11-06 Thread Tim Chase
As for writing some perl, not too sure how to do that, but from the information in phpinfo I logged onto the webserver machine and did a "whereis python" - it came back blank! Of course doing a whereis perl gave a non-blank answer. So this seems to be the route cause of my trouble. Indeed! I ma

Re: CGI Python problem

2008-11-06 Thread Tim O'Toole
Alas that cgi script confirmed python is not installed on the server machine (which I had assumed it was). Looks like game over with this avenue of trouble shooting? On Fri, Nov 7, 2008 at 1:03 AM, Tim Chase <[EMAIL PROTECTED]> wrote: >> As for writing some perl, not too sure how to

Re: CGI Python problem

2008-11-06 Thread Tim Chase
Tim O'Toole wrote: Alas that cgi script confirmed python is not installed on the server machine (which I had assumed it was). Did you also try it with the "find" variant in addition to just the "which" version? This would find Python if it wasn't on the $PATH

Re: CGI Python problem

2008-11-07 Thread Tim O'Toole
> > Well, if Python's not installed, the next step is _getting_ it installed -- > whether having your admin install it globally (I mean, who *doesn't* install > python?! ;-) or you install it locally in your home directory as detailed > at [1] where you download the source and compile from scratch

Re: Does Python have Multiple Inheritance ?

2008-11-07 Thread Tim Golden
Aaron Gray wrote: "Roy Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] In article <[EMAIL PROTECTED]>, Tim Golden <[EMAIL PROTECTED]> wrote: Aaron Gray wrote: Wikipedia says Python has Multiple Inheritance, is this true ?

Re: Does Python have Multiple Inheritance ?

2008-11-07 Thread Tim Golden
Aaron Gray wrote: Wikipedia says Python has Multiple Inheritance, is this true ? http://en.wikipedia.org/wiki/Multiple_inheritance Thanks, Aaron Good grief. You can use Wikipedia but you can't use Google? http://www.google.co.uk/search?q=python+multiple+inheritance TJG -- http://mail.p

Re: .pyc keeps running and never stops

2008-11-07 Thread Tim Couper
David perhaps you should include the source that you are trying to compile... unlikely to get advice without some specifics .. Tim -- http://mail.python.org/mailman/listinfo/python-list

Re: File names are changed into capital letter in Python CE and WM5

2008-11-08 Thread Tim Roberts
ormat, this is exactly what you see. On a FAT system, the name "__init__.py" is stored twice: once in a short-name entry called "__INIT__.PY", and again in a long-name entry that has the real name. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling Python from Python and .pyc problem

2008-11-08 Thread Tim Roberts
ectly. >However, it runs but never stops. WHAT runs but never stops? The script you attached certainly stops. Post your exact code, and we'll help you identify your infinite loop. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Workflow engine?

2008-11-08 Thread Tim Chase
After all its "just" maintaining a state and rules for possible transitions. I've implemented my own web framework (just like every other Python developer ;-) and I've done my own finite-state-machines for workflows. Web Frameworks are large, error-prone and have a lot of nuanced details. W

Re: Python fish simulation?

2008-11-10 Thread Tim Chase
Is there any Python-based fish simulation project? I've tried searching google and pypi, but no luck. No burning need, just seems like it'd be fun. Without much detail on what you want to simulate... class Fish: LITTLE, HUGE = range(2) def __init__(self, name, size=None): self.name

Re: Where to locate existing standard encodings in python

2008-11-09 Thread Tim Chase
I was googling quite some time before finding the answer to my question: 'what are the names for the encodings supported by python?' I found the answer at http://python.active-venture.com/lib/node127.html Now my question: Can I find the same info in the standard python doc or query python with

Re: Python COM: Automatic wrap/unwrap?

2008-11-10 Thread Tim Golden
greg wrote: Larry Bates wrote: You should post this on comp.python.windows as Mark and the other Windows/COM gurus hang around there a lot. I can't find any such newsgroup -- are you sure that's what it's called? I think that's what it's called on gmane (or some other newsgroup gateway). Fr

Re: Python 3.0 - is this true?

2008-11-10 Thread Tim Roberts
care, Steven? > >I'm a very caring kind of guy. That's the best answer to that question that I've seen in a long time. I'll remember that one. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Where to locate existing standard encodings in python

2008-11-11 Thread Tim Chase
You haven't explained why you think that you *need* a list of all encodings that exist at a point in time. What are you going to do with the list? Just because I ran into this recently, the Dilbert.com site returns a bogus Content-type header with Content-Type: text/html; charset=utf-8lias

Re: Where to locate existing standard encodings in python

2008-11-11 Thread Tim Chase
Content-Type: text/html; charset=utf-8lias For Python to parse this, I had to use Python's list of known encodings in order to determine whether I could even parse the site (for passing it to a string's .encode() method). You haven't said why you think you need a list of known encodings!

Re: duck-type-checking?

2008-11-12 Thread Tim Rowe
cks like a duck then all you need to know is that hasattr(foo, "quack") and (if so) callable(foo.quack) If you need to know that it walks like a duck, mates like a duck and tastes like a duck when roasted, you probably want it to really /be/ a duck and should go back to inheritance. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: [Array] Finding index that contains part of a string?

2008-11-12 Thread Tim Chase
Out of curiosity, is there a better way in Python to iterate through an array, and return the index of each item that contains the bit somewhere in its value, ie. index() doesn't work because it only returns if the value only contains the item I'm looking for. This works: next = re.compi

Re: duck-type-checking?

2008-11-12 Thread Tim Rowe
longer compliant with the the factory class (which doesn't support the new "form_pun_relating_to_avoiding_a_high_hazard()" method) . Fine. If you checked for all the members of the class that your code uses, it makes no difference. ABCs give you a way of doing this, but in their absence it's a long

Re: duck-type-checking?

2008-11-13 Thread Tim Rowe
2008/11/13 Ben Finney <[EMAIL PROTECTED]>: > That is not duck typing. Oh, I'm pretty sure it is. It just isn't /using/ the duck typing in the way you'd like. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: Midi manipulation

2008-11-16 Thread Tim Roberts
s in advance. Google is much faster than this newsgroup. Search for "python midi library" and the first page gives you a number of good hits. However, there's a lot to manipulating MIDI. What kinds of things are you hoping to accomplish? MIDI, for example, is not a particularly

Re: Little direction please Python MySQL

2008-11-17 Thread Tim Chase
Files are fixed format no field delimiters, fields are position and length records are terminated by newline. Assuming no COMPUTATIONAL fields, it should be easy enough to split each line up into fixed-length pieces, e.g. assuming a simple example 01 Sample-Record. 02 Field-1 pic XXX

Re: Problems Writing £ (pound sterling) To MS SQL Server using pymssql

2008-11-17 Thread Tim Golden
Darren Mansell wrote: Hi. I'm relatively new to python so please be gentle :) I'm trying to write a £ symbol to an MS SQL server using pymsssql . This works but when selecting the data back (e.g. using SQL management studio) the £ symbol is replaced with £ (latin capital letter A with circumf

Re: Multiple equates

2008-11-17 Thread Tim Chase
It doesn't matter as none of this is valid Python. In Python you have to write array[x1] = False array[x2] = False Uh...not so much... >>> a = [1,2,3,4,5] >>> x1, x2 = 1, 3 >>> a[x1] = a[x2] = False >>> a [1, False, 3, False, 5] Works for me. To the OP, I think rather than cluttering my

Re: Question: what to do, my Python is getting crazy

2008-11-17 Thread Tim Roberts
ied procedure could not be >found. If you feel like it, could you do a search for "pythoncom25.dll" and tell us if more than one was found? >I know Python 2.5 doesn't load DLL's anymore. Where did you read that? It's not true. >Gabriel, you mean, install pyt

Re: Midi manipulation

2008-11-17 Thread Tim Roberts
midi was good for this aim, >am I wrong? No, you are correct. I was misled by your talk about "manipulating MIDI files". What you're talking about is more working with live MIDI. Alia's links should be very useful for you. Especially, I think, this one: http://tu

Re: python script to act as list server

2008-11-17 Thread Tim Roberts
dress. You know, the well-known, well-tested, and reliable Mailman application can do this, and it's written in Python. -- Tim Roberts, [EMAIL PROTECTED] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: file tell in a for-loop

2008-11-19 Thread Tim Chase
Magdoll wrote: I was trying to map various locations in a file to a dictionary. At first I read through the file using a for-loop, but tell() gave back weird results, so I switched to while, then it worked. The for-loop version was something like: d = {} for line

Re: More elegant way to try running a function X times?

2008-11-19 Thread Tim Chase
I need to try calling a function 5 times. If successful, move on; If not, print an error message, and exit the program: success = None for i in range(5): #Try to fetch public IP success = CheckIP() if success: break if not success: print "Exiting."

Re: Multiple equates

2008-11-19 Thread Tim Roberts
nswer: it does not matter. This is premature optimization. First, make it work. Then, figure out whether it is fast enough. THEN, figure out what's taking the most time. I'd be very, very surprised if this was an important part of your run time. -- Tim Roberts, [EMAIL PROTECTED] Providenza

Re: help with comparison

2008-11-19 Thread Tim Roberts
It's simple character manipulation. So, options.compress will NEVER be 1. If you did "myscript.py -c 1", then options.compress will be "1". That's a string, not a number. If what you really want is "present" vs "not present", then use this:

Re: Ip format

2008-11-20 Thread Tim Chase
Hello i have this ip 1578568204 how socket function i can have the ip dotted-quad string? i have try socket.inet_aton get no error but only this ^ETB FF I've got the following program I threw together for one of my junior developers: from sys import argv, exit if len(argv) <> 2: pr

Re: More elegant way to try running a function X times?

2008-11-20 Thread Tim Chase
success = None for i in range(5): #Try to fetch public IP success = CheckIP() if success: break if not success: print "Exiting." sys.exit() Though a bit of an abuse, you can use if not any(CheckIP() for _ in range(5)): print "Exiting" sys.exit() I don't se

Re: sorting list of complex numbers

2008-11-21 Thread Tim Golden
Steven D'Aprano wrote: On Wed, 19 Nov 2008 18:39:27 -0800, Paul Rubin wrote: Terry Reedy <[EMAIL PROTECTED]> writes: Do your tuple destructuring in the first statement in your body and nothing will break. Why get rid of a useful feature that unclutters code? Unfortunately, the people who fi

Re: Dynamic features used

2008-11-21 Thread Tim Chase
- What are the dynamic features of Python that you use in your code? (excluding ones that can can be done with a good static template system). introspection & dynamic properties are a big one. Having functions and classes as higher-order objects that can be passed around like any other variab

Re: Need help converting text to csv format

2008-11-21 Thread Tim Chase
40922003 Life Fitness Products $1 (12-13-08) (CVS) 546500181141 Oust Air Sanitizer, any B1G1F up to $3.49 (1-17-09) .35 each 518000159258 Pillsbury Crescent Dinner Rolls, any .25 (2-14-09) 518000550406 Pillsbury Frozen Grands Biscuits, Cinnamon Rolls, Mini Cinnamon Rolls, etc. .40 (2-14-09) i

Re: Need help converting text to csv format

2008-11-21 Thread Tim Chase
>>> qfields = ['"' + fld.strip() + '"' for fld in (num,desc,date)] >>> out = qfields.join(',') Just a quick note here to prevent the confusion of the OP...this should be ','.join(qfields) -tkc -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help converting text to csv format

2008-11-21 Thread Tim Golden
Tim Chase wrote: >>> qfields = ['"' + fld.strip() + '"' for fld in (num,desc,date)] >>> out = qfields.join(',') Just a quick note here to prevent the confusion of the OP...this should be ','.join(qfields) To be honest,

Re: Need help converting text to csv format

2008-11-21 Thread Tim Golden
Joe Strout wrote: A follow-up question here... is it really necessary to close things like files in Python? I've been slumming it in the REALbasic community for the last decade, where you generally don't worry about such things, as any object that represents something "open" will automatically

Re: Need help converting text to csv format

2008-11-21 Thread Tim Chase
Tim Golden wrote: Tim Chase wrote: >>> qfields = ['"' + fld.strip() + '"' for fld in (num,desc,date)] >>> out = qfields.join(',') Just a quick note here to prevent the confusion of the OP...this should be ','.join(qfields

Re: Need help converting text to csv format

2008-11-21 Thread Tim Golden
Tim Chase wrote: yes, the CSV module has some wonderful stuff in it, and I regularly use it for *reading* CSV files. But for writing them, it's often just as fast (for my purposes) to simply code my 1st post's quickie as it is to scrounge in the docs/docstrings to remember how to l

Re: Solved: Metaclass conflict TypeError exception: problem demonstration script

2009-02-23 Thread Tim Golden
Barak, Ron wrote: That's it. Once I changed my class header to: $ cat -n metaclass_test01.py 1 #!/usr/bin/env python 2 3 import sys 4 import wx 5 import CopyAndPaste 6 7 class ListControl(wx.Frame, CopyAndPaste.CopyAndPaste): I'm getting no more Metaclas

Re: Python shell scripting and errors

2009-02-23 Thread Tim Wintle
On Mon, 2009-02-23 at 09:12 -0800, Phillip B Oldham wrote: > I've got a python script running as a daemon (using someone else's > daemon module). It runs fine for a while, but will occasionally balk > and die. Since its running in the background, I'm getting no error > from it. > > What's the best

Peculiar swap behavior

2009-02-23 Thread Tim Chase
I stumbled across this oddity and was hoping folks on the list might be able to provide a little understanding: # swap scalars >>> x,y = 1,2 >>> x,y = y,x >>> x,y (2, 1) # swap lists >>> a,b = [1,2,3],[4,5,6] >>> a,b = b,a >>> a,b ([4, 5, 6], [1, 2, 3]) # swap list contents...not so much... >>

Re: Challenge: Please break this! [Python Security]

2009-02-23 Thread Tim Wintle
On Mon, 2009-02-23 at 20:50 +, tav wrote: > I'm keen to know your experiences even if you don't manage to write to > the filesystem -- and especially if you do! > er sorry, but: from safelite import FileReader reload(__builtins__) f = open("/home/tim/nano.save"

Re: Reading a tab delimited text file.

2009-02-23 Thread Tim Chase
I would like to read a text file of numbers produced by a data acquisition system into three vectors of doubles. The contents of the file are: +0.000e+0 +2.7645134e+1 +2.7745625e+1 +0.4100041e-1 +2.7637787e+1 +2.7731047e+1 +0.0820008e+0 +2.7645134e+1 +2.7750483e+1 ... or +0.

Re: Reading a tab delimited text file.

2009-02-23 Thread Tim Chase
time_vec, ch1_vec, and_so_on = zip(*( map(float, line.split()) for line in file('in.txt'))) If this isn't homework, there are some less terse versions which are a bit easier on the eyes and less like some love-child between Perl and Python. haha, no this isn't homework. I'm a mecha

Re: Challenge: Please break this! [Python Security]

2009-02-23 Thread Tim Wintle
On Mon, 2009-02-23 at 13:20 -0800, Paul McNett wrote: > tav wrote: > > I'm keen to know your experiences even if you don't manage to write to > > the filesystem -- and especially if you do! > > Does it count when it breaks some standard libs that aren't even trying to > write to > the filesystem

Re: more on unescaping escapes

2009-02-23 Thread Tim Wintle
ngs in the interpreter it includes escape characters, when it is printed though the output is straight to stdout and isn't escaped. Hope that helps, Tim Wintle -- http://mail.python.org/mailman/listinfo/python-list

Re: Reference or Value?

2009-02-24 Thread Tim Rowe
; they would get much the same answer for the first question (immutability is handled differently, I think, but it's there) but a totally different answer to the second. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: Newby - is this what they are looking for ?? and is their a better a way

2009-02-24 Thread Tim Rowe
p it simple, the way you have been so far. 4. If you want to be a wise guy, ask your tutor why he/she got you to convert the whole phrase to upper case, wasting a whole pile of character conversion operations under the hood, because it's only the acronym that needs to be converted :-) -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: try except question - serious foo bar question, and pulling my hair out :-)

2009-02-24 Thread Tim Rowe
son will > ask an enlightening question; but, sometimes they just make > unhelpfull wisecracks.  It's a tough choice. I used to use a baby, which avoids the embarrassment but can be just as problematic to order on the internet. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: variable length tuple assignment

2009-02-25 Thread Tim Chase
Chris Rebert wrote: On Wed, Feb 25, 2009 at 1:16 AM, Helmut Jarausch wrote: Sorry if this is too simple but I couldn't find. I vaguely remember there is a means to assign a variable length tuple and catch the 'rest' like S="a,b,c,d" (A,B,) = S.split(',') In Python 3.0 (IIRC): A, B, *rest

Re: How do I decode unicode characters in the subject using email.message_from_string()?

2009-02-25 Thread Tim Golden
Thorsten Kampe wrote: * Gabriel Genellina (Wed, 25 Feb 2009 14:00:16 -0200) En Wed, 25 Feb 2009 13:40:31 -0200, Thorsten Kampe escribió: * Roy H. Han (Wed, 25 Feb 2009 10:17:22 -0500) Thanks, RDM, for stating the right approach. Thanks, Steve, for teaching by example. I wonder why the email

Re: The Python's regex different from Perl's ,I want know what's the different?

2009-02-26 Thread Tim Chase
The Python's regex different from Perl's ,I want know what's the different? Easy: bash$ diff <(lynx -dump http://perldoc.perl.org/perlre.html) <(lynx -dump http://docs.python.org/library/re.html) Had you tried the great Google in the sky, you might have found such pages as: http://mail

Re: Run a python script as an exe and run a new process from it

2009-02-26 Thread Tim Wintle
On Thu, 2009-02-26 at 04:55 -0800, [email protected] wrote: > Hello all, >I've a strange requirement where I need to run a python > script just as we run an exe (by double clicking through windows > explorer or by typing the script name at command prompt). I don't know how windows

Re: Efficient searching through objects

2009-02-26 Thread Tim Rowe
rations and so is likely to be faster still. I think there are a couple that Python works well with, but I've never looked into that -- others will no doubt be along with recommendations now I've raised the subject. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: Efficient searching through objects

2009-02-26 Thread Tim Chase
relational database will be optimised to do these operations and so is likely to be faster still. I think there are a couple that Python works well with, but I've never looked into that -- others will no doubt be along with recommendations now I've raised the subject. batteries-included support

Re: Run a python script as an exe and run a new process from it

2009-02-26 Thread Tim Wintle
On Thu, 2009-02-26 at 06:00 -0800, [email protected] wrote: > Thanks for the reply, >Being a newbie to python, I am finding it difficult to > understand the logic even after thorough reading of comments. Is there > any simpler way where I can just run a python script from the main

Re: OT: handling multiple software repositories

2009-02-26 Thread Tim Golden
Thomas Guettler wrote: Hi, this is a bit off topic. In our company we have several SVN repositories. According to [1] Trac by default only handles one repository. Of course Trac links like changeset [1234] would not work anymore. You would need [repro/1234] or something like this. I think ma

Re: best way to parse a function-call-like string?

2009-02-26 Thread Tim Wintle
ot;, [] > "junkpkg.f1", ['aaa'] > "junkpkg.f1", ['aaa','bbb'] > "junkpkg.f1", ['aaa','bbb','ccc'] > "junkpkg.f1", ['aaa','with,comma'] > quick and dirty for s in string_list: if "(" in s and s[-1] == ")": parts = s.split("(") fn, args = s[0],s[1][:-1].split(",") Tim Wintle -- http://mail.python.org/mailman/listinfo/python-list

Re: best way to parse a function-call-like string?

2009-02-26 Thread Tim Wintle
On Thu, 2009-02-26 at 21:39 +, Tim Wintle wrote: > On Thu, 2009-02-26 at 21:29 +, [email protected] wrote: > > "junkpkg.f1", ['aaa','with,comma'] oops - missed this one, ignore my last reply. -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: handling multiple software repositories

2009-02-27 Thread Tim Golden
Loretta SALINO wrote: Tim Golden wrote: Thomas Guettler wrote: Hi, this is a bit off topic. In our company we have several SVN repositories. According to [1] Trac by default only handles one repository. Of course Trac links like changeset [1234] would not work anymore. You would need

Re: How can I know when a sub-process is effectively initialized?

2009-02-27 Thread Tim Golden
Giampaolo Rodola' wrote: It seems to work fine on posix but we still got problems on Windows where it seems that waiting for pid to show up in the system process list is not enough for considering the process effectively initialized. Anyway, I think it's a problem in our code. Thanks for your hel

Re: removing duplication from a huge list.

2009-02-27 Thread Tim Rowe
ords, and it won't all fit into memory. So your observation is pertinent. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: removing duplication from a huge list.

2009-02-27 Thread Tim Chase
How big of a list are we talking about? If the list is so big that the entire list cannot fit in memory at the same time this approach wont work e.g. removing duplicate lines from a very large file. We were told in the original question: more than 15 million records, and it won't all fit into me

Re: removing duplication from a huge list.

2009-02-27 Thread Tim Rowe
hashes are not collisions but genuine duplicates you can throw them away as soon as they're checked, so with some clever buffering you can stop them from clogging up the buffer. The worst case is if there are a lot of genuine collisions, in which case it's probably not a very good hash. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: Guidance on writing a top-like console

2009-02-27 Thread Tim Chase
I am interested in writing an application that functions like a Unix or Linux top in the way it displays data. It should be command-line based but dynamically refreshing. You might look at the sourcecode for "iotop"[1] which would make a good example (it's a "top"-like program written in Python

Re: c.Win32_OperatingSystem question.

2009-02-28 Thread Tim Golden
bryan rasmussen wrote: Maybe there's a more specific list I should ask this question on but I don't know what it is. I'm using Tim Golden's wmi stuff, and putting my output into an XML document. I have the following bit of code [.. snip ...] At the end of that thhe

Re: why cannot assign to function call

2009-02-28 Thread Tim Roberts
>list after func. Any further explanation you care to provide will be >greatly appreciated! Nope. Under pass-by-value semantics, "func" could dance on the list to its heart's content, and "foo" would not be changed. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list

Re: i have problem with glob.glob() in remotely directory

2009-02-28 Thread Tim Roberts
the shares that the machine exposes. Second, you STILL have a backslash problem. If that machine has a network share called "files", you could say os.walk( '192.168.0.45\\files' ) or os.walk( r'\\192.168.0.45\files' ) >Thats it is my main problem do i

Re: Performance of Python 3

2009-03-02 Thread Tim Rowe
hon (and probably in Ruby too) is to get the code working, then if there are any *measured* bottlenecks to optimise them in C++. That means that in practice there won't be a perceptible speed difference for the user. -- Tim Rowe -- http://mail.python.org/mailman/listinfo/python-list

Re: os module

2009-03-02 Thread Tim Chase
Its just http, I am using pylons. Right now I am doing tht with extra parameter. But even if I get to know about the platform of the client machine, I need to use the other properties of the corresponding machine's os module. HTTP doesn't require the client browser to send any such information

Re: Restructure dictionary (Python 2.5)

2009-03-02 Thread Tim Chase
I tried this code: old_dict = {'xyz':['a','b','c'],'baz':['c','d']} new_dict = {} for dkey, vallist in old_dict.iteritems(): for val in vallist: if val in new_dict: theset = new_dict[val] theset.add(dkey)

Re: How can I add space in to several numbers?

2009-03-02 Thread Tim Chase
I want to parse a file and do this : A 74.335 -86.474-129.317 1.00 54.12 then add space between -86.474 and -129.317. I can get the file with A 74.335 -86.474 -129.317 1.00 54.12 How can I do this? Thanks. Is there something wrong with the following? for line in file('in.txt')

Re: Pickle Problem

2009-03-03 Thread Tim Wintle
efines it) Exceptions are just classes, so you'll have to import and reference it like you'd reference any other class you import. Hope that helps Tim Wintle -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and Windows Services Question

2009-03-04 Thread Tim Golden
Phoe6 wrote: This is a windows services question. The following script which is a windows service was supposed to something ( download wallpaper and set the desktopwallpaper) at 16:45 my time here. The service is running, but the supposed action did not take place. Does anyone who is aware of win

<    48   49   50   51   52   53   54   55   56   57   >