Re: python-list@python.org

2006-01-31 Thread Terry Hancock
On Tue, 31 Jan 2006 21:02:48 -0800 RayS <[EMAIL PROTECTED]> wrote: > Yes, I had seen it, and it looks well developed - but - it > _requires_ Windows COM. (I do use Win32 and ctypes for > talking to interface cards and such, that I actually get > paid for) but even the company I do it for is migr

python-list@python.org

2006-01-31 Thread RayS
Hi Alan, At 04:25 PM 1/31/2006, you wrote: >IIUC, ASCOM is a set of Windows COM objects which provides a >standardised API for controlling telescopes. Since it uses Windows >COM, you should be able to control it easily from python using the >excellent win32 extensions. Yes, I had seen it, and

Re: dynamic class instantiation

2006-01-31 Thread Volker Grabsch
Ognen Duzlevski wrote: > Kent Johnson <[EMAIL PROTECTED]> wrote: >> Ognen Duzlevski wrote: >> > Say I got "page" as a string. How do I go about >> > instantiating a class from this piece of information? To make it >> > more obvious how do I create the page() class based on the "page" >> > string

Re: Mouse manipulation

2006-01-31 Thread arkestra
I posted too soon. I installed win32all and the missing dll for 4.2 win32api.SetCursorPos((1,2)) does it! Thanks for the help. -- http://mail.python.org/mailman/listinfo/python-list

Re: Mouse manipulation

2006-01-31 Thread arkestra
I have found something that is similar to what I was looking for -->the SendKeys module. But what I am realy looking for is the same thing, but for the mouse :) Thanks again. -- http://mail.python.org/mailman/listinfo/python-list

IPy module

2006-01-31 Thread yawgmoth7
I was discussing this in another email, sadly I have misplaced the email. I got the module IPy, and I am taking a variable from the user(An IP) and doing something like this: startip = raw_input("Enter start IP: ") ip = IPy.IP(startip\255) for x in ip(): Well, this doesn't work(I knew it woul

Re: binascii in C++

2006-01-31 Thread [EMAIL PROTECTED]
Jeremy wrote: > I'm working on a project to create a keyfinder program that finds the > Windows CD Key in the registry and decodes it. I prototyped it in > Python and it worked great but for several reasons I've decided to > rewrite it in C++. I use the module binascii extensively in the Python

binascii in C++

2006-01-31 Thread Jeremy
I'm working on a project to create a keyfinder program that finds the Windows CD Key in the registry and decodes it. I prototyped it in Python and it worked great but for several reasons I've decided to rewrite it in C++. I use the module binascii extensively in the Python version but I can't

Re: path to python in WinXP

2006-01-31 Thread BartlebyScrivener
tim> For a more persistant solution, go to your system tim> properties and dig around for the "Environment variables" tim> button. I've got Win2k here, not XP, so I don't know the tim> exact sequence, but here it is on Win2k Sequence on XP is Start | Control Panel | System | Advanced | Environmen

Re: how to parse structured text file?

2006-01-31 Thread John McMonagle
> I have a file which contains data in the format shown in the sample > bellow. > How can I parse it to get following: > (14,trigger,guard,do_action,15) > > Thanks a lot for your postings > Petr Jakes > > type: > 4 > bgrColor: > 255 255 255 > fgrColor: > 0 0 0 > objId: > 16 > Num.Pts: > 2 > 177

Re: how to parse structured text file?

2006-01-31 Thread Paul McGuire
A problem fit for pyparsing! Download pyparsing at http://pyparsing.sourceforge.net. Assuming you always have these fields, in this order, this program will figure them out. If not, you'll need to tweak the pyparsing definitions as needed. -- Paul data = """type: 4 bgrColor: 255 255 255 fgrCo

Re: instance references?

2006-01-31 Thread Scott David Daniels
Scott David Daniels wrote: > Alex Martelli wrote: (in effect) >>aptbase.drawables = weakref.WeakValueDictionary() >> then in each __init__ >>aptbase.drawables[len(aptbase.drawables)] = self >> then in show: >>for o in aptbase.drawables.values(): >># render it > > The keys you a

Re: how to parse structured text file?

2006-01-31 Thread Petr Jakes
Sorry I was not precise enough in my description. In the file, there is of course more sections starting with the keyword type: I would like to only analyze sections which start with the sequence: type: 4 Petr jakes -- http://mail.python.org/mailman/listinfo/python-list

how to parse structured text file?

2006-01-31 Thread Petr Jakes
I have a file which contains data in the format shown in the sample bellow. How can I parse it to get following: (14,trigger,guard,do_action,15) Thanks a lot for your postings Petr Jakes type: 4 bgrColor: 255 255 255 fgrColor: 0 0 0 objId: 16 Num.Pts: 2 177 104 350 134 objStartId: 14 objEndId: 15

Re: test whether 2 objects are equal

2006-01-31 Thread Bruno Desthuilliers
Yves Glodt a écrit : > bruno at modulix wrote: > >> Yves Glodt wrote: >> (snip) >>> #!/usr/bin/python >>> >>> class Test: >>> var1 = '' >>> var2 = '' >> >> >> Take care, this creates two *class* variables var1 and var2. For >> *instance* variables, you want: > > > Thanks for making me a

Re: VB to Python migration

2006-01-31 Thread Josh
Magnus Lycka wrote: > I suppose that you need to present a lot of differnt kinds of data, > and that you need to provide various search parameters etc for > different data sets, but this sounds like something that might be > very few screens that adapt to some kind of meta-data, perhaps XML > des

Re: import datetime

2006-01-31 Thread Lee Harr
> I have just installed Python2.4.2 on our HP-UX system. But when I try > to import datetime modlue I get the following error > > ~~~ from datetime import datetime > Traceback (most recent call last): > File "", line 1, in ? > ImportError: No module named datetime > ~

ANN: pynakotheka v1.0.1

2006-01-31 Thread Iñigo Serna
Hello out there, I'm really pleased to announce the second public release of Pynakotheka. Pynakotheka is a simple GPL-licensed python script which generates static HTML photo albums to be added to web sites or to be burnt in CDs. It includes some templates and it's easy to create more. It depend

Re: Python module for LX200 telescope command set

2006-01-31 Thread Alan Kennedy
[RayS] > I've begun a Python module to provide a complete interface to the Meade > LX200 command set: and > History: after searching for such a thing, I had found only: > http://72.14.203.104/search?q=cache:hOgO7H_MUeYJ:phl3pc02.phytch.dur.ac.uk/~jrl/source/source_code.html+lx200.py&hl=en&gl=us&

Re: Question about idioms for clearing a list

2006-01-31 Thread bearophileHUGS
Diez B. Roggisch: > The reason is that l = [] just rebinds a new object (a list, but it could be > anything) to a name, while l[:] = [] will alter the object _referred_ to by > l. That is a HUGE difference! In my programs I have seen that there is another practical difference between version 1 and

Re: Why checksum? [was Re: Fuzzy Lookups]

2006-01-31 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > This isn't a criticism, it is a genuine question. Why do people compare > local files with MD5 instead of doing a byte-to-byte compare? Is it purely > a caching thing (once you have the checksum, you don't need to read the > file again)? Are there any o

Why checksum? [was Re: Fuzzy Lookups]

2006-01-31 Thread Steven D'Aprano
On Tue, 31 Jan 2006 10:51:44 -0500, Gregory Piñero wrote: > http://www.blendedtechnologies.com/removing-duplicate-mp3s-with-python-a-naive-yet-fuzzy-approach/60 > > If anyone would be kind enough to improve it I'd love to have these > features but I'm swamped this week! > > - MD5 checking for fi

Re: Jython on the Palm OS?

2006-01-31 Thread gregarican
Khalid Zuberi wrote: > While someone has recently done some work to get Jython working with > J2ME > (reference below), I think its targetted at Pocket PC class devices (CDC spec) > as opposed to palm (CLDC as far as i know). > > http://thread.gmane.org/gmane.comp.lang.jython.devel/1826 Thanks

Re: Fuzzy Lookups

2006-01-31 Thread Gregory Piñero
I wonder which algorithm determines the similarity between two strings better? On 1/31/06, Kent Johnson <[EMAIL PROTECTED]> wrote: > Gregory Piñero wrote: > > Ok, ok, I got it! The Pythonic way is to use an existing library ;-) > > > > import difflib > > CloseMatches=difflib.get_close_matches(AFi

Re: Question about idioms for clearing a list

2006-01-31 Thread Xavier Morel
Steven Watanabe wrote: > I know that the standard idioms for clearing a list are: > > (1) mylist[:] = [] > (2) del mylist[:] > > I guess I'm not in the "slicing frame of mind", as someone put it, but > can someone explain what the difference is between these and: > > (3) mylist = [] > >

Re: Fuzzy Lookups

2006-01-31 Thread Kent Johnson
Gregory Piñero wrote: > Ok, ok, I got it! The Pythonic way is to use an existing library ;-) > > import difflib > CloseMatches=difflib.get_close_matches(AFileName,AllFiles,20,.7) > > I wrote a script to delete duplicate mp3's by filename a few years > back with this. If anyone's interested in s

Re: Python vs C for a mail server

2006-01-31 Thread Randall Parker
But languages that share some weakness typically do not share it equally. Three languages can have some way to do X (which some might find undesirable while others find it great) but two of the languages might make it easy to solve problems without ever doing X while the third language might make i

Re: Python vs C for a mail server

2006-01-31 Thread Jens Theisen
Paul wrote: > Or should I be looking for some other context here? Three people were looking at the wrong one, thanks for putting this right. I really should not have given my point that briefly. Jens -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs C for a mail server

2006-01-31 Thread Jens Theisen
Jay wrote: > You can do both, but why? *Especially* in a language like C++, where > thanks to pointers and casting, there really isn't any type safety > anyway. How much time in your C/C++ code is spent casting and trying to > trick the compiler into doing something that it thinks you shouldn't be

import datetime

2006-01-31 Thread shaboo
Hi Guys, I have just installed Python2.4.2 on our HP-UX system. But when I try to import datetime modlue I get the following error ~~~ >>> from datetime import datetime Traceback (most recent call last): File "", line 1, in ? ImportError: No module named datetime ~~~

Re: wxPython Conventions

2006-01-31 Thread [EMAIL PROTECTED]
I'm also fairly new to wxPython, but I've done GUI's in a variety of languages.I'm not sure about putting the systray - haven't had to do it. But your second question, put it in it's own class. For desktop apps I almost allways do a limited M/V/C pattern - M/VC - ok so I mung the view and con

DispatchWithEvents & PumpWaitingMessages

2006-01-31 Thread puff
I'm working on a com automation project involving IE (yes, I know about Pamie). I connect to IE through DispatchWithEvents, start a navigation, and then loop calling PumpWaitingMessages. I see the events OK and all is well. At some point it is clear that the navigation is complete (at least inso

Re: Request for suggesstions and comments

2006-01-31 Thread [EMAIL PROTECTED]
Hi, the advice is free, so tkae it for what it's worth. Q. Is it possible to write an application for this kind of server activity in Python? I mean whether Python will be suitable for this kind of high activity load, real time app? - Absolutely, Look at Zope or Cheetah for examples of fairly larg

Unicode Support for ConfigObj (config file reader) Now in SVN

2006-01-31 Thread Fuzzyman
Hello All, I've added (optional) unicode support for ConfigObj. This is now available from SVN. You can specify an encoding to decode the config file on reading. This maps to an encoding attribute on the ConfigObj instance that is also used for writing (and can be changed). You can find it in th

Re: Python vs C for a mail server

2006-01-31 Thread Jay Parlar
Randall Parker wrote: > Alex Martelli wrote: > >> The "but without declaration it can't be self-documenting" issue is a >> red herring. Reading, e.g.: >> >> int zappolop(int frep) { ... >> >> gives me no _useful_ "self-documenting" information about the role and >> meaning of frep, or zappolop's

PyGILState_Release + Python2.3 = Segmentation Fault

2006-01-31 Thread Kirill Simonov
Hi, Could someone tell me why my extension module works under Python 2.4, but fails with Segmentation Fault under Python 2.3? Here is the stripped version: #include static PyObject * test_gil(PyObject *self) { PyGILState_STATE gs; Py_BE

Re: Question about idioms for clearing a list

2006-01-31 Thread Diez B. Roggisch
Steven Watanabe wrote: > I know that the standard idioms for clearing a list are: > > (1) mylist[:] = [] > (2) del mylist[:] > > I guess I'm not in the "slicing frame of mind", as someone put it, but > can someone explain what the difference is between these and: > > (3) mylist = [] > >

Re: Python vs C for a mail server

2006-01-31 Thread Peter Hansen
Randall Parker wrote: > The point of doing compile time and test time checking is the same > reason militaries use layered defenses: More problems get caught. I've > written tons of software tests and architected a testing system for an > entire aircraft. I've also watched lots of errors get by tes

Re: finding the intersection of a list of Sets

2006-01-31 Thread Raymond Hettinger
That should have been: >>> sets.sort(key=len) >>> reduce(set.intersection, sets) The only refinement was the pre-sort based on set length. -- http://mail.python.org/mailman/listinfo/python-list

Re: StringIO proposal: add __iadd__

2006-01-31 Thread Raymond Hettinger
[Raymond Hettinger] > > The StringIO API needs to closely mirror the file object API. > > Do you want to change everything that is filelike to have += > > as a synonym for write()? [Paul Rubin] > Why would they need that? Polymorphism > StringIO objects have getvalue() but other > file-like obje

Re: Python vs C for a mail server

2006-01-31 Thread Randall Parker
Jay, The point of doing compile time and test time checking is the same reason militaries use layered defenses: More problems get caught. I've written tons of software tests and architected a testing system for an entire aircraft. I've also watched lots of errors get by tests. Also, compile time

Re: templates

2006-01-31 Thread thakadu
I haven't got around to trying HTMLTemplate yet but it is on my list of things to do. It would be great to see how it compares in perfomance and simplicity to PyMeld and other DOM approaches. -- http://mail.python.org/mailman/listinfo/python-list

Re: path to python in WinXP

2006-01-31 Thread Tim Chase
> I have a real newbie question here. Well, as a starter, it would be helpful if you included a Subject: line in your mail...my spam filters flagged it and I almost tossed it in my bit-bucket because the subject was empty. :*) > On WinXP I open a command line and type 'python' and get 'PYTHON'

Re: Question about idioms for clearing a list

2006-01-31 Thread Tim Chase
> I know that the standard idioms for clearing a list are: > > (1) mylist[:] = [] > (2) del mylist[:] > > I guess I'm not in the "slicing frame of mind", as someone put it, but > can someone explain what the difference is between these and: > > (3) mylist = [] > > Why are (1) and (2) pre

psycopg2

2006-01-31 Thread Jane Goldman
Hello, I bigginer Python programmer. I am working on web application that access PostgreSQL on backend. After I imported PSYCOPG2 module in my program I started to get unwanded debug output into my web bowser. It is something like that: initpsycopg: initializing psycopg 2.0b6.2 (dec dt ext p

Re: Python vs C for a mail server

2006-01-31 Thread Randall Parker
Alex Martelli wrote: > The "but without declaration it can't be self-documenting" issue is a > red herring. Reading, e.g.: > > int zappolop(int frep) { ... > > gives me no _useful_ "self-documenting" information about the role and > meaning of frep, or zappolop's result. The code's author must o

Re: templates

2006-01-31 Thread thakadu
Yes I looked at that but I did not benchmark it. Basically it seems to convert the Meld or part of a Meld into a %s template in any case and I already knew that %s performace was very good. So if I had used PyMeld combined with %s then sure it would be much faster but I wanted to benchmark a pure P

Question about idioms for clearing a list

2006-01-31 Thread Steven Watanabe
I know that the standard idioms for clearing a list are: (1) mylist[:] = [] (2) del mylist[:] I guess I'm not in the "slicing frame of mind", as someone put it, but can someone explain what the difference is between these and: (3) mylist = [] Why are (1) and (2) preferred? I think the fi

Re: indentation messing up my tuple?

2006-01-31 Thread infidel
tuple is the name of the built-in type, so it's not a very good idea to reassign it to something else. (food + drink + '\n') is not a tuple, (food + drink + '\n',) is There's no reason to use tuples here, just do this: data.append(food + drink) f.write('\n'.join(data)) -- http://mail.python.or

[no subject]

2006-01-31 Thread Thomas McGrath III
Hello, I have a real newbie question here. New to Python, and am trying to learn it on Mac and WinXP. On the Mac I find Python already installed and I downloaded the package. I tested the version in Terminal by typing 'python' and get Python 2.3.5 (#1, Mar 20 2005, 20:38:20). - Looks fine

Re: determinant

2006-01-31 Thread Raymond Hettinger
[Tuvas] > I am trying to find a nice function that quickly determines the > determanant in python. Anyone have any recommendations? I've heard > about numpy, but I can't get it to work (It doesn't seem to like the > import Matrix statement...). Thanks! http://aspn.activestate.com/ASPN/Cookbook/Pyt

Re: templates

2006-01-31 Thread has
thakadu wrote: > I did not try PyMeldLite because the HTML I am using is exactlty that: > HTML and not XHTML. FWIW, HTMLTemplate is pretty lax and not restricted to XHTML. The only XML-ish requirement is that elements need to be properly closed if they're to be used as template nodes, e.g. ... and

Re: Mail Delivery (failure [EMAIL PROTECTED])

2006-01-31 Thread info
Hemos recibido su correo, en breve nos pondremos en contacto con ustedes. -- http://mail.python.org/mailman/listinfo/python-list

Re: finding the intersection of a list of Sets

2006-01-31 Thread Raymond Hettinger
[Peter Otten] > >>> sets = map(set, "abc bcd cde".split()) > >>> reduce(set.intersection, sets) > set(['c']) Very nice. Here's a refinement: >>> sets.sort(key=len) >>> reduce(set.intersection, sets[1:], sets[0]) set(['c']) -- http://mail.python.org/mailman/listinfo/python-list

Re: templates

2006-01-31 Thread Richie Hindle
[thakadu] > The method of generation the table rows was exactly the same as > the example in the PyMeld documentation Did you try using toFormatString() to speed it up? See http://www.entrian.com/PyMeld/doco.html -- Richie Hindle [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/py

Re: Fuzzy Lookups

2006-01-31 Thread Gregory Piñero
> Thanks for that, I'll have a look. (So many packages, so little > time...) Yes, there's a standard library for everything it seems! Except for a MySQL api :-( > > I wrote a script to delete duplicate mp3's by filename a few years > > back with this. If anyone's interested in seeing it, I'll p

Re: simple perl program in python gives errors

2006-01-31 Thread Dan Lowe
On Jan 31, 2006, at 8:28 AM, morris carre wrote: > [EMAIL PROTECTED] a écrit : >> >> $a += 20 * 14; >> print $a; > > a = 20 * 14 > print a > > where's the problem ? Not sure if you typo'd that, but that should read: a += 20 * 14 print a -dan -- I am not a vegetarian

Re: Omniorb event channel question

2006-01-31 Thread Diez B. Roggisch
> channel = orb.getRootInterface(channelname) > chadmin = channel.for_consumers() > supplier = chadmin.obtain_push_supplier() > listener = EventListener() > supplier.connect_push_consumer(listener) Not sure, but I guess you want a listener._this() here. Diez -- http://mail.python.org/mailman/

Re: templates

2006-01-31 Thread thakadu
I would like to give a few more specifics about my "benchmarking". The web page had about 10 simple fields and a table of roughly 30 table rows. The method of generation the table rows was exactly the same as the example in the PyMeld documentation ie you create the Meld, you make a copy of a prot

Re: File permissions script vs shell

2006-01-31 Thread jdlists
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > I'm running python on windows and have a program that watches a > > directory and acts on files as they come into the directory. After > > processing is complete, i delete the file, or in this case attempt > > to > > > > In the script versi

Omniorb event channel question

2006-01-31 Thread Attila Rajmund Nohl
Hello! I'm using python 2.3.5 on Linux with omniORB 2.6. I'm trying to create an object that shall listen on an event channel, but the registration doesn't work. My code is: class EventListener(CosEventComm.PushConsumer): def __init__(self): pass def push(self, data): pr

Re: test whether 2 objects are equal

2006-01-31 Thread Yves Glodt
bruno at modulix wrote: > Yves Glodt wrote: >> Hello, >> >> >> I need to compare 2 instances of objects to see whether they are equal >> or not, but with the code down it does not work (it outputs "not equal") >> >> >> #!/usr/bin/python >> >> class Test: >> var1 = '' >> var2 = '' > > Take

Re: about spawn flag

2006-01-31 Thread Fredrik Lundh
Sinan Nalkaya wrote: > thank you but also i need a pid.also react like an os.P_NOWAIT. > if i summarize, > child proccess immediately returns the pid, if child exits also > returns the exit/error code :) import subprocess http://docs.python.org/lib/module-subprocess.html -- http:/

Re: about spawn flag

2006-01-31 Thread Sinan Nalkaya
thank you but also i need a pid.also react like an os.P_NOWAIT. if i summarize, child proccess immediately returns the pid, if child exits also returns the exit/error code :) -- http://mail.python.org/mailman/listinfo/python-list

Re: determinant

2006-01-31 Thread Tuvas
Never mind, I realized I was using a bit of code way too old. I just needed to change the import statements to: import numpy.matrix import numpy.linalg Thanks for the help! -- http://mail.python.org/mailman/listinfo/python-list

Re: test whether 2 objects are equal

2006-01-31 Thread bruno at modulix
Yves Glodt wrote: > Hello, > > > I need to compare 2 instances of objects to see whether they are equal > or not, but with the code down it does not work (it outputs "not equal") > > > #!/usr/bin/python > > class Test: > var1 = '' > var2 = '' Take care, this creates two *class* variab

Re: determinant

2006-01-31 Thread Tuvas
I am using Windows, using Python 2.4. Perhaps I just did the import statement wrong? I've never installed a library in Windows before, perhaps I did something wrong there too.. But anyways, it just doesn't seem to work. The import statements were: import Matrix, LinearAlgebra Neither seem to work

Re: triple quoted strings as comments

2006-01-31 Thread Jeffrey Schwab
Steve Holden wrote: > dmh2000 wrote: > >> I recently complained elsewhere that Python doesn't have multiline >> comments. > > > Personally I think it's a win that you couldn't find anything more > serious to complain about :-) +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

Re: templates

2006-01-31 Thread has
Christoph Zwerschke wrote: > thakadu schrieb: > > I have used PyMeld (http://www.entrian.com/PyMeld/) which is one of > > very few that gives a 100% separation of code and presentation, in fact > > PyMeld is not strictly speaking a template system at all. > > Yes, it is more like XIST that I menti

Re: quoting strings

2006-01-31 Thread Fredrik Lundh
Michal Duda wrote: > is any equivalent to perl "quotemeta" function in python? s = re.escape(s) > I know that I can use this on string: r'\\test' > but I need to do this on the variable your example is a string literal, which isn't really the same thing as a RE pattern in Python. -- http

quoting strings

2006-01-31 Thread Michal Duda
Hi, is any equivalent to perl "quotemeta" function in python? I know that I can use this on string: r'\\test' but I need to do this on the variable Thanks in advance Michal -- http://mail.python.org/mailman/listinfo/python-list

Re: File permissions script vs shell

2006-01-31 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I'm running python on windows and have a program that watches a > directory and acts on files as they come into the directory. After > processing is complete, i delete the file, or in this case attempt > to > > In the script version I repeatedly get OSError exceptio

Re: Help with XML-SAX program ... it's driving me nuts ...

2006-01-31 Thread mitsura
Thanks for the feedback! I will certainly look at the elementtree stuff (I am new to Python so I still need to find my way around) -- http://mail.python.org/mailman/listinfo/python-list

Re: simple perl program in python gives errors

2006-01-31 Thread morris carre
[EMAIL PROTECTED] a écrit : > I am a little annoyed at why such a simple program in Perl is causing > so much difficulty for python, i.e: > > $a += 20 * 14; > > print $a; > a = 20 * 14 print a where's the problem ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Costly object creation (was : Having Trouble with Scoping Rules)

2006-01-31 Thread Charles Krug
On 2006-01-31, bruno at modulix <[EMAIL PROTECTED]> wrote: > See other answers in this thread for how to solve the UnboundLocalError > problem. > > Now about your *real* problem - which is nothing new -, you may want to > read about some known solutions: > > http://en.wikipedia.org/wiki/Singleton_p

File permissions script vs shell

2006-01-31 Thread jdlists
I'm running python on windows and have a program that watches a directory and acts on files as they come into the directory. After processing is complete, i delete the file, or in this case attempt to In the script version I repeatedly get OSError exceptions stating permission denied when try

Re: backreference in regexp

2006-01-31 Thread Schüle Daniel
thank you, I completely forgot that + is one of metacharacters Regards, Daniel -- http://mail.python.org/mailman/listinfo/python-list

Introspection with classes

2006-01-31 Thread Kirk McDonald
Me again! Same project as before, if you're playing along at home. The Everything Engine model (which I am blatantly copying in my project) is that everything in the engine is a 'node,' and that every node can be stored to and read from the database. Since this is the backend for a website, min

Re: Help with XML-SAX program ... it's driving me nuts ...

2006-01-31 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I need to read a simle XML file. For this I use the SAX parser. So far > so good. The XML file consist out of number of "Service" object with > each object a set of attributes. > The strange thing is that for some reason, the attributes for all the > objects are being u

Help with XML-SAX program ... it's driving me nuts ...

2006-01-31 Thread mitsura
Hi, I need to read a simle XML file. For this I use the SAX parser. So far so good. The XML file consist out of number of "Service" object with each object a set of attributes. I read through the XML file and for each "" entry I create a new service object. When I am in the "" part of the XML fil

Re: Having Trouble with Scoping Rules

2006-01-31 Thread Charles Krug
On 2006-01-31, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > def ExpensiveObject(): > global _expensiveObject > if _expensiveObject is None: > _expensiveObject = "A VERY Expensive object" > print "CREATED VERY EXPENSIVE OBJECT" > return _expensiveO

Re: backreference in regexp

2006-01-31 Thread Fredrik Lundh
Schüle Daniel wrote: > Hello @all, > > >>> p = re.compile(r"(\d+) = \1 + 0") > >>> p.search("123 = 123 + 0") > > 'search' returns None but I would expect it to > find 123 in group(1) > > Am I using something that is not supported by Python > RegExp engine or what is the problem with my regexp? pl

backreference in regexp

2006-01-31 Thread Schüle Daniel
X-Enigmail-Version: 0.76.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hello @all, >>> p = re.compile(r"(\d+) = \1 + 0") >>> p.search("123 = 123 + 0") 'search' returns None but I would expect it to find 1

Re: test whether 2 objects are equal

2006-01-31 Thread Yves Glodt
Rene Pijlman wrote: > Yves Glodt: >> I need to compare 2 instances of objects to see whether they are equal >> or not, > > This prints "equal": thank you! Have a nice day, Yves > class Test(object): > def __init__(self): > self.var1 = '' > self.var2 = '' > def __eq__(sel

Re: dynamic class instantiation

2006-01-31 Thread Ognen Duzlevski
Kent Johnson <[EMAIL PROTECTED]> wrote: > Ognen Duzlevski wrote: > > Say I got "page" as a string. How do I go about > > instantiating a class from this piece of information? To make it > > more obvious how do I create the page() class based on the "page" > > string I have? > Use getattr(). H

Re: Python vs C for a mail server

2006-01-31 Thread Antoon Pardon
Op 2006-01-30, Magnus Lycka schreef <[EMAIL PROTECTED]>: > Donn Cave wrote: >> If we give him credit for having some idea of what he's talking about, >> then we could perhaps read his "encourages" as "makes trivially easy." >> These two languages are in such different levels with introspection >> t

Re: Marked-Up Text Viewer for Python/Tkinter

2006-01-31 Thread André
James Stroud wrote: > Hello All, > > I'm wondering if there is something that already exists that can take > marked up text in some format (hopefully reStructuredText or HTML) and > can convert it into something that can be displayed with Tkinter (maybe > with Text), either dynamically or otherwise

Re: templates

2006-01-31 Thread Richie Hindle
[Christoph] > The reason why [PyMeld] is slower than native templates seems clear: You > convert the whole page to objects in memory, and then serialize > everything back to HTML. [Peter] > Unless I'm misremembering, PyMeld is special amongst the "total > decoupling of code and presentation" c

Re: templates

2006-01-31 Thread Peter Hansen
Christoph Zwerschke wrote: > thakadu schrieb: > >>I have used PyMeld (http://www.entrian.com/PyMeld/) which is one of >>very few that gives a 100% separation of code and presentation, in fact >>PyMeld is not strictly speaking a template system at all. > > Yes, it is more like XIST that I mentione

Re: VB to Python migration

2006-01-31 Thread Magnus Lycka
Josh wrote: > I understand what you are saying, and I'm sure the tasks our program > does could be made much cleaner. But, implementing an ERP which is > basically what we have, is a large project and the users need (or maybe > just want) access to lots of information. I'm not pretending to kno

Re: Unicode strings and ascii regular expressions

2006-01-31 Thread Fuzzyman
Fredrik Lundh wrote: > Fuzzyman wrote: > > > Can someone confirm that compiled regular expressions from ascii > > strings will always (and safely) yield unicode values when matched > > against unicode strings ? [snip..] > > ascii patterns work just fine on unicode strings. the engine doesn't care

Re: Marked-Up Text Viewer for Python/Tkinter

2006-01-31 Thread Fuzzyman
I've played with grail. It does still work (basically). I needed to put the grail directory in my ``site-packages`` folder and create a 'grail.pth' file with the entry ``grail``. Extracting the Tkinter widget, and exposing an API, would be tricky - but I'm sure lots of people would use it. It's o

Re: test whether 2 objects are equal

2006-01-31 Thread Rene Pijlman
Yves Glodt: >I need to compare 2 instances of objects to see whether they are equal >or not, This prints "equal": class Test(object): def __init__(self): self.var1 = '' self.var2 = '' def __eq__(self,other): return self.var1 == other.var1 and self.var2 == other.v

Re: finding the intersection of a list of Sets

2006-01-31 Thread Peter Otten
Suresh Jeevanandam wrote: > I have a list of sets in variable lsets . > Now I want to find the intersection of all the sets. > > r = lsets[0] > for s in r[0:]: > r = r & s Try to post working examples. > Is there any other shorter way? >>> sets = map(set, "abc bcd cde".split()) >>> reduce(

Re: Newbie question: Unicode hiccup on reading file i just wrote

2006-01-31 Thread Darcy
Fredrik Lundh wrote: > Diez B. Roggisch wrote: >>Just don't do any fancy encoding stuff at all, a simple >>rrr=xml.dom.minidom.parseString(open("tt.xml").read()) >>should do. > or > rrr = xml.dom.minidom.parse("tt.xml") thanks a lot guys -- both approaches work a treat. in particular: die

Re: Marked-Up Text Viewer for Python/Tkinter

2006-01-31 Thread Claudio Grondi
Eric Brunel wrote: > On Mon, 30 Jan 2006 15:20:50 -0800, James Stroud <[EMAIL PROTECTED]> wrote: > >> Hello All, >> >> I'm wondering if there is something that already exists that can take >> marked up text in some format (hopefully reStructuredText or HTML) >> and can convert it into somethin

Re: Marked-Up Text Viewer for Python/Tkinter

2006-01-31 Thread Eric Brunel
On Mon, 30 Jan 2006 15:20:50 -0800, James Stroud <[EMAIL PROTECTED]> wrote: > Hello All, > > I'm wondering if there is something that already exists that can take > marked up text in some format (hopefully reStructuredText or HTML) and > can convert it into something that can be displayed with

Re: A simple question string.replace

2006-01-31 Thread bruno at modulix
Haibao Tang wrote: > I have a two-column data file like this > 1.12.3 > 2.211.1 > 4.31.1 > ... > Is it possible to substitue all '1.1' to some value else without using > re. I suppose that you don't want '11.1' to be affected. raw_data=""" 1.12.3 2.211.1 4.31.1 """ data =

Re: test whether 2 objects are equal

2006-01-31 Thread Fredrik Lundh
Yves Glodt wrote > I need to compare 2 instances of objects to see whether they are equal > or not, but with the code down it does not work (it outputs "not equal") > > #!/usr/bin/python > > class Test: > var1 = '' > var2 = '' > > test1 = Test() > test1.var1 = 'a' > test1.var2 = 'b' > > test2 = Te

finding the intersection of a list of Sets

2006-01-31 Thread Suresh Jeevanandam
I have a list of sets in variable lsets . Now I want to find the intersection of all the sets. r = lsets[0] for s in r[0:]: r = r & s Is there any other shorter way? Thanks in advance, Suresh -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >