Re: search/replace in Python

2005-05-27 Thread Oliver Andrich
Hi, 2005/5/28, Vamsee Krishna Gomatam <[EMAIL PROTECTED]>: > Hello, > I'm having some problems understanding Regexps in Python. I want > to replace "PHRASE" with > "http://www.google.com/search?q=PHRASE>PHRASE" in a block of > text. How can I achieve this in Python? Sorry for the naive que

Re: Software licenses and releasing Python programs for review

2005-05-27 Thread James William Pye
On Fri, 27 May 2005 18:50:14 -0700, poisondart wrote: > - being able to distribute it freely, anybody can modify it > - nobody is allowed to make profit from my code (other than myself) Terry mentioned OS.org, so I will not repeat that. (opensource.org) Also, check out http://creativecommons.org.

Questions about wxPython...

2005-05-27 Thread Helmutt
Hi all! I'm trying to learn myself wxPython, and I got some questions: Whats the name of the event that occur when I press the exit/cross-button on the frame? How do I connect a function with that event? How do I start a new process of the same program I'm running? I do not want to create a new fr

Re: regexp for sequence of quoted strings

2005-05-27 Thread Paul McGuire
George - Thanks for your enthusiastic endorsement! Here are some quibbles about your pyparsing grammar (but really, not bad for a first timer): 1. The Word class is used to define "words" or collective groups of characters, by specifying what sets of characters are valid as leading and/or body ch

Re: Intellisense and the psychology of typing

2005-05-27 Thread James D Carroll
<[EMAIL PROTECTED]> wrote> > 1) Intellisense is really just another crutch that does more harm than > good? There were a few hardcore defenders of this position but not > many. I'm primarily a VB programmer, but I also do Java and web stuff as well. Whenever I look at a new IDE the FIRST thing I lo

Re: the problem wtih cgi

2005-05-27 Thread Graham Fawcett
chris patton wrote: > Hi everyone. > > Has anyone seen that problem with running a python cgi script in a > server? > It takes you to myspace.com/redmartian or something. Anyway, does > anyone know when this problem will be fixed? It could be solved much sooner if you follow these steps: (1) Care

the problem wtih cgi

2005-05-27 Thread chris patton
Hi everyone. Has anyone seen that problem with running a python cgi script in a server? It takes you to myspace.com/redmartian or something. Anyway, does anyone know when this problem will be fixed? -- http://mail.python.org/mailman/listinfo/python-list

Re: Software licenses and releasing Python programs for review

2005-05-27 Thread Terry Reedy
"poisondart" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > testing on other platforms, but also I would like to explore the > different software licenses that are available (there seems to be There is an Open Software Foundation (or something close) with a site listing and linki

Re: Get number of lines in file

2005-05-27 Thread Steven Bethard
Elliot Temple wrote: > > On May 27, 2005, at 12:17 PM, [EMAIL PROTECTED] wrote: > >> I have read in a file and need to get the number of lines. >> >> cpn_file = open('Central Part number list.txt') >> cpn_version = cpn_file.read().split('\n') >> >> I want to know the number of elements in

Software licenses and releasing Python programs for review

2005-05-27 Thread poisondart
Hi, I'm not sure if this is the right group to post this. If not, then I would appreciate if somebody could point me to the correct group. This is my first time releasing software to the public and I'm wanting to release a Python program I wrote for review (and critique) and testing on other plat

Re: cpu usage limit

2005-05-27 Thread elbertlev
I understand, that what I suggest does not solve the problem you want, but.. Why do you want to restrict CPU usage to 30%? In Windows I run CPU intesive therads on IDLE priority, while interfacand/or communication threads run on normal. This gives me best of two worlds: 1. I use 100% CPU (good) an

Re: Parsing a Python dictionary inside a Python extension

2005-05-27 Thread elbertlev
1. Why not to simplfy the problem. You can extract values from the dictionari in python (this is fast). Put them in a list (fast). Pass the list to the extension, handle it and return to python. etc. 2. Use Pyrex. -- http://mail.python.org/mailman/listinfo/python-list

unbuffering std streams in code

2005-05-27 Thread John Reese
You know how you can specify that stderr, stdin, stdout should be unbuffered by running python with the -u switch? Is there any way I can have the same affect in code by doing something to the sys.std* variables? -- http://mail.python.org/mailman/listinfo/python-list

just a test .sorry

2005-05-27 Thread Çϳª·Î
sorry -- http://mail.python.org/mailman/listinfo/python-list

Re: Case Sensitive, Multiline Comments

2005-05-27 Thread Leif K-Brooks
John Roth wrote: > "Elliot Temple" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> One other interesting thing about case sensitivity I don't think >> anyone has mentioned: in Python keywords are all lowercase already >> (the way I want to type them). In some other languages,

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Andy Leszczynski
gabor wrote: > the problem is: > what happens if 2 users invoke the cgi at the same time? Would BerkleyDB support that? -- http://mail.python.org/mailman/listinfo/python-list

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Paul Rubin
Peter Hansen <[EMAIL PROTECTED]> writes: > I think the FAQ can answer that better than I can, since I'm not sure > whether you're asking about any low-level (OS) locks it might use or > higher-level (e.g. database-level locking) that it might use. In > summary, however, at the database level it pr

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Jp Calderone
On 27 May 2005 15:10:16 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: >Peter Hansen <[EMAIL PROTECTED]> writes: >> And PySQLite conveniently wraps the relevant calls with retries when >> the database is "locked" by the writing process, making it roughly a >> no-brainer to use SQLite da

Re: Python/Excel AddIn (was:Re: Does Python have a Template::Extract equivalent from Perl's CPAN)

2005-05-27 Thread [EMAIL PROTECTED]
CL, after you install py_win32 on windows you should look for a module called "excel*.py" under your ${PYTHONHOME} directory. They have a very basic COM Server Excel AddIn as an example. -- http://mail.python.org/mailman/listinfo/python-list

Re: [ANN] XPN 0.4.6

2005-05-27 Thread Irmen de Jong
Nemesis wrote: > XPN (X Python Newsreader XPN) is a multi-platform newsreader with > Unicode support. It has features like scoring/actions, X-Face and Face > decoding, muting of quoted text, newsrc import/export, find article and > search in the body, spoiler char/rot13, random taglines, and > conf

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Peter Hansen
Christopher Weimann wrote: > On 05/27/2005-06:02PM, Peter Hansen wrote: > >>Hmm... just tried it: you're right! On the other hand, the results were >>unacceptable: each process has a separate file pointer, so it appears >>whichever one writes first will have its output overwritten by the >>sec

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Peter Hansen
Paul Rubin wrote: > Peter Hansen <[EMAIL PROTECTED]> writes: > >>And PySQLite conveniently wraps the relevant calls with retries when >>the database is "locked" by the writing process, making it roughly a >>no-brainer to use SQLite databases as nice simple log files where >>you're trying to write

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Peter Hansen
Peter Hansen wrote: > Grant Edwards wrote: >> Not in my experience. At least under Unix, it's perfectly OK >> to open a file while somebody else is writing to it. Perhaps >> Windows can't deal with that situation? > > Hmm... just tried it: you're right! Umm... the part you were right about wa

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Jp Calderone
On 27 May 2005 15:22:17 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: >Jp Calderone <[EMAIL PROTECTED]> writes: >> >Oh, ok. But what kind of locks does it use? >> >> It doesn't really matter, does it? > >Huh? Sure, if there's some simple way to accomplish the locking, the >OP's act c

Re: [pysqlite] Equivalent for SHOW TABLES?

2005-05-27 Thread Peter Hansen
F. GEIGER wrote: > For now, the names of the tables, the app knows of, are added into an > internal list, when the app is started. Then, when queries fail, the app > knoes that it has to create them. > > It would be nice somehow to be able to ask the database what tables it > contains. Is anyone d

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Christopher Weimann
On 05/27/2005-06:02PM, Peter Hansen wrote: > > Hmm... just tried it: you're right! On the other hand, the results were > unacceptable: each process has a separate file pointer, so it appears > whichever one writes first will have its output overwritten by the > second process. Did you open th

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Paul Rubin
Jp Calderone <[EMAIL PROTECTED]> writes: > >Oh, ok. But what kind of locks does it use? > > It doesn't really matter, does it? Huh? Sure, if there's some simple way to accomplish the locking, the OP's act can do the same thing without SQlite's complexity. > I'm sure the locking mechanisms it u

Re: [pysqlite] Equivalent for SHOW TABLES?

2005-05-27 Thread madsurfer2000
F. GEIGER wrote: > > It would be nice somehow to be able to ask the database what tables it > contains. Is anyone doing this that way? How do you do that? > Information can be found in "Information_Schema_TABLES" See: http://www.sqlite.org/cvstrac/wiki?p=InformationSchema -- http://mail.python.o

Re: cpu usage limit

2005-05-27 Thread Peter Hansen
rbt wrote: > [EMAIL PROTECTED] wrote: >> finished = False >> while not finished: > > Why don't you just write 'while True'??? 'while not false' is like > saying 'I am not unemployed by Microsoft' instead of saying 'I am > employed by Microsoft'. It's confusing, complex and unnecessary. Lawyers

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Paul Rubin
Peter Hansen <[EMAIL PROTECTED]> writes: > And PySQLite conveniently wraps the relevant calls with retries when > the database is "locked" by the writing process, making it roughly a > no-brainer to use SQLite databases as nice simple log files where > you're trying to write from multiple CGI proce

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Peter Hansen
Paul Rubin wrote: > http://www.sqlite.org/faq.html#q7 [snip] > Multiple processes can have the same database open at the same > time. Multiple processes can be doing a SELECT at the same > time. But only one process can be making changes to the database > at once. > > But multiple

Re: cpu usage limit

2005-05-27 Thread Paul Rubin
"mmf" <[EMAIL PROTECTED]> writes: > How can I make sure that a Python process does not use more that 30% of > the CPU at any time. I only want that the process never uses more, but > I don't want the process being killed when it reaches the limit (like > it can be done with resource module). > > C

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Peter Hansen
Grant Edwards wrote: > On 2005-05-27, Peter Hansen <[EMAIL PROTECTED]> wrote: >>Unfortunately this assumes that the open() call will always succeed, >>when in fact it is likely to fail sometimes when another file has >>already opened the file but not yet completed writing to it, AFAIK. > > Not i

Re: [ANN] XPN 0.4.6

2005-05-27 Thread Nemesis
Mentre io pensavo ad una intro simpatica "Irmen de Jong" scriveva: >> XPN (X Python Newsreader XPN) is a multi-platform newsreader with >> Unicode support. It has features like scoring/actions, X-Face and Face >> decoding, muting of quoted text, newsrc import/export, find article and >> search in

Re: Determine if windows drive letter is hard drive or optical from python?

2005-05-27 Thread Do Re Mi chel La Si Do
Hi ! You can use WMI, for that. Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Inserting a dictionary of lists into '__main__' of an embedded interpreter

2005-05-27 Thread quadric
Hi, I have an application that has an embedded interpreter. This application loads many DLL's and passes a PyObject * to each DLL that was gotten from the following call: PyObject * pmod = PyImport_AddModule("__main__") ; Later, in one of the many DLL's that interact with the embedded inte

Parsing a Python dictionary inside a Python extension

2005-05-27 Thread quadric
Hi, I would like to pass a dictionary from my Python code to my Python extension, extract various values from the dictionary (from within the extension) , modify the values for the relevant keys and return the modified dictionary to Python. Can someone point me to an example of what the C code

Re: how to accomplish dl progress bars?

2005-05-27 Thread flamesrock
thanks! I didn't realize it was in the cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/168639 -- http://mail.python.org/mailman/listinfo/python-list

f->f_locals is NULL for a method call

2005-05-27 Thread Vijay Kumar
hi, I have written a trace function in C using the Python/C API. I want to find whether the call occured is a function call or method call and if a method call, its self object. int tracer(PyObject *obj, PyObject *f, int what, PyObject *args){ PyObject *item,*SelfItem; switch(what){ case PyTrace_

Re: Python/Excel AddIn (was:Re: Does Python have a Template::Extract equivalent from Perl's CPAN)

2005-05-27 Thread combinational.logic $ soc-ip.com
Thanks Paul! When I get a chance I'll mess around with Py + Excel as you have suggested . I was hoping not to have to deal with VBScript :) -- http://mail.python.org/mailman/listinfo/python-list

[ANN] XPN 0.4.6

2005-05-27 Thread Nemesis
XPN (X Python Newsreader XPN) is a multi-platform newsreader with Unicode support. It has features like scoring/actions, X-Face and Face decoding, muting of quoted text, newsrc import/export, find article and search in the body, spoiler char/rot13, random taglines, and configurable attribution line

Re: evaluated function defaults: stored where?

2005-05-27 Thread Jp Calderone
On Fri, 27 May 2005 21:07:56 GMT, David Isaac <[EMAIL PROTECTED]> wrote: >Alan Isaac wrote: >> Default parameter values are evaluated once when the function definition >is >> executed. Where are they stored? ... Where is this documented? > >Forgive any poor phrasing: I'm not a computer science type

Re: evaluated function defaults: stored where?

2005-05-27 Thread David Isaac
Alan Isaac wrote: > Default parameter values are evaluated once when the function definition is > executed. Where are they stored? ... Where is this documented? Forgive any poor phrasing: I'm not a computer science type. At http://www.network-theory.co.uk/docs/pytut/tut_26.html we read: "The execu

Re: Get number of lines in file

2005-05-27 Thread ssmith579
Thanks! I was trying len(cpn_version) and that didn't work. -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem: using signal.alarm() to stop a run-away os.system() command

2005-05-27 Thread mkent
Thanks, that's the kind of on-target info I needed. Now, shouldn't there be some kind of mention of this limitation in the docs? -- http://mail.python.org/mailman/listinfo/python-list

Re: [Twisted-Python] xmlrpc deferred

2005-05-27 Thread Jp Calderone
Err woops. Wrong list, sorry. Jp -- http://mail.python.org/mailman/listinfo/python-list

Re: [Twisted-Python] xmlrpc deferred

2005-05-27 Thread Jp Calderone
On Fri, 27 May 2005 22:28:06 +0300, Catalin Constantin <[EMAIL PROTECTED]> wrote: >Hi there, > >I have the following xmlrpc method: > >class FeederResource(xmlrpc.XMLRPC): >def __init__(self): >xmlrpc.XMLRPC.__init__(self) >self.feeder=Feeder() > >de

Re: Problem: using signal.alarm() to stop a run-away os.system() command

2005-05-27 Thread Jp Calderone
On 27 May 2005 12:09:39 -0700, [EMAIL PROTECTED] wrote: >I'm trying to use signal.alarm to stop a run-away os.system command. >Can anyone exlain the following behavior? > >Given following the trivial program: > >import os >import signal > >def timeoutHandler(signum, frame): >print "Timeout" >

[pysqlite] Equivalent for SHOW TABLES?

2005-05-27 Thread F. GEIGER
For now, the names of the tables, the app knows of, are added into an internal list, when the app is started. Then, when queries fail, the app knoes that it has to create them. It would be nice somehow to be able to ask the database what tables it contains. Is anyone doing this that way? How do yo

Re: Get number of lines in file

2005-05-27 Thread Elliot Temple
On May 27, 2005, at 12:17 PM, [EMAIL PROTECTED] wrote: > I have read in a file and need to get the number of lines. > > cpn_file = open('Central Part number list.txt') > cpn_version = cpn_file.read().split('\n') > > I want to know the number of elements in cpn_version. Could you use: co

[pysqlite 2.0.2] UnicodeDecodeError: 'utf8' codec can't decode bytes in position 44-45: invalid data

2005-05-27 Thread F. GEIGER
A fetchall() call causes the above error. There must be some non-utf8 chars in the table in question and - indeed - there very likely are: The table contains pathnames of files on the harddisk of a German "speaking" PC. What I have already done to try to overcome this is: - Inserted "# coding: iso

Re: regexp for sequence of quoted strings

2005-05-27 Thread gry
PyParsing rocks! Here's what I ended up with: def unpack_sql_array(s): import pyparsing as pp withquotes = pp.dblQuotedString.setParseAction(pp.removeQuotes) withoutquotes = pp.CharsNotIn('",') parser = pp.StringStart() + \ pp.Word('{').suppress() + \ pp.

Re: Case Sensitive, Multiline Comments

2005-05-27 Thread John Roth
"Elliot Temple" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > One other interesting thing about case sensitivity I don't think anyone > has mentioned: in Python keywords are all lowercase already (the way I > want to type them). In some other languages, they aren't... Not qui

Re: distutils, 'scripts' and Windows

2005-05-27 Thread John Roth
"George van den Driessche" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi folks, > > I'm looking at packaging a project I'm working on using distutils. The > project is for Windows and contains a COM server which needs registration, > so the installer needs to be a little more

Get number of lines in file

2005-05-27 Thread ssmith579
I have read in a file and need to get the number of lines. cpn_file = open('Central Part number list.txt') cpn_version = cpn_file.read().split('\n') I want to know the number of elements in cpn_version. -- http://mail.python.org/mailman/listinfo/python-list

Problem: using signal.alarm() to stop a run-away os.system() command

2005-05-27 Thread mkent
I'm trying to use signal.alarm to stop a run-away os.system command. Can anyone exlain the following behavior? Given following the trivial program: import os import signal def timeoutHandler(signum, frame): print "Timeout" raise ValueError signal.signal(signal.SIGALRM, timeoutHandler)

Re: lambda a plusieurs arguments

2005-05-27 Thread Sébastien Boisgérault
Nico, [EMAIL PROTECTED] seems to be a good place to post questions related to Python if you intend to use french. -> http://www.aful.org/wws/arc/python/ (( des questions rédigées en français sont plus à leur place sur des liste de diffusions nationales ... )) Regards, SB -- http:

Determine if windows drive letter is hard drive or optical from python?

2005-05-27 Thread mh
Hi Folks- I'm trying to do a simple emulation of unix "locate" functionality in python for windows. Problem is I don't want to crawl/index optical drives. Do any of the windows people out there know how I can determine: 1. How many drives are on the system? (I could just iterate over the alpha

Re: What are OOP's Jargons and Complexities?

2005-05-27 Thread James Stroud
On Friday 27 May 2005 02:15 am, Piet van Oostrum wrote: > > "Xah Lee" <[EMAIL PROTECTED]> (XL) wrote: > > > >XL> Joe: lang x is strongly typed > >XL> Dave: you mean statically typed? > >XL> John: no no, that's weakly typed. > > That should have been `weekly typed', according to the link below.

Python/Excel AddIn (was:Re: Does Python have a Template::Extract equivalent from Perl's CPAN)

2005-05-27 Thread Paul McNett
Please start a new thread when appropriate. combinational.logic $ soc-ip.com wrote: > Can you please elaborate on how to use Python for MS Excel AddIn > development? Is this easy to do? I would love to be able to create > custom extensions to Excel using python! IMHO Python is much better > than

distutils, 'scripts' and Windows

2005-05-27 Thread George van den Driessche
Hi folks, I'm looking at packaging a project I'm working on using distutils. The project is for Windows and contains a COM server which needs registration, so the installer needs to be a little more complicated than usual. Looking at the options for the bdist_wininst command to distutils, I se

Re: lambda a plusieurs arguments

2005-05-27 Thread Jp Calderone
On Fri, 27 May 2005 19:38:33 +0200, nico <[EMAIL PROTECTED]> wrote: >Bonjour, > >Comment faire une fonction lambda a plusieurs arguments ? > (lambda a:a+1)(2) >3 f=(lambda (a,b):a+b) f(5,6) >Traceback (most recent call last): > File "", line 1, in ? >TypeError: () takes exactly 1 ar

Re: Does Python have a Template::Extract equivalent from Perl's CPAN

2005-05-27 Thread combinational.logic $ soc-ip.com
Can you please elaborate on how to use Python for MS Excel AddIn development? Is this easy to do? I would love to be able to create custom extensions to Excel using python! IMHO Python is much better than Perl due to its OOP features. Cheers, CL -- http://mail.python.org/mailman/listinfo/py

Re: Does Python have a Template::Extract equivalent from Perl's CPAN

2005-05-27 Thread [EMAIL PROTECTED]
should have read, "if nobody is aware of any module..." not "if nobody is not aware...". -- http://mail.python.org/mailman/listinfo/python-list

Does Python have a Template::Extract equivalent from Perl's CPAN

2005-05-27 Thread [EMAIL PROTECTED]
Hi All, I already searched this newsgroup and google groups to see if I could find a Python equivalent to Perl's Template::Extract, but didn't find anything leading to a Python module that had similar functionality. I am a big fan of Python as an OO language and use it for many system admin utili

Re: Strings for a newbie

2005-05-27 Thread Steve Holden
Malcolm Wooden wrote: > Yes Sergei, as 3 of the lines are Dim statements, the real code is just 4 > lines, a totally logical. It's not the amout of code thats a probelm, it's > following the logic and structure thats important. As I said Python.. UGH! > > Malcolm > Yes, the weirdest thing about

lambda a plusieurs arguments

2005-05-27 Thread nico
Bonjour, Comment faire une fonction lambda a plusieurs arguments ? >>> (lambda a:a+1)(2) 3 >>> f=(lambda (a,b):a+b) >>> f(5,6) Traceback (most recent call last): File "", line 1, in ? TypeError: () takes exactly 1 argument (2 given) >>> f((5.6)) Traceback (most recent call last): File "", lin

Inheritance, polymorphism, and introspection in Python

2005-05-27 Thread combinational.logic $ soc-ip.com
The following website (http://www.soc-ip.com/weblog) has an example of inheritance, polymorphism, and introspection in Python. The example shows a simple classification system for microprocessors. Hopefully someone will find this interesting / useful. -- http://mail.python.org/mailman/listinfo/

Re: python24.zip

2005-05-27 Thread Steve Holden
Martin v. Löwis wrote: > Scott David Daniels wrote: > Is the interpreter unable to call "C" functions ("stat" for example) to determine whether an object exists before it puts it on "path". >>> >>> >>>What do you mean, "unable to"? It just doesn't. >> >>In fact, the interpreter doesn't nec

Re: Case Sensitive, Multiline Comments

2005-05-27 Thread Elliot Temple
One other interesting thing about case sensitivity I don't think anyone has mentioned: in Python keywords are all lowercase already (the way I want to type them). In some other languages, they aren't... -- Elliot Temple http://www.curi.us/ --- [This E-mail scanned for viruses by Declude Vir

Re: python24.zip

2005-05-27 Thread Steve Holden
Dieter Maurer wrote: > Steve Holden <[EMAIL PROTECTED]> writes on Sun, 22 May 2005 16:19:10 -0400: > >>... >>Indeed I have written PEP 302-based code to import from a relational >>database, but I still don't believe there's any satisfactory way to >>have [such a hooked import mechanism] be a first

Re: CygWin ODBC

2005-05-27 Thread Simon Faulkner
Steve Holden wrote: > Simon Faulkner wrote: > >> Hi All, >> >> I am new to Cygwin and am hoping that someone here will be able to >> tell me how to get ODBC running in Python on Cygwin. >> >> Maximum gratefullness... >> >> >> Simon > > > There's a trick to this which involves recompiling from s

Re: cpu usage limit

2005-05-27 Thread Grant Edwards
On 2005-05-27, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >>> How can I make sure that a Python process does not use more that 30% of >>> the CPU at any time. I only want that the process never uses more, but >>> I don't want the process being killed when it reaches the limit (like >>> it can be

Re: cpu usage limit

2005-05-27 Thread rbt
[EMAIL PROTECTED] wrote: > rbt <[EMAIL PROTECTED]> wrote: > >>mf wrote: >> >>>Hi. >>> >>>My problem: >>>How can I make sure that a Python process does not use more that 30% of >>>the CPU at any time. I only want that the process never uses more, but >>>I don't want the process being killed when it

Re: cpu usage limit

2005-05-27 Thread Markus Franz
> Are you looping during a cpu intensive task? If so, make it sleep a bit > like this: > > for x in cpu_task: > time.sleep(0.5) > do(x) No, I don't use an intensive loop. I have about 1200 lines of code inside a process - is there nothing like xyz.setlimit(xyz.cpu, 0.30) ??? Thank. M

Re: Incrementing letters

2005-05-27 Thread Rocco Moretti
Dan Sommers wrote: > On Fri, 27 May 2005 16:10:32 +0200, > Wolfram Kraus <[EMAIL PROTECTED]> wrote: > > >>Duncan Booth wrote: > > >>import string >>upone = string.maketrans( >>> >>>'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', >>>'bcdefghijklmnopqrstuvwxyzaBCDEFGHIJKLMNOPQRSTU

Re: cpu usage limit

2005-05-27 Thread garabik-news-2005-05
rbt <[EMAIL PROTECTED]> wrote: > > mf wrote: >> Hi. >> >> My problem: >> How can I make sure that a Python process does not use more that 30% of >> the CPU at any time. I only want that the process never uses more, but >> I don't want the process being killed when it reaches the limit (like >> it

Re: Intellisense and the psychology of typing

2005-05-27 Thread Brian Beck
Well, there are two distinct features of IntelliSense as you know it. One is auto-completion and the other is contextual help. Auto-completion is included almost all beefy Python IDE's. Contextual help is included even in IDLE, where if you begin typing a function call, its docstring pops up arou

Re: Case Sensitive, Multiline Comments

2005-05-27 Thread Duncan Booth
John Roth wrote: > Doing case translations in Unicode following all of > the rules for all of the world's languages is, for want of a better > world, a real bitch. > Fair point, although that is true for anything, not just case translations. Fortunately, unlike Ecmascript, Python doesn't allow

Re: CygWin ODBC

2005-05-27 Thread Steve Holden
Simon Faulkner wrote: > Hi All, > > I am new to Cygwin and am hoping that someone here will be able to tell > me how to get ODBC running in Python on Cygwin. > > Maximum gratefullness... > > > Simon There's a trick to this which involves recompiling from source. If you aren't experienced wit

Re: Incrementing letters

2005-05-27 Thread Duncan Booth
Dan Sommers wrote: > Wolfram Kraus <[EMAIL PROTECTED]> wrote: > >> Duncan Booth wrote: > >> import string >> upone = string.maketrans( >>> 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', >>> 'bcdefghijklmnopqrstuvwxyzaBCDEFGHIJKLMNOPQRSTUVWXYZA') >>> >> string.translate("I'v

passing C++ parameters to a function

2005-05-27 Thread Stormbringer
Greetings, I was trying to use pyopengl - which is imported into python using SWIG - when I stumbled upon the following function with the C++ definition: void glShaderSourceARB(GLhangleARB shader, GLuint number_strings, const GLcharARB** strings, Glint * length); this is imported inside pyopengl

Re: cpu usage limit

2005-05-27 Thread rbt
mf wrote: > Hi. > > My problem: > How can I make sure that a Python process does not use more that 30% of > the CPU at any time. I only want that the process never uses more, but > I don't want the process being killed when it reaches the limit (like > it can be done with resource module). > > C

cpu usage limit

2005-05-27 Thread mmf
Hi. My problem: How can I make sure that a Python process does not use more that 30% of the CPU at any time. I only want that the process never uses more, but I don't want the process being killed when it reaches the limit (like it can be done with resource module). Can you help me? Thanks in ad

Re: Incrementing letters

2005-05-27 Thread Dan Sommers
On Fri, 27 May 2005 16:10:32 +0200, Wolfram Kraus <[EMAIL PROTECTED]> wrote: > Duncan Booth wrote: > import string > upone = string.maketrans( >> 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', >> 'bcdefghijklmnopqrstuvwxyzaBCDEFGHIJKLMNOPQRSTUVWXYZA') >> > string.translate("

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Grant Edwards
On 2005-05-27, Peter Hansen <[EMAIL PROTECTED]> wrote: > Roy Smith wrote: >> gabor <[EMAIL PROTECTED]> wrote: >> On the other hand, you said that each process will be writing a single line >> of output at a time. If you call flush() after each message is written, >> that should be enough to ensu

Re: Incrementing letters

2005-05-27 Thread Simon Brunning
On 5/27/05, Michael <[EMAIL PROTECTED]> wrote: > Hi, > I've got a string s, and i want to shift all the letters up by one, eg a->b, > b->c z->a > In c++ i can do this quite simply with > > if(C == 'z') C='a'; > else C++; > > but i can't work out how to do this this in python?? Here's on

Re: Case Sensitive, Multiline Comments

2005-05-27 Thread John Roth
"Duncan Booth" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Dennis Lee Bieber wrote: > >> On 26 May 2005 17:33:33 -0700, "Elliot Temple" <[EMAIL PROTECTED]> >> declaimed the following in comp.lang.python: >> >>> Thanks for the link on case sensitivity. I'm curious about the perso

Re: python24.zip

2005-05-27 Thread Dieter Maurer
Scott David Daniels <[EMAIL PROTECTED]> writes on Wed, 25 May 2005 07:10:00 -0700: > ... > I'll bet this means that the 'zope.zip', 'python24.zip' would drop > you to "about 12500 - 1 = 2500" failing opens. That should be > an easy test: sys.path.insert(0, 'zope.zip') or whatever. > If that w

Re: python24.zip

2005-05-27 Thread Dieter Maurer
"Martin v. Löwis" <[EMAIL PROTECTED]> writes on Tue, 24 May 2005 23:58:03 +0200: > ... 10.000 failing opens -- a cause for significant IO during startup ? ... > So I would agree that IO makes a significant part of startup, but > I doubt it is directory reading (unless perhaps you have an > absent

Re: Is Python suitable for a huge, enterprise size app?

2005-05-27 Thread Dieter Maurer
"Fredrik Lundh" <[EMAIL PROTECTED]> writes on Tue, 24 May 2005 22:38:05 +0200: > ... > nothing guarantees that, of course. but I've never seen that > happen. and I'm basing my comments on observed behaviour in > real systems, not on theoretical worst-case scenarios. I observed in real systems (Zo

Re: Strings for a newbie

2005-05-27 Thread bruno modulix
Malcolm Wooden wrote: (top post corrected) > > "John Machin" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Malcolm Wooden wrote: >> (snip useless rant) >>> >>>I want to put a sentence of words into an array, eg "This is a sentence >>>of words" >>> >>>In RB it would be simple

Re: Strings for a newbie

2005-05-27 Thread bruno modulix
Malcolm Wooden wrote: > I'm trying to get my head around Python but seem to be failing miserably. I > use RealBasic on a Mac and find it an absolute dream! But PythonUGH! Strange enough, Rb was one of my first languages, and last time I played with it, I founhd it was close to a nightmare whe

Re: a html parse problem

2005-05-27 Thread bruno modulix
cheng wrote: > hi,all > > if the html like: > > > > if i use: > def handle_starttag(self, tag, attrs): > if tag == 'meta': >self.attr = attrs > self.headers += ['%s' % (self.attr)] > self.attr = '' > will get the output: > [('name', 'description'), (

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Jp Calderone
On 27 May 2005 06:43:04 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: >Jp Calderone <[EMAIL PROTECTED]> writes: >> >But they haven't. They depend on messy things like server processes >> >constantly running, which goes against the idea of a cgi that only >> >runs when someone calls it

Re: Incrementing letters

2005-05-27 Thread Wolfram Kraus
Duncan Booth wrote: > Michael wrote: > > >>Hi, >>I've got a string s, and i want to shift all the letters up by one, eg >>a->b, b->c z->a >>In c++ i can do this quite simply with >> >>if(C == 'z') C='a'; >>else C++; >> >>but i can't work out how to do this this in python?? > > impo

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread jean-marc
Sorry, why is the temp file solution 'stupid'?, (not aesthetic-pythonistic???) - it looks OK: simple and direct, and certainly less 'heavy' than any db stuff (even embedded) And collating in a 'official log file' can be done periodically by another process, on a time-scale that is 'useful' if no

Re: Strings for a newbie

2005-05-27 Thread Kalle Anka
Malcolm Wooden dtptypes.com> writes: > I want to put a sentence of words into an array, eg "This is a sentence of > words" > > In RB it would be simple: > > Dim s as string > Dim a(-1) as string > Dim i as integer > > s = "This is a sentence of words" > For i = 1 to CountFields(s," ") > a.a

Re: Case Sensitive, Multiline Comments

2005-05-27 Thread Brian van den Broek
Duncan Booth said unto the world upon 2005-05-27 04:24: > There are arguments that, especially for beginners, case sensitivity > introduces an extra level of complexity, but the cost of losing this > complexity would be to make Python a poor relation amongst programming > languages. Well, t

Re: write to the same file from multiple processes at the same time?

2005-05-27 Thread Gerhard Haering
On Fri, May 27, 2005 at 09:27:38AM -0400, Roy Smith wrote: > Peter Hansen <[EMAIL PROTECTED]> wrote: > > The OP was probably on the right track when he suggested that things > > like SQLite (conveniently wrapped with PySQLite) had already solved this > > problem. > > Perhaps, but a relational da

  1   2   >