Re: safest way to kill a thread

2005-01-18 Thread limodou
I think only those threads which invoked with setDaemon() method will exit, and others will not, as the main program exit. [EMAIL PROTECTED] wrote: limodou wrote: Using Thread's method setDaemon() before you call the start() method. Just like : t.setDaemon(True) t.start() thank for fast reply. f

Re: Solutions for data storage?

2005-01-18 Thread Jan Dries
Leif K-Brooks <[EMAIL PROTECTED]> schreef: > > I've looked at SQLObject, and it's very nice, but it doesn't > provide certain features I really want, like the ability to store > lists of strings or integers directly in the database (using commas > in a varchar column or something). What exactly

Re: safest way to kill a thread

2005-01-18 Thread martinnitram
limodou wrote: >Using Thread's method setDaemon() before you call the start() method. >Just like : >t.setDaemon(True) >t.start() thank for fast reply. from python.org doc, said that setDaemon() function as "The entire Python program exits when no active non-daemon threads are left." is it mean that

Solutions for data storage?

2005-01-18 Thread Leif K-Brooks
I'm writing a relatively simple multi-user public Web application with Python. It's a rewrite of a similar application which used PHP+MySQL (not particularly clean code, either). My opinions on various Web frameworks tends to vary with the phase of the moon, but currently, I'm planning to use Q

Re: File objects? - under the hood question

2005-01-18 Thread Stephen Thorne
On Tue, 18 Jan 2005 22:53:10 -0800, Eric Pederson <[EMAIL PROTECTED]> wrote: > > I didn't come across any illuminating discussion via Google, thus my question > here (though it may be a neophyte question.) I am interested in the workings > under the hood of Python's access of "files". > > What

Re: generator expressions: performance anomaly?

2005-01-18 Thread Stephen Thorne
On Tue, 18 Jan 2005 23:09:57 -0700, Steven Bethard <[EMAIL PROTECTED]> wrote: > @with_consts(i=1, deftime=time.ctime()) > def foo(x, y=123, *args, **kw): > return x*y, kw.get('which_time')=='now' and time.ctime() or deftime > > Then you don't have to mix parameter declarations with locals def

File objects? - under the hood question

2005-01-18 Thread Eric Pederson
I didn't come across any illuminating discussion via Google, thus my question here (though it may be a neophyte question.) I am interested in the workings under the hood of Python's access of "files". What is actually happening at the various stages when I create a file object and "read" it?

Re: makepy crashing

2005-01-18 Thread Roger Upole
Looks like the makepy step creates the generated file successfully, but python is choking with an assertion failure on lines longer than 512 when it tries to import it. This is the line it was processing when it died: def GetSpellingSuggestions(self, Word=defaultNamedNotOptArg, CustomDictionary=de

Re: generator expressions: performance anomaly?

2005-01-18 Thread Steven Bethard
Bengt Richter wrote: On Tue, 18 Jan 2005 17:38:20 -0700, Steven Bethard <[EMAIL PROTECTED]> wrote: Bengt Richter wrote: Which make me wonder what plans there are for providing a better mechanism than default arguments as a way of initializing local function variables. Nested def's to create a clos

Re: Window capture using WM_PRINT and Python

2005-01-18 Thread Roger Upole
Do you get any kind of traceback when you start a process that way? There's not much info to go on. Sys.argv parameters are passed as strings. You'll need to do an int() on them before you can use them as handles. Also, not all handles are portable between processes. Your device context handle

Re: python/cgi/html bug

2005-01-18 Thread Dan Bishop
Dfenestr8 wrote: > Hi. > > I've written a cgi messageboard script in python, for an irc chan I happen > to frequent. > > Bear with me, it's hard for me to describe what the bug is. So I've > divided this post into two sections: HOW MY SCRIPTS WORKS, and WHAT THE > BUG IS. > ... > The problem is wh

Error in Plex 1.1.4.1

2005-01-18 Thread srijit
Hello, I got the following error while using Plex 1.1.4.1 D:\Python24\myfiles>python plex1.py Traceback (most recent call last): File "plex1.py", line 1, in ? from Plex import * File "D:\python24\lib\site-packages\Plex\__init__.py", line 34, in ? from Lexicons import Lexicon, State F

[perl-python] 20050119 writing modules

2005-01-18 Thread Xah Lee
© # -*- coding: utf-8 -*- © # Python © © # one can write functions, © # save it in a file © # and later on load the file © # and use these functions. © © # For example, save the following line in © # a file and name it module1.py © # def f1(n): returns range(n) © © # to load the file, use import ©

Re: rotor replacement

2005-01-18 Thread Paul Rubin
"Reed L. O'Brien" <[EMAIL PROTECTED]> writes: > I see rotor was removed for 2.4 and the docs say use an AES module > provided separately... Is there a standard module that works alike or > an AES module that works alike but with better encryption? If you mean a module in the distribution, the ans

Re: Has apparent 2.4b1 bug been fixed? flatten in Lib\compiler\ast.py overloads 'list' name

2005-01-18 Thread Bengt Richter
On Wed, 19 Jan 2005 04:55:53 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: >What am I missing? (this is from 2.4b1, so probably it has been fixed?) > I googled and found a bug report, but initial report kind of passes on it saying nested sequences will probably be tuples, so no panic (my paraphras

Has apparent 2.4b1 bug been fixed? flatten in Lib\compiler\ast.py overloads 'list' name

2005-01-18 Thread Bengt Richter
What am I missing? (this is from 2.4b1, so probably it has been fixed?) def flatten(list): l = [] for elt in list: --must be expecting list instance or other sequence t = type(elt) if t is tuple or t is list: --looks lik

Re: Employablity of python programmers

2005-01-18 Thread Benji York
Mir Nazim <[EMAIL PROTECTED]> wrote: I am in a fix what skill set I must choose to be safe as far as job openings are concerned. > 1) C/C++ and Python. > 2) Java and Python. > 3) Pure Python. As for pure employability, I'd choose option 2, but as a person that wants something more than employment

rotor replacement

2005-01-18 Thread Reed L. O'Brien
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption? cheers, reed -- http://mail.python.org/mailman/listinfo/python-list

Re: safest way to kill a thread

2005-01-18 Thread limodou
Using Thread's method setDaemon() before you call the start() method. Just like : t.setDaemon(True) t.start() [EMAIL PROTECTED] wrote: Dear all, in python, a thread can be created by t = threading.Thread. But i found that when the main (and the thread) program is running and user use Crtl+C/Crtl+

safest way to kill a thread

2005-01-18 Thread martinnitram
Dear all, in python, a thread can be created by t = threading.Thread. But i found that when the main (and the thread) program is running and user use Crtl+C/Crtl+Z to break the program abnormally, the thread is still running and needed to kill manually (by the pid). Is there had any safest way to k

DDE client help

2005-01-18 Thread bogdan romocea
Dear Python experts, I'm facing a simple problem which however I'm having a hard time solving. I have a DDE server with data that changes from time to time. I need to put together a DDE client that would 'notice' updated values on the server and append them as a new row in a text file. 1. How do

Re: [perl-python] 20050118 keyed list

2005-01-18 Thread Jürgen Exner
Tassilo v. Parseval wrote: > Also sprach Jürgen Exner: > >> Xah Lee wrote: > >>> © %a = ('john',3, 'mary', 4, 'jane', 5, 'vicky',7); >>> © use Data::Dumper qw(Dumper); >>> © print Dumper \%a; >> >> Wow, my compliments. The very first time that using Data::Dumper >> actually may do something useful

Re: generator expressions: performance anomaly?

2005-01-18 Thread Paul Rubin
Steve Holden <[EMAIL PROTECTED]> writes: > You probably already know that sensible compiled language systems have > used constant folding since time immemorial, but Python has always > eschewed it. That's what comes of being a pragmatist's language: if > such optimizations really are required the p

Re: generator expressions: performance anomaly?

2005-01-18 Thread Bengt Richter
On Tue, 18 Jan 2005 17:38:20 -0700, Steven Bethard <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >> Which make me wonder what plans there are for providing a better >> mechanism than default arguments as a way of initializing local function >> variables. Nested def's to create a closure with in

Re: Integration with java (Jpype vs. JPE)

2005-01-18 Thread Steve Menard
Istvan Albert wrote: Steve Menard wrote: To asnwer your question more fully, the jpype-specific cide is only for looking up the Classes and startting/stopping the environment. For everything else, Java objects and classes are used as regular Python objects. Thanks for the response. Currently I

Re: Problem parsing namespaces with xml.dom.minidom

2005-01-18 Thread Mike McGavin
Hi Fredrik. Fredrik Lundh wrote: It wouldn't need to conform to the official specifications of the DOM API, but I guess I'm after some comparable functionality. [--snip--] sounds like this might be exactly what you need: http://effbot.org/zone/element-index.htm (it's also the fastest and most

Re: file copy portability

2005-01-18 Thread Bob Smith
John Machin wrote: Bob Smith wrote: Is shutil.copyfile(src,dst) the *most* portable way to copy files with Python? I'm dealing with plain text files on Windows, Linux and Mac OSX. Thanks! Portable what? Way of copying?? Do you want your files transferred (a) so that they look like native text file

Re: simultaneous multiple requests to very simple database

2005-01-18 Thread Eric S. Johansson
Thomas Bartkus wrote: When you write that "super dictionary", be sure to post code! I could use one of those myself. hmmm it looks like you have just flung down the gauntlet of "put up or quityerwhinging". I need to get the crude implementation done first but I think I can do it if I can find a

Re: file copy portability

2005-01-18 Thread Steve Holden
Bob Smith wrote: Is shutil.copyfile(src,dst) the *most* portable way to copy files with Python? I'm dealing with plain text files on Windows, Linux and Mac OSX. Thanks! Yes. regards Steve -- Steve Holden http://www.holdenweb.com/ Python Web Programming http://pydish.holdenweb.com/

Re: file copy portability

2005-01-18 Thread John Machin
Bob Smith wrote: > Is shutil.copyfile(src,dst) the *most* portable way to copy files with > Python? I'm dealing with plain text files on Windows, Linux and Mac OSX. > > Thanks! Portable what? Way of copying?? Do you want your files transferred (a) so that they look like native text files on the

Re: file copy portability

2005-01-18 Thread Peter Hansen
Bob Smith wrote: Is shutil.copyfile(src,dst) the *most* portable way to copy files with Python? I'm dealing with plain text files on Windows, Linux and Mac OSX. Yes, provided you don't need any of the features provided by the other shutil.copy functions, and assuming you can live with the Caveat l

Re: generator expressions: performance anomaly?

2005-01-18 Thread Bengt Richter
On Tue, 18 Jan 2005 15:29:06 +0100, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> I don't see how generating byte code for a = 9; when seeing the >> expression a = 3 + 6, would be a problem for non-functional >> languages. > >Most probably. But I don't see much code of that type that it would

Re: generator expressions: performance anomaly?

2005-01-18 Thread Steven Bethard
Bengt Richter wrote: Which make me wonder what plans there are for providing a better mechanism than default arguments as a way of initializing local function variables. Nested def's to create a closure with initialized values is pretty crufty for that, IMO. What about using a class? Associating f

file copy portability

2005-01-18 Thread Bob Smith
Is shutil.copyfile(src,dst) the *most* portable way to copy files with Python? I'm dealing with plain text files on Windows, Linux and Mac OSX. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: inbuilt function buffer()

2005-01-18 Thread Aldo Cortesi
Thus spake km ([EMAIL PROTECTED]): > I which context is the inbuilt function buffer() used ? It's an efficiency measure. Say you have a string x. Taking a slice of the string - x[a:a+10] - will implicitly create a new string containing the specified data. Doing the same using buffer - buffer(x,

Re: Tkinter in thread hangs on windows but not on Linux

2005-01-18 Thread Philippe C. Martin
Actually, the following link: http://www.astro.washington.edu/owen/TkinterSummary.html seems to say my code is illegal - so I'm now just launching a modless window from the main thread - _seems_ to work On Tue, 18 Jan 2005 11:45:28 +0100, Philippe C. Martin wrote: > Hi, > > I need to pop-up i

Re: script to automate GUI application (newbie)

2005-01-18 Thread McBooCzech
Try following scripting language to automating Windows GUI, it simulates keystrokes (supports most keyboard layouts), simulates mouse movements and clicks and does tons of other stuff: http://www.hiddensoft.com/autoit3/ It works nicely for me. -- http://mail.python.org/mailman/listinfo/python-l

Re: generator expressions: performance anomaly?

2005-01-18 Thread Bengt Richter
On Tue, 18 Jan 2005 09:24:15 -0500, Steve Holden <[EMAIL PROTECTED]> wrote: [...] >You probably already know that sensible compiled language systems have >used constant folding since time immemorial, but Python has always >eschewed it. That's what comes of being a pragmatist's language: if such

Re: Re: Fuzzy matching of postal addresses

2005-01-18 Thread Tim Churches
Andrew McLean <[EMAIL PROTECTED]> wrote: > > Thanks for all the suggestions. There were some really useful pointers. > > A few random points: > > 1. Spending money is not an option, this is a 'volunteer' project. I'll > try out some of the ideas over the weekend. > ... > I am tempted to try an

Re: lambda

2005-01-18 Thread Bengt Richter
On 18 Jan 2005 13:28:00 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: >Op 2005-01-18, Nick Coghlan schreef <[EMAIL PROTECTED]>: >> Antoon Pardon wrote: >>> More specific the Decimal class is mutable and usable as dict key. >> >> It's *meant* to be immutable though. The fact that we used __slots__

Re: Assigning to self

2005-01-18 Thread Jeff Shannon
Marc 'BlackJack' Rintsch wrote: Frans Englich wrote: Then I have some vague, general questions which perhaps someone can reason from: what is then the preferred methods for solving problems which requires Singletons? As already mentioned it's similar to a global variable. If I need a "Singleton"

Re: Fuzzy matching of postal addresses

2005-01-18 Thread John Roth
"Andrew McLean" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Thanks for all the suggestions. There were some really useful pointers. A few random points: 1. Spending money is not an option, this is a 'volunteer' project. I'll try out some of the ideas over the weekend. 2. Someone

Re: simultaneous multiple requests to very simple database

2005-01-18 Thread Thomas Bartkus
"Eric S. Johansson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 99.9 percent of what I do (and I suspect this could be true for others) > could be satisfied by a slightly enhanced super dictionary with a record > level locking. BUT - Did you not mention! : > Estimated number

Re: simultaneous multiple requests to very simple database

2005-01-18 Thread Eric S. Johansson
Ricardo Bugalho wrote: On Tue, 18 Jan 2005 17:33:26 -0500, Eric S. Johansson wrote: When I look at databases, I see a bunch of very good solutions that are either overly complex or heavyweight on one hand and very nice and simple but unable to deal with concurrency on the other. two sets of point

Re: Assigning to self

2005-01-18 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Frans Englich wrote: > Then I have some vague, general questions which perhaps someone can reason > from: what is then the preferred methods for solving problems which requires > Singletons? As already mentioned it's similar to a global variable. If I need a "Singleton"

Re: macros

2005-01-18 Thread Jeremy Bowers
On Tue, 18 Jan 2005 14:36:08 -0800, Jeff Shannon wrote: > I think that this sort of thing is better to have as an explicitly > risky hack, than as an endorsed part of the language. The mere fact > that this *is* something that one can clearly tell is working around > certain deliberate limitati

Re: macros

2005-01-18 Thread Evan Simpson
Jeremy Bowers wrote: You know, Guido might as well give in now on the Macro issue. If he doesn't come up with something himself, apparently we'll just hack bytecode. Ah, hacking bytecode isn't where it's at anymore. These days, you use the compiler package and munge the AST. Hygenic! That said,

Re: simultaneous multiple requests to very simple database

2005-01-18 Thread Ricardo Bugalho
On Tue, 18 Jan 2005 17:33:26 -0500, Eric S. Johansson wrote: > When I look at databases, I see a bunch of very good solutions that are > either overly complex or heavyweight on one hand and very nice and simple > but unable to deal with concurrency on the other. two sets of point > solutions that

python/cgi/html bug

2005-01-18 Thread Dfenestr8
Hi. I've written a cgi messageboard script in python, for an irc chan I happen to frequent. Bear with me, it's hard for me to describe what the bug is. So I've divided this post into two sections: HOW MY SCRIPTS WORKS, and WHAT THE BUG IS. HOW MY SCRIPT WORKS Basically, it's divided into two

Re: simultaneous multiple requests to very simple database

2005-01-18 Thread Stephen Thorne
On Tue, 18 Jan 2005 17:33:26 -0500, Eric S. Johansson <[EMAIL PROTECTED]> wrote: > so in conclusion, my only reason for querying was to see if I was > missing a solution. So far, I have not found any work using because > they add orders of magnitude more complexity than simple dbm with file > lock

Re: lambda

2005-01-18 Thread David Bolen
Antoon Pardon <[EMAIL PROTECTED]> writes: > Op 2005-01-18, Simon Brunning schreef <[EMAIL PROTECTED]>: > > On 18 Jan 2005 07:51:00 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote: > >> 3 mutating an item in a sorted list *does* *always* cause problems > > > > No, it doesn't. It might cause the list n

Re: Fuzzy matching of postal addresses

2005-01-18 Thread Andrew McLean
Thanks for all the suggestions. There were some really useful pointers. A few random points: 1. Spending money is not an option, this is a 'volunteer' project. I'll try out some of the ideas over the weekend. 2. Someone commented that the data was suspiciously good quality. The data sources are

Re: macros

2005-01-18 Thread Jeff Shannon
Jeremy Bowers wrote: On Tue, 18 Jan 2005 12:59:07 -0800, Robert Brewer wrote: You know, Guido might as well give in now on the Macro issue. If he doesn't come up with something himself, apparently we'll just hack bytecode. I'm not sure that's a gain. I think that this sort of thing is better to ha

How to fill available screen size then scroll

2005-01-18 Thread Mudcat
Hi all, I am writing a gui that expands depending on the number of interefaces a user decides to use with Win 2k, Tkinter, and Pmw. So with normal use the gui window will expand to the screen size and then clip without scrolling. If I use Pmw.ScrolledFrame, the clipping frame is set based on the

Re: simultaneous multiple requests to very simple database

2005-01-18 Thread Eric S. Johansson
Thomas Bartkus wrote: "Eric S. Johansson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] at this point, I know they will be some kind souls suggesting various SQL solutions. While I appreciate the idea, unfortunately I do not have time to puzzle out yet another component. Someday I

Re: extension module, thread safety?

2005-01-18 Thread David Bolen
Nick Coghlan <[EMAIL PROTECTED]> writes: > Pierre Barbier de Reuille wrote: > > Ok, I wondered why I didn't know these functions, but they are new > > to Python 2.4 ( and I didn't take the time to look closely at Python > > 2.4 as some modules I'm working with are still not available for > > Pytho

Re: simultaneous multiple requests to very simple database

2005-01-18 Thread Thomas Bartkus
"Eric S. Johansson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > at this point, I know they will be some kind souls suggesting various > SQL solutions. While I appreciate the idea, unfortunately I do not have > time to puzzle out yet another component. Someday I will figure it o

Re: Fuzzy matching of postal addresses

2005-01-18 Thread John Machin
John Machin wrote: > Ermmm ... only remove "the" when you are sure it is a whole word. Even > then it's a dodgy idea. In the first 1000 lines of the nearest address > file I had to hand, I found these: Catherine, Matthew, Rotherwood, > Weatherall, and "The Avenue". > Partial apologies: I wasn't r

anydbm biasing

2005-01-18 Thread Eric S. Johansson
I have a preference for gdbm when building DBM based dictionaries but have found I cannot count on it being there all the time. Therefore, I have created this little tidbit which you call before opening your anydbm database to bias the preference towards gdbm instead of dbhash: # bias DBM towa

Re: Contributor's List

2005-01-18 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: ... > Is this mean't to only cover additional entries which were added in > the 2nd edition, or is it also mean't to encompass entries which were > carried over from the 1st edition as well. The latter: it covers all entries. > If it is both, then the editing must ha

Re: pickling extension class

2005-01-18 Thread David M. Cooke
harold fellermann <[EMAIL PROTECTED]> writes: > Hi all, > > I have a problem pickling an extension class. As written in the > Extending/Embedding Manual, I > provided a function __reduce__ that returns the appropreate tuple. > This seams to work fine, > but I still cannot pickle because of the fol

macros (was: RE: generator expressions: performance anomaly?)

2005-01-18 Thread Jeremy Bowers
On Tue, 18 Jan 2005 12:59:07 -0800, Robert Brewer wrote: > Especially since you can already do it explicitly with Raymond > Hettinger's cookbook recipe: > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/277940 You know, Guido might as well give in now on the Macro issue. If he doesn't come

Re: what would you like to see in a 2nd edition Nutshell?

2005-01-18 Thread Alex Martelli
Steven Chan <[EMAIL PROTECTED]> wrote: > I completely agree. I'm also waiting for an advanced Python/project > management book that helps folks out with large-scale projects. I won't schedule that project until the Nutshell 2nd ed is substantially done... and I'm not _promising_ I'll schedule it

Re: Tkinter in thread hangs on windows but not on Linux

2005-01-18 Thread Philippe C. Martin
Well this is what is on the top of my script: from Tkinter import * import threading from ScrolledText import * I still hang under XP wish I had 2K to test. I almost sounds like tkinter does not get refresh events anymore. I'll keep at it On Tue, 18 Jan 2005 12:42:21 -0800, Kamilche

Re: what would you like to see in a 2nd edition Nutshell?

2005-01-18 Thread Alex Martelli
kery <[EMAIL PROTECTED]> wrote: ... > Any schedule for publication of 2nd Ed? I just bought 1st Ed. The 2nd edition Python Cookbook appears to be on-track for PyCon (late March) for the very first ink-on-paper -- probably April in bookstores. The 2nd edition Python in a Nutshell is more doubtf

Re: script to automate GUI application (newbie)

2005-01-18 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Jim <[EMAIL PROTECTED]> wrote: > >It sounds like a case for the Expect program, to me. Try Google-ing >for "Expect". If you are looking for a Python approach, then try >googling for "Expect Python". > >Jim > No--that is, I find his description unambiguous in NOT a

Re: Excel module for Python

2005-01-18 Thread jean-paul
I generate a lot pseudo excel file. Just write row by row on file and separate every cell of a row by a tab and put an .xls extension on the file name. When you double click. It opens directly EXCEL and you have directly the column and the row. It is easier than the CSV or SYLK files. If you want t

RE: generator expressions: performance anomaly?

2005-01-18 Thread Robert Brewer
Jeremy Bowers wrote: > On Tue, 18 Jan 2005 14:05:15 +, Antoon Pardon wrote: > > I don't see how generating byte code for a = 9; when seeing the > > expression a = 3 + 6, would be a problem for non-functional > > languages. > > Ultimately, the use is fairly limited; I can't imagine the > execu

Re: pickling extension class

2005-01-18 Thread Alex Martelli
harold fellermann <[EMAIL PROTECTED]> wrote: ... > Here it goes...: > OOPS, error (exceptions.ImportError): No module named hyper So, the __import__ in pickle fails -- indeed, __import__('foo') when 'foo' ``is imported from a subpackage'' is _supposed_ to fail, as 'hyper' is not the name you

Re: Tkinter in thread hangs on windows but not on Linux

2005-01-18 Thread Kamilche
This example worked for me on Windows 2000, after inserting import threading from Tkinter import * import ScrolledText at the top. -- http://mail.python.org/mailman/listinfo/python-list

Window capture using WM_PRINT and Python

2005-01-18 Thread arN
Hi ! I'm a Java developper and I wish to make a capture of an offscreen window (on WinXP). It's not possible in Java, so I use a python script and WM_PRINT, but it doesn't seem to work. Could someone have a look at my script and give me any advise ? TIA -- Arnaud my python script : python snap.p

Re: hex notation funtion

2005-01-18 Thread tertius
tertius wrote: Hi, Is there a builtin function that will enable me to display the hex notation of a given binary string? (example below) Thanks all. -- http://mail.python.org/mailman/listinfo/python-list

Re: One-Shot Property?

2005-01-18 Thread Scott David Daniels
Leif K-Brooks wrote: class CachingProperty(object): def __init__(self, attr_name, calculate_function): self._name = attr_name self._calculate = calculate_function def __get__(self, obj, type=None): if obj is None: return self else: val

Re: hex notation funtion

2005-01-18 Thread Peter Hansen
Grant Edwards wrote: On 2005-01-18, Grant Edwards <[EMAIL PROTECTED]> wrote: On 2005-01-18, tertius <[EMAIL PROTECTED]> wrote: Is there a builtin function that will enable me to display the hex notation of a given binary string? (example below) ' '.join('%02x' % ord(b) for b in s) Oops. Should

Re: Fuzzy matching of postal addresses

2005-01-18 Thread [EMAIL PROTECTED]
I think you guys are missing the point. All you would need to add to get a 'probable match' is add another search that goes through the 10% that didnt get matched and do a "endswith" search on the data. From the example data you showed me, that would match a good 90% of the 10%, leaving you with a

Re: hex notation funtion

2005-01-18 Thread Grant Edwards
On 2005-01-18, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2005-01-18, tertius <[EMAIL PROTECTED]> wrote: > >> Is there a builtin function that will enable me to display the hex >> notation of a given binary string? (example below) > > ' '.join('%02x' % ord(b) for b in s) Oops. Should be: ' '

Re: pickling extension class

2005-01-18 Thread harold fellermann
On 18.01.2005, at 20:31, Alex Martelli wrote: harold fellermann <[EMAIL PROTECTED]> wrote: File "/sw/lib/python2.4/pickle.py", line 760, in save_global raise PicklingError( pickle.PicklingError: Can't pickle : it's not found as hyper.PeriodicGrid dir(hyper) ['Dir', 'Neighbors', 'PeriodicGri

Re: pickling extension class

2005-01-18 Thread Alex Martelli
harold fellermann <[EMAIL PROTECTED]> wrote: >File "/sw/lib/python2.4/pickle.py", line 760, in save_global > raise PicklingError( > pickle.PicklingError: Can't pickle : it's > not found as hyper.PeriodicGrid > >>> dir(hyper) > ['Dir', 'Neighbors', 'PeriodicGrid', 'PeriodicPos', '__doc__

Re: hex notation funtion

2005-01-18 Thread Grant Edwards
On 2005-01-18, tertius <[EMAIL PROTECTED]> wrote: > Is there a builtin function that will enable me to display the hex > notation of a given binary string? (example below) ' '.join('%02x' % ord(b) for b in s) -- Grant Edwards grante Yow! This is a NO-FRILLS

Re: hex notation funtion

2005-01-18 Thread [EMAIL PROTECTED]
This will do it: >>> int('1000', 2) 128 >>> hex(int('1000', 2)) '0x80' >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: How to prevent the script from stopping before it should

2005-01-18 Thread python
Fredrik Lundh wrote: > Steve Holden wrote: > > > You will need to import the socket module and then call socket.setdefaulttimeout() to ensure that > > communication with non-responsive servers results in a socket exception that you can trap. > > or you can use asynchronous sockets, so your program

Re: how to find site-packages path (Michael Hoffman) - use distutils

2005-01-18 Thread Philippe C. Martin
I actually target Unix and windows so pyexe won't cut it I'm afraid - same issue with Inno. As far as the site-package target, I don't fully understand your relunctancy. Just as my potential users might not own a compiler, they might not be computer proficient enough to easily understand how to ch

Re: how to find site-packages path (Michael Hoffman) - use distutils

2005-01-18 Thread vincent wehren
Philippe C. Martin wrote: Why would you want to copy any *.pyc instead of compiling them on site? I know that sounds terrible to the open source community, but I do not intend to release the source code for my product That's not why I asked. I'll leave the politics up to you. The thing is, tha

Re: Print to Windows default Printer

2005-01-18 Thread Samantha
Thanks for he quick response. This is small sample code from a PSP script to get Exit Info of a digital image. I want to print to the printer rather than the screen. --- Info = App.Do( Environment, 'ReturnImageInfo' ) print print 'Input Device Information' for key in InputDev

Re: hex notation funtion

2005-01-18 Thread Philippe C. Martin
Would that do it? for i in my_byte_string: = atoi(binascii.hexlify(i),16) Regards, Philippe On Tue, 18 Jan 2005 20:43:44 +0200, tertius wrote: > Hi, > > Is there a builtin function that will enable me to display the hex > notation of a given binary string? (example below) > > man

Re: hex notation funtion

2005-01-18 Thread Irmen de Jong
tertius wrote: Hi, Is there a builtin function that will enable me to display the hex notation of a given binary string? (example below) Does this help: >>> "hello".encode("hex") '68656c6c6f' >>> "deadbeef".decode("hex") '\xde\xad\xbe\xef' ? --Irmen -- http://mail.python.org/mailman/listinfo/pytho

pickling extension class

2005-01-18 Thread harold fellermann
Hi all, I have a problem pickling an extension class. As written in the Extending/Embedding Manual, I provided a function __reduce__ that returns the appropreate tuple. This seams to work fine, but I still cannot pickle because of the following error: >>> from model import hyper >>> g = hyper.Pe

hex notation funtion

2005-01-18 Thread tertius
Hi, Is there a builtin function that will enable me to display the hex notation of a given binary string? (example below) many thanks Tertius () 02 11 00 00 46 5A 1A 82 02 11 00 39 36 39 33 39 FZ.96939 0016(0010) 36 39 33 00 0A 30 33 37 34 34 39 35 38 25 DD 01 693..0374495

Re: Print to Windows default Printer

2005-01-18 Thread Peter Hansen
Samantha wrote: I am new to Python and I am having considerable trouble trying to print (using a simple script) to the default printer rather than the screen. Thanks for any help. Please show some example code, and explain in more detail what you are trying to do. There are perhaps *dozens* of di

Print to Windows default Printer

2005-01-18 Thread Samantha
I am new to Python and I am having considerable trouble trying to print (using a simple script) to the default printer rather than the screen. Thanks for any help. S -- http://mail.python.org/mailman/listinfo/python-list

Re: One-Shot Property?

2005-01-18 Thread John Lenton
On Tue, Jan 18, 2005 at 04:54:56PM +, Kevin Smith wrote: > > I have many cases in my code where I use a property for calculating a > value on-demand. Quite a few of these only need to be called once. > After that the value is always the same. In these properties, I set a > variable in th

Re: Integration with java (Jpype vs. JPE)

2005-01-18 Thread Irmen de Jong
Joachim Boomberschloss wrote: Option iii would also enable writing independent packages in Python and Java, but its glue layer will be distributed between Python and Java using Jython and Pyro (I chose Pyro because it works in both CPython and Jython, and can be used to communicate between them). P

Re: One-Shot Property?

2005-01-18 Thread Leif K-Brooks
Kevin Smith wrote: I have many cases in my code where I use a property for calculating a value on-demand. Quite a few of these only need to be called once. After that the value is always the same. In these properties, I set a variable in the instance as a cached value and return that value on

Re: ANNOUNCE: Altova ... blah blah blah

2005-01-18 Thread Irmen de Jong
Altova Announcements wrote: Altova Unveils . [spam] Well now, I didn't like their products very much already, but this spam has certainly made them drop another few steps down on my scale. Hmpf. --Irmen -- http://mail.python.org/mailman/listinfo/python-list

Re: generator expressions: performance anomaly?

2005-01-18 Thread Jeremy Bowers
On Tue, 18 Jan 2005 14:05:15 +, Antoon Pardon wrote: > I don't see how generating byte code for a = 9; when seeing the > expression a = 3 + 6, would be a problem for non-functional > languages. To answer nearly every post you've made to this thread, "because Python doesn't have the resources t

Re: One-Shot Property?

2005-01-18 Thread Daniel Dittmar
Kevin Smith wrote: I have many cases in my code where I use a property for calculating a value on-demand. Quite a few of these only need to be called once. After that the value is always the same. In these properties, I set a variable in the instance as a cached value and return that value on

Re: script to automate GUI application (newbie)

2005-01-18 Thread Jim
It sounds like a case for the Expect program, to me. Try Google-ing for "Expect". If you are looking for a Python approach, then try googling for "Expect Python". Jim -- http://mail.python.org/mailman/listinfo/python-list

Re: One-Shot Property?

2005-01-18 Thread Dave Benjamin
Kevin Smith wrote: I have many cases in my code where I use a property for calculating a value on-demand. Quite a few of these only need to be called once. After that the value is always the same. In these properties, I set a variable in the instance as a cached value and return that value on

Re: simultaneous multiple requests to very simple database

2005-01-18 Thread Eric S. Johansson
Robert Brewer wrote: Eric S. Johansson wrote: I have an application where I need a very simple database, effectively a very large dictionary. The very large dictionary must be accessed from multiple processes simultaneously. I need to be able to lock records within the very large dictionary when

Re: [perl-python] 20050118 keyed list

2005-01-18 Thread Reinhold Birkenfeld
Jürgen Exner wrote: >> © # see "perldoc perldata" for an unix-styled course. > > Excuse me? Do you mind explaining where exactly perldata is "Unix-styled"? Remember: Perl == Unix == Satan. Reinhold -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >