Re: detect video length in seconds

2006-05-02 Thread Tim Roberts
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >Is there a way to get the length of a video clip (divix/xvid) in >seconds? This is non-trivial. MPEG files do not have an index, so the only way to figure this out is to scan from the front of the file until you find a timestamp, then scan backwar

Re: ImportError: No module named HTMLParser

2006-05-02 Thread Fredrik Lundh
Mike wrote: > I'm getting the above message on a server installation (2.4) of Python. > I don't get the error using my script on my own machine. I'm trying to > use the non-sgmllib one - the standard HTMLParser but it won't import > on the server. How can I go about checking which file should resi

Re: NewB question on text manipulation

2006-05-02 Thread Steve R. Hastings
On Tue, 02 May 2006 22:37:04 -0700, ProvoWallis wrote: > I have a file that looks like this: > > APPEAL40-24; 40-46; 42-46; 42-48; 42-62; 42-63 PROC > GUIDE921(b)(1) > > (i.e., <[chapter name][multiple or single book page > ranges][chapter name][multiple or single book page > ranges][code] > > b

Re: Possible constant assignment operators ":=" and "::=" for Python

2006-05-02 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > For example: > > >>> A = [] # let's declare a "constant" here > >>> b = A # and let's assign the constant here > >>> b.append('1') # OOPS! > >>> c = A > >>> print A > ['1'] > >>> print b > ['1'] > >>> print c > ['1'] > > As you can see, the "constant" A can be modifie

Re: Recommended data structure for newbie

2006-05-02 Thread Paddy
Hi Matthew, >From your example, it is hard to work out what character or character string is a separator, and what string needs to become a separate word when seen in the original file. In the example below you need to learn about regular expressions. the split is based on the two RE's held in var

ImportError: No module named HTMLParser

2006-05-02 Thread Mike
Hi I'm getting the above message on a server installation (2.4) of Python. I don't get the error using my script on my own machine. I'm trying to use the non-sgmllib one - the standard HTMLParser but it won't import on the server. How can I go about checking which file should reside where? I'm a

Re: Wake on LAN and Shutdown for Windows and Linux

2006-05-02 Thread diffuser78
because you can write scripts in python so easily as compared to other scripting languages. -- http://mail.python.org/mailman/listinfo/python-list

Re: Wake on LAN and Shutdown for Windows and Linux

2006-05-02 Thread diffuser78
Thanks, In fact I checked that. I thought that any other literature would help. David Murmann wrote: > [EMAIL PROTECTED] schrieb: > > How can I shutdown Windows box from my Main (Linux) ? > > Have you seen this? > > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/360649 > > it probably w

Re: request help with Pipe class in iterwrap.py

2006-05-02 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Steve R. Hastings wrote: > What is the friendliest and most Pythonic way to write a Pipe class for > iterwrap? Maybe one with less "magic" syntax. What about using a function that takes the iterators and an iterable and returns an iterator of the chained iterators:: ne

NewB question on text manipulation

2006-05-02 Thread ProvoWallis
I'm totally stumped by this problem so I'm hoping someone can give me a little advice or point me in the right direction. I have a file that looks like this: APPEAL40-24; 40-46; 42-46; 42-48; 42-62; 42-63 PROC GUIDE921(b)(1) (i.e., <[chapter name][multiple or single book page ranges][chapter nam

Re: Possible constant assignment operators ":=" and "::=" for Python

2006-05-02 Thread tsaar2003
Bruno Desthuilliers wrote: > [EMAIL PROTECTED] a écrit : > > Hi Pythonians, > > > > To begin with I'd like to apologize that I am not very experienced > > Python programmer so please forgive me if the following text does not > > make any sense. > > > > I have been missing constants in Python langua

Re: what is the 'host' for SMTP?

2006-05-02 Thread raj
If you've a gmail account, you can set it as smtp.gmail.com. -- http://mail.python.org/mailman/listinfo/python-list

Re: UPGMA algorithm ???

2006-05-02 Thread jairodsl
thank you, google works fine, but dont show me that i expect. thanks again. jDSL -- http://mail.python.org/mailman/listinfo/python-list

Re: UPGMA algorithm ???

2006-05-02 Thread Robert Kern
jairodsl wrote: > Hello ! > > I have searching this algorithm (UPGMA) writting in python, i didnt > found, could anybody help me ??? Thanks a lot!!! Is Google broken today? http://www.google.com/search?q=UPGMA+python -- Robert Kern "I have come to believe that the whole world is an enigma, a

UPGMA algorithm ???

2006-05-02 Thread jairodsl
Hello ! I have searching this algorithm (UPGMA) writting in python, i didnt found, could anybody help me ??? Thanks a lot!!! Cordially, jDSL -- http://mail.python.org/mailman/listinfo/python-list

Types-SIG Archives.

2006-05-02 Thread birchb
Hi, I'm researching the history of proposals to add types to Python, partly to improve my own code, and secondly to be able to make an informed PEP one day. The Types-SIG archives link (http://mail.python.org/pipermail/types-sig/) gives a 404 error. Does anyone know how to get the archive back?

Re: simultaneous assignment

2006-05-02 Thread Steve R. Hastings
On Tue, 02 May 2006 21:44:21 +0200, Boris Borcic wrote: > note that generators have no defined length - precisely because they feed > values one at a time while you need them all together to speak of a > length. The second expression will raise a TypeError because of that. Er, yes. If I had actua

Re: what is the 'host' for SMTP?

2006-05-02 Thread Steve R. Hastings
On Tue, 02 May 2006 22:12:31 -0400, John Salerno wrote: > If I want to write a cgi script that reads the contents of an HTML form > and emails it to me, what would I use as the host parameter for my SMTP > instance? Take a look at your email client. Find where it specifies the server for outgo

Recommended data structure for newbie

2006-05-02 Thread manstey
Hi, I have a text file with about 450,000 lines. Each line has 4-5 fields, separated by various delimiters (spaces, @, etc). I want to load in the text file and then run routines on it to produce 2-3 additional fields. I am a complete newbie to Python but I have the docs and done some experiment

Re: simultaneous assignment

2006-05-02 Thread Steve R. Hastings
On Tue, 02 May 2006 12:58:14 -0700, Roger Miller wrote: > Steve R. Hastings wrote: > >> a = 0 >> b = 0 >> a is b # always true > > Is this guaranteed by the Python specification, or is it an artifact of > the current implementation? I believe it's an artifact of the current implementation. An

Re: simultaneous assignment

2006-05-02 Thread Mel Wilson
Roger Miller wrote: > Steve R. Hastings wrote: > > >>a = 0 >>b = 0 >>a is b # always true > > > Is this guaranteed by the Python specification, or is it an artifact of > the current implementation? AFAIK it's an artifact. The performance hit it Python stopped sharing small integers could b

Re: simultaneous assignment

2006-05-02 Thread Steve R. Hastings
On Tue, 02 May 2006 21:20:48 +0200, Boris Borcic wrote: > Steve R. Hastings wrote: >> So, don't test to see if something is equal to True or False: >> >> if 0 == False: >> pass # never executed; False and 0 do not directly compare > > of course they do - ie isinstance(False,int) is True an

Re: Setting a module package to use new-style classes

2006-05-02 Thread Alex Martelli
Ben Finney <[EMAIL PROTECTED]> wrote: > "Panos Laganakos" <[EMAIL PROTECTED]> writes: > > > Is there a way to have a whole module package use the new-style > > classes, without having to specify it per module-file or even worse, > > per class definition? > > TTBOMK, you do that with a single sta

Re: assignment in if

2006-05-02 Thread Edward Elliott
Edward Elliott wrote: > Edward Elliott wrote: >> assignemnt is actually an expression in those languages, not a >> statement. > > s/statement/operator/ it was probably clearer the first time, but let me rephrase: in C/Java, assignment is neither a statement not an operator. it is an expressio

what is the 'host' for SMTP?

2006-05-02 Thread John Salerno
If I want to write a cgi script that reads the contents of an HTML form and emails it to me, what would I use as the host parameter for my SMTP instance? The example in the docs is 'localhost', but I don't know what that means or refers to. I imagine I would have to use something that was tied

Re: simultaneous assignment

2006-05-02 Thread Grant Edwards
On 2006-05-03, John Salerno <[EMAIL PROTECTED]> wrote: > Bruno Desthuilliers wrote: > >> But my question (sorry, it may not have been clear) was more >> along the line of : "why do you worry about identity in the >> given snippet ?". > > Actually, I kind of thought that maybe it *didn't* matter in

Re: urllib2 not support proxy on SSL connection?

2006-05-02 Thread John J. Lee
Heiko Wundram <[EMAIL PROTECTED]> writes: > Am Dienstag 02 Mai 2006 23:22 schrieb itay_k: > > Is it possible that urllib2 doesnt support for proxy over https > > connections? > > Are you sure this a proxy which is accessed by https, or rather a proxy that > supports CONNECT, and thus allows you

Re: Python & SSL

2006-05-02 Thread John J. Lee
James Stroud <[EMAIL PROTECTED]> writes: > I have been trying to make an https client with python, but it seems What exactly do you mean by "make an https client"? > that, to do this, one needs to have the socket module compiled with ssl. > This is not the default. So I have a couple of quest

Re: Wake on LAN and Shutdown for Windows and Linux

2006-05-02 Thread David Murmann
[EMAIL PROTECTED] schrieb: > How can I shutdown Windows box from my Main (Linux) ? Have you seen this? http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/360649 it probably won't work on linux (maybe with wine or similar?), but you can try to invoke this script on a windows machine somehow.

Re: simultaneous assignment

2006-05-02 Thread John Salerno
Bruno Desthuilliers wrote: > But my question (sorry, it may not have been clear) was more along the > line of : "why do you worry about identity in the given snippet ?". Actually, I kind of thought that maybe it *didn't* matter in this particular example anyway, so my question was meant to be

Anaglyph 3D Stereo Imaging with PIL and numpy

2006-05-02 Thread David Murmann
Hi all! i just found some colored glass and experimented a bit with these red/green 3d images, so i thought i'd share this simple script i wrote to generate such images with anyone whos interested. i also wouldn't mind some comments on the code. see ya, David. *** anaglyph.py *** # uses PIL

Re: simultaneous assignment

2006-05-02 Thread John Salerno
Heiko Wundram wrote: > Hummm... Isn't it easier and faster to solve this problem by hand than to > code > a Python program for it? I had proofs for what has to be on both papers in > about 30 seconds... ;-) Yeah, I had actually already figured it out in my head fairly quickly. > If you're loo

Re: urllib2 not support proxy on SSL connection?

2006-05-02 Thread John J. Lee
Heiko Wundram <[EMAIL PROTECTED]> writes: > Am Dienstag 02 Mai 2006 23:22 schrieb itay_k: > > Is it possible that urllib2 doesnt support for proxy over https > > connections? > > Are you sure this a proxy which is accessed by https, or rather a proxy that > supports CONNECT, and thus allows you

Re: assignment in if

2006-05-02 Thread Edward Elliott
Edward Elliott wrote: > assignemnt is actually an expression in those languages, not a > statement. s/statement/operator/ -- http://mail.python.org/mailman/listinfo/python-list

Reading XST file

2006-05-02 Thread Thomas Thomas
Hi All,   I need extract the content of an XST file to dictionary object..     below is content of that file from work centre XST   [description XRX_DSCRPT_METADATA] field_0{ string MetaDataFieldName

Re: Strange result with math.atan2()

2006-05-02 Thread Tim Peters
[Vedran Furač] > I think that this results must be the same: > > In [3]: math.atan2(-0.0,-1) > Out[3]: -3.1415926535897931 Whether -0.0 and 0.0 are different floats internally depends on your hardware floating-point; on most machines today, they are different floats, but _compare_ equal to each ot

Newbie question on code vetting

2006-05-02 Thread william.boquist
Hi. I have visited the Python web site and read some information on who the commiters are and how to go about submitting code to them, but I have not been able to locate any information regarding the process for vetting the code to identify any possible IP infringement before it is committed. How

Re: assignment in if

2006-05-02 Thread Bruno Desthuilliers
Edward Elliott a écrit : > Roy Smith wrote: > (snip) >>The lack of embedded assignments leads to slightly more verbose code in >>situations like this, but on the other hand, it avoids the typical C >>disaster of writing a whole function as a one liner. > > Writing disasters in python just takes

Re: noob question: "TypeError" wrong number of args

2006-05-02 Thread Bruno Desthuilliers
Ben Finney a écrit : > Edward Elliott <[EMAIL PROTECTED]> writes: > > >>Compiler, interpreter, magic-codey-runny-thingy, whatever, at some point >>something has to translate this source code >> def method (self, a, b): something >>into a function object (or whatever you're calling the runnable c

Re: py2app, pythoncard build problems

2006-05-02 Thread James Stroud
[EMAIL PROTECTED] wrote: > Hi, > > I'm attempting to build a small app that uses pythoncard for a gui > layer. The intention is to use py2app to construct an .app bundle for > the Mac. I'm running OS 10.4 on an Intel MacBook Pro. I'm using the > default installed Python 2.3 > > The .app bundle

Re: assignment in if

2006-05-02 Thread Edward Elliott
Roy Smith wrote: > decision. In Python, assignment is not an operator with side effects like > in C or Java, but a statement. assignemnt is actually an expression in those languages, not a statement. > The lack of embedded assignments leads to slightly more verbose code in > situations like

Re: noob question: "TypeError" wrong number of args

2006-05-02 Thread Edward Elliott
Ben Finney wrote: > So the tradeoff you propose is: > > - Honour "explicit is better than implicit", but users are confused > over "why do I need to declare the instance in the method > signature?" > > against > > - Break "explicit is better than implicit", take away some of the >

Re: recognize a drive as removable media (e.g. compact flash, sd card or usb drive)

2006-05-02 Thread Gordon Rainsford
Tim Golden <[EMAIL PROTECTED]> wrote: > Mike Joyce wrote: > > I am trying to write a portable script that will find removable media, > > such as compact flash, sd card, usb, etc. drive and then upload files > > from the media. I want this to be portable so that I can write and > > maintain one pro

Re: 345 free programming books

2006-05-02 Thread Tim
Thanks for notification... I am still working on to find new books.. Timetime...so little time -- http://mail.python.org/mailman/listinfo/python-list

Re: noob question: "TypeError" wrong number of args

2006-05-02 Thread Edward Elliott
Ben Finney wrote: > So now you're proposing that this be a special case when a function is > declared by that particular syntax, and it should be different to when > a function is created outside the class definition and added as a > method to the object at run-time. > > Thus breaking not only "ex

Re: noob question: "TypeError" wrong number of args

2006-05-02 Thread Bruno Desthuilliers
Edward Elliott a écrit : > Bruno Desthuilliers wrote: > >>Edward, I know I told you so at least three times, but really, >>seriously, do *yourself* a favor : take time to read about descriptors >>and metaclasses - and if possible to experiment a bit - so you can get a >>better understanding of Pyt

Binary File Reading : Metastock

2006-05-02 Thread Jack
Hi I am having a little trouble trying to read a binary file, I would like to write an ascii to Metastock converter in python but am not having a lot of success. The file formats are http://sf.gds.tuwien.ac.at/00-pdf/m/mstockfl/MetaStock.pdf If any one can point me in the right direction it wo

detect video length in seconds

2006-05-02 Thread [EMAIL PROTECTED]
Is there a way to get the length of a video clip (divix/xvid) in seconds? oh this is on linux. I first tryed to see if mplayer would tell me then I could wrap the call in a popen object and be done but it does not appear to output the length. Now I am looking at pymedia .It would be nice if there w

Re: assignment in if

2006-05-02 Thread Ben Caradoc-Davies
Gary Wessle wrote: > is there a way to make an assignment in the condition of "if" No. > nx = re.compile('regex') > if x = nx.search(text): >funCall(text, x)) Use: nx = re.compile('regex') x = nx.search(text) if x: funCall(text, x) -- Ben Caradoc-Davies <[EMAIL PROTECTED]> http://win

Re: noob question: "TypeError" wrong number of args

2006-05-02 Thread Ben Finney
Edward Elliott <[EMAIL PROTECTED]> writes: > Compiler, interpreter, magic-codey-runny-thingy, whatever, at some point > something has to translate this source code > def method (self, a, b): something > into a function object (or whatever you're calling the runnable code this > week). Call this

Re: assignment in if

2006-05-02 Thread Bruno Desthuilliers
Gary Wessle a écrit : > Hi > > is there a way to make an assignment in the condition of "if" and use > it later No. >, e.g. > > nx = re.compile('regex') > if nx.search(text): >funCall(text, nx.search(text)) > > nx.search(text) is evaluated twice, I was hoping for something like > > nx = r

Re: assignment in if

2006-05-02 Thread Roy Smith
In article <[EMAIL PROTECTED]>, Gary Wessle <[EMAIL PROTECTED]> wrote: > Hi > > is there a way to make an assignment in the condition of "if" and use > it later, e.g. > > nx = re.compile('regex') > if nx.search(text): >funCall(text, nx.search(text)) > > nx.search(text) is evaluated twice,

Re: noob question: "TypeError" wrong number of args

2006-05-02 Thread Ben Finney
Edward Elliott <[EMAIL PROTECTED]> writes: > bruno at modulix wrote: > > class MyObj(object): > > def __init__(self, name): > > self.name = name > > class MyObj(object): > def __init__(name): > self.name = name So the tradeoff you propose is: - Honour "explicit is better than impl

Can subprocess point to file descriptor 5?

2006-05-02 Thread Steve Quezadas
Hello, I tried posting this to the web forums without much luck. I have some simple subprocess code here: output = subprocess.Popen([/usr/bin/program"], stdout=subprocess.PIPE).communicate()[0] However, /usr/bin/prgram also outputs not only to stdout and stderr but to file descriptor [5]. Can I

assignment in if

2006-05-02 Thread Gary Wessle
Hi is there a way to make an assignment in the condition of "if" and use it later, e.g. nx = re.compile('regex') if nx.search(text): funCall(text, nx.search(text)) nx.search(text) is evaluated twice, I was hoping for something like nx = re.compile('regex') if x = nx.search(text): funCall(

Re: noob question: "TypeError" wrong number of args

2006-05-02 Thread Edward Elliott
Bruno Desthuilliers wrote: > Edward, I know I told you so at least three times, but really, > seriously, do *yourself* a favor : take time to read about descriptors > and metaclasses - and if possible to experiment a bit - so you can get a > better understanding of Python's object model. Then I'll

Re: search file for tabs

2006-05-02 Thread BartlebyScrivener
>> Patient: "Doctor! It hurts when I press here." >> Doctor: "Well don't press there" I told the doctor I broke my leg in two places. He told me to quit going to those places. --Henny Youngman rpd -- http://mail.python.org/mailman/listinfo/python-list

Re: simultaneous assignment

2006-05-02 Thread Bruno Desthuilliers
Heiko Wundram a écrit : (snip) > If you're looking for things to code in Python, I'd rather suggest you look > at > number theory than at logic problems. > > Basically, every logic problem can be > solved by exhaustive search (which is always the same algorithm), whereas a > number theory pro

Re: string.find first before location

2006-05-02 Thread Gary Wessle
"Serge Orlov" <[EMAIL PROTECTED]> writes: > Peter Otten wrote: > > Gary Wessle wrote: > > > > >> These days str methods are preferred over the string module's functions. > > >> > > >> >>> text = "abc abc and Here and there" > > >> >>> here_pos = text.find("Here") > > >> >>> text.rfind("abc", 0, he

Re: search file for tabs

2006-05-02 Thread Bruno Desthuilliers
Tim Chase a écrit : (snip) > If you were using strip() to get rid of the newlines, you can easily > enough do that with > > text = text[:-1] Which is a very bad idea IMHO. > Or, depending on what your needs are, rstrip() may do the trick for you. ... eventually with it's optional param: t

Re: xml-rpc and 64-bit ints?

2006-05-02 Thread Martin v. Löwis
Mark Harrison wrote: > I've got an API that deals with 64 bit int values. Is there > any way of handling this smoothly? Right now I'm casting > the values into and out of strings for the API. In XML-RPC, everything is transmitted as a string, so I don't think that choice is really that bad - exc

Re: simultaneous assignment

2006-05-02 Thread Bruno Desthuilliers
John Salerno a écrit : > bruno at modulix wrote: > >> Now if I may ask: what is your actual problem ? > > > Ok, since you're so curious. :) Sorry !-) > Here's a scan of the page from the puzzle book: > http://johnjsalerno.com/spies.png > > Basically I'm reading this book to give me little thi

Re: search file for tabs

2006-05-02 Thread beliavsky
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > The following code to search a file for tabs does not work, at least on > > Windows XP. Could someone please tell me what's wrong? Thanks. > > > > xfile = "file_with_tabs.txt" > > for text in open(xfile,"r"): > > text = text.strip() > >

Re: noob question: "TypeError" wrong number of args

2006-05-02 Thread Bruno Desthuilliers
Edward Elliott a écrit : > bruno at modulix wrote: > (snip) > >>You skipped the interesting part, so I repost it and ask again: how >>could the following code work without the instance being an explicit >>parameter of the function to be used as a method ? >> >>def someFunc(obj): >> try: >>pr

Re: ConfigParser and multiple option names

2006-05-02 Thread alisonken1
Benji York wrote: > > I generally do this: > > dirs = > /home/florian > /home/john > /home/whoever > > ...and then use str.split() in my program. > -- > Benji York The only problem with this would be if you plan on updating the config file later in the program - I don't think Con

Re: search file for tabs

2006-05-02 Thread Tim Chase
> The following code to search a file for tabs does not > work, at least on Windows XP. Could someone please tell > me what's wrong? Thanks. > > xfile = "file_with_tabs.txt" > for text in open(xfile,"r"): > text = text.strip() > if ("\t" in text): > print text Well, are the tabs e

Re: search file for tabs

2006-05-02 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > The following code to search a file for tabs does not work, at least on > Windows XP. Could someone please tell me what's wrong? Thanks. > > xfile = "file_with_tabs.txt" > for text in open(xfile,"r"): > text = text.strip() > if ("\t" in text): > print tex

Re: ConfigParser and multiple option names

2006-05-02 Thread Benji York
Florian Lindner wrote: > since ConfigParser does not seem to support multiple times the same option > name, like: > > dir="/home/florian" > dir="/home/john" > dir="/home/whoever" I generally do this: dirs = /home/florian /home/john /home/whoever ...and then use str.split() in my

Re: Wake on LAN and Shutdown for Windows and Linux

2006-05-02 Thread Carl J. Van Arsdall
Heiko Wundram wrote: > Am Dienstag 02 Mai 2006 21:02 schrieb [EMAIL PROTECTED]: > >> Also, How can I shutdown other Linux terminals from my Main (Linux) ? >> > > Has this got anything to do with Python? > > I could actually see that as a useful python function if i was writing some type

search file for tabs

2006-05-02 Thread beliavsky
The following code to search a file for tabs does not work, at least on Windows XP. Could someone please tell me what's wrong? Thanks. xfile = "file_with_tabs.txt" for text in open(xfile,"r"): text = text.strip() if ("\t" in text): print text -- http://mail.python.org/mailman/lis

Re: Wake on LAN and Shutdown for Windows and Linux

2006-05-02 Thread Heiko Wundram
Am Dienstag 02 Mai 2006 21:02 schrieb [EMAIL PROTECTED]: > Also, How can I shutdown other Linux terminals from my Main (Linux) ? Has this got anything to do with Python? --- Heiko. -- http://mail.python.org/mailman/listinfo/python-list

Re: ConfigParser and multiple option names

2006-05-02 Thread alisonken1
Florian Lindner wrote: > Hello, > since ConfigParser does not seem to support multiple times the same option > name, like: > > dir="/home/florian" > dir="/home/john" > dir="/home/whoever" Another option would be to switch to the XMLParser library and use an XML file for the configuration. That w

Re: SGML parsing tags and leeping track

2006-05-02 Thread Heiko Wundram
Am Dienstag 02 Mai 2006 20:38 schrieb [EMAIL PROTECTED]: > could i make a global variable and keep track of each tag count? > > Also how would i make a list or dictionary of tags that is found? > how can i handle any tag that is given? The following snippet does what you want: >>> from sgmllib im

Re: SGML parsing tags and leeping track

2006-05-02 Thread Heiko Wundram
Am Dienstag 02 Mai 2006 20:38 schrieb [EMAIL PROTECTED]: > could i make a global variable and keep track of each tag count? > > Also how would i make a list or dictionary of tags that is found? > how can i handle any tag that is given? The following snippet does what you want: >>> from sgmllib im

Dispatching operations to user-defined methods

2006-05-02 Thread Hallvard B Furuseth
I'm wondering how to design this: An API to let a request/response LDAP server be configured so a user-defined Python module can handle and/or modify some or all incoming operations, and later the outgoing responses (which are generated by the server). Operations have some common elements, and so

Re: data regex match

2006-05-02 Thread Heiko Wundram
Am Dienstag 02 Mai 2006 23:34 schrieb Fredrik Lundh: > Heiko Wundram wrote: > > As always, use a raw string for regular expressions. \d is being > > interpreted to mean an ascii character, and not to mean the character > > class you're trying to reference here. > > \d isn't an ASCII character, but

Re: urllib2 not support proxy on SSL connection?

2006-05-02 Thread Heiko Wundram
Am Dienstag 02 Mai 2006 23:22 schrieb itay_k: > Is it possible that urllib2 doesnt support for proxy over https > connections? Are you sure this a proxy which is accessed by https, or rather a proxy that supports CONNECT, and thus allows you to access https-sites? I'd guess the latter, which I h

Re: data regex match

2006-05-02 Thread Fredrik Lundh
Heiko Wundram wrote: > As always, use a raw string for regular expressions. \d is being interpreted > to mean an ascii character, and not to mean the character class you're trying > to reference here. \d isn't an ASCII character, but \1 is. >>> print '(\d{2})/\1/\1\1' (\d{2})/?/?? -- http:

Re: data regex match

2006-05-02 Thread Heiko Wundram
Am Dienstag 02 Mai 2006 23:23 schrieb Fredrik Lundh: > Gary Wessle wrote: > > regular expression match: what went wrong? > (insert obligatory jwz quote here) QOTW! :-D --- Heiko. -- http://mail.python.org/mailman/listinfo/python-list

Re: data regex match

2006-05-02 Thread Rene Pijlman
Gary Wessle: >tx = "now 04/30/2006 then" >data = re.compile('(\d{2})/\1/\1\1', re.IGNORECASE) >d = data.search(tx) >print d > >Nono >I was expecting 04/30/2006 You should expect: NameError: name 're' is not defined > what went wrong? \1 matches the content of the first group, which is '04'. It d

Re: data regex match

2006-05-02 Thread Heiko Wundram
Am Dienstag 02 Mai 2006 23:06 schrieb Gary Wessle: > Hi > > I am having an issue with this match > > tx = "now 04/30/2006 then" > data = re.compile('(\d{2})/\1/\1\1', re.IGNORECASE) As always, use a raw string for regular expressions. \d is being interpreted to mean an ascii character, and not to

clearerr called on NULL FILE* ?

2006-05-02 Thread Chad Austin
Hi all, My first post to the list. :) I'm debugging one of our application crashes, and I thought maybe one of you has seen something similar before. Our application is mostly Python, with some work being done in a native C++ module. Anyway, I'm getting a memory access violation at the fol

urllib2 not support proxy on SSL connection?

2006-05-02 Thread itay_k
Hi, I am running the following simple code (just open connection to some https page with proxy): proxy= '666.179.227.666:80' proxy=urllib2.ProxyHandler({"https":'https://'+proxy}) opener = urllib2.build_opener(proxy) request = urllib2.Request('https://somehttpspage') response = opener.open(re

Re: data regex match

2006-05-02 Thread Fredrik Lundh
Gary Wessle wrote: > I am having an issue with this match > > tx = "now 04/30/2006 then" > data = re.compile('(\d{2})/\1/\1\1', re.IGNORECASE) > d = data.search(tx) > print d > > Nono > I was expecting 04/30/2006 really? your pattern matches two digits, followed by a slash, followed by a byte wi

Re: simultaneous assignment

2006-05-02 Thread Heiko Wundram
Am Dienstag 02 Mai 2006 22:47 schrieb Gary Duzan: > >Here's a scan of the page from the puzzle book: > >http://johnjsalerno.com/spies.png > > > >Basically I'm reading this book to give me little things to try out in > >Python. There's no guarantee that this puzzle is even conducive to (or > >worthy

Re: What is wrong with the Python home page?

2006-05-02 Thread Chris Lambacher
Works for me with FireFox 1.5.2, but I am on WinXP at the moment. -Chris On Tue, May 02, 2006 at 01:43:58PM -0700, fuzzylollipop wrote: > I am using FireFox 1.5.2 on OS X 10.4.6 and the www.python.org ends up > being only text with just the nasa picture with the guy in the space > suit. > > It lo

Re: simultaneous assignment

2006-05-02 Thread Grant Edwards
On 2006-05-02, Boris Borcic <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> On 2006-05-02, Boris Borcic <[EMAIL PROTECTED]> wrote: >>> Grant Edwards wrote: Python knows how to count. :) def countFalse(seq): return len([v for v in seq if not v]) def countTrue(

Re: Possible constant assignment operators ":=" and "::=" for Python

2006-05-02 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Hi Pythonians, > > To begin with I'd like to apologize that I am not very experienced > Python programmer so please forgive me if the following text does not > make any sense. > > I have been missing constants in Python language. Why so ? I guess you're talking ab

data regex match

2006-05-02 Thread Gary Wessle
Hi I am having an issue with this match tx = "now 04/30/2006 then" data = re.compile('(\d{2})/\1/\1\1', re.IGNORECASE) d = data.search(tx) print d Nono I was expecting 04/30/2006, what went wrong? thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: simultaneous assignment

2006-05-02 Thread Gary Duzan
In article <[EMAIL PROTECTED]>, John Salerno <[EMAIL PROTECTED]> wrote: >bruno at modulix wrote: > >> Now if I may ask: what is your actual problem ? > >Ok, since you're so curious. :) > >Here's a scan of the page from the puzzle book: >http://johnjsalerno.com/spies.png > >Basically I'm reading th

Re: An Atlas of Graphs with Python

2006-05-02 Thread Harry George
"Paddy" <[EMAIL PROTECTED]> writes: > A little off topic I'm afraid Giandomenico, > But I had to smile. Here is someone working in the field of > linguistics, who wants a programming solution, in the language Python. > (It's Larry Wall, creator of Perl that cites his linguistic > foundations). >

Re: simultaneous assignment

2006-05-02 Thread Edward Elliott
Heiko Wundram wrote: > Integer and string objects > are immutable in Python, so why'd you want to have different IDs for an > object of the same value? It's the value you're working with in a program, > not the objects ID. At least it should be, if you're truly intent on > working with the (pseudo-

Re: stripping blanks

2006-05-02 Thread Edward Elliott
Scott David Daniels wrote: > A little better: > > f = open("test.dat") > for line in f: > printLine = line.rstrip("\n") > if printLine: > print printLine [sys.stdout.write(line) for line in open('test.dat') if line.rstrip('\n')] Where's my prize? What do

Re: simultaneous assignment

2006-05-02 Thread Heiko Wundram
Am Dienstag 02 Mai 2006 22:39 schrieb Edward Elliott: > Which raises an interesting parallel question: is there a way to clone an > arbitrary object? Yes, check the copy module. copy.copy() does a shallow copy of the parameter, copy.deepcopy() a deep copy of the parameter. For the difference be

What is wrong with the Python home page?

2006-05-02 Thread fuzzylollipop
I am using FireFox 1.5.2 on OS X 10.4.6 and the www.python.org ends up being only text with just the nasa picture with the guy in the space suit. It looks like the CSS is hosed or something. And trying to go to the module docs for the current release is broken as well -- http://mail.python.org/

Re: simultaneous assignment

2006-05-02 Thread Edward Elliott
bruno at modulix wrote: > re-phrase it according to how Python works, and you'll get the answer: > > "Is there a way to bind multiple names to the same object, but so the > identity of this object is different from the identity of this object ?" Which raises an interesting parallel question: is

Re: simultaneous assignment

2006-05-02 Thread Serge Orlov
John Salerno wrote: > bruno at modulix wrote: > > > Now if I may ask: what is your actual problem ? > > Ok, since you're so curious. :) > > Here's a scan of the page from the puzzle book: > http://johnjsalerno.com/spies.png > > Basically I'm reading this book to give me little things to try out in

Re: Python & SSL

2006-05-02 Thread James Stroud
Benji York wrote: > James Stroud wrote: > >> I have been trying to make an https client with python > > > You probably don't want to use the standard library for HTTPS; here's a > quote from the socket module docs about SSL: > > Warning: This does not do any certificate verification! > >

[SPOILER] Re: simultaneous assignment

2006-05-02 Thread Boris Borcic
John Salerno wrote: > bruno at modulix wrote: > >> Now if I may ask: what is your actual problem ? > > Ok, since you're so curious. :) > > Here's a scan of the page from the puzzle book: > http://johnjsalerno.com/spies.png > > Basically I'm reading this book to give me little things to try out

Re: unable to resize mmap object

2006-05-02 Thread Carl Banks
Fabiano Sidler wrote: > Hi folks! > > I created an mmap object like so: > --- snip --- > from mmap import mmap,MAP_ANONYMOUS,MAP_PRIVATE > fl = file('/dev/zero','rw') > mm = mmap(fl.fileno(), 1, MAP_PRIVATE|MAP_ANONYMOUS) > --- snap --- > > Now, when I try to resize mm to 10 byte > --- snip --- > m

  1   2   3   >