Re: Injecting code into a function

2005-04-26 Thread Kay Schluehr
George Sakkis wrote: > > Oh, I overlooked this. Then the solution becomes simple: > > > >sys._getframe().f_trace > > > > Test: > > > > >>> an = Analyzer() > > >>> sys.settrace(an.trace_returns) > > >>> sys._getframe().f_trace > > at > > 0x010015D0>> > > Does this work for you non-interactivel

Re: Injecting code into a function

2005-04-26 Thread Kay Schluehr
George Sakkis wrote: > That's all good, at least if I knew how to poke with bytecodes ;-) > What's a good starting point to look at ? http://sourceforge.net/projects/bytecodehacks/ http://bytecodehacks.sourceforge.net/bch-docs/bch/ For more recent development this ANN of Christian Tismer is imp

Re: What's do list comprehensions do that generator expressions don't?

2005-04-26 Thread Mike Meyer
[EMAIL PROTECTED] (Bengt Richter) writes: > On Mon, 25 Apr 2005 16:48:46 -0400, Bill Mill <[EMAIL PROTECTED]> wrote: >>+1 . I think that we should still have the form [genexp] , but without >>the dangling variable, and implemented with generator expressions. It >>seems to me that it is inconsisten

Simple, elegant, pythonic solution for switch statement

2005-04-26 Thread python_only
Check it out! Readable switch construction without lambdas or dictionaries: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410692 -- http://mail.python.org/mailman/listinfo/python-list

Re: bytecode non-backcompatibility

2005-04-26 Thread Mike Meyer
Maurice LING <[EMAIL PROTECTED]> writes: > I find this part of the story a nuisance, C components in 3rd party > modules... What are the C components compiled into? What are actually > "so" files? Shared object files. They're executable code that can be linked into a program at runtime. Like DLL'

Re: Quote-aware string splitting

2005-04-26 Thread Bengt Richter
On Mon, 25 Apr 2005 19:40:44 -0700, Jeffrey Froman <[EMAIL PROTECTED]> wrote: >J. W. McCall wrote: > >> For example, given the string: >> >> 'spam "the life of brian" 42' >> >> I'd want it to return: >> >> ['spam', 'the life of brian', '42'] > >The .split() method of strings can take a substrin

Re: (PHP or Python) Developing something like www.tribe.net

2005-04-26 Thread Dave Benjamin
In article <[EMAIL PROTECTED]>, Mir Nazim wrote: > I agree Zope2/Plone are really mature. But I think you missed my point. > It is not neccessary that I may be using all the functionality of Plone > etc. More over zope3 seems to have got a few great features like better > support for building files

Problem with embedded python

2005-04-26 Thread ugodiggi
I have the following code, that seems to make sense to me. However, it crashes about 1/3 of the times. My platform is Python 2.4.1 on WXP (I tried the release version from the msi and the debug version built by me, both downloaded today to have the latest version). The crash happens while the ma

Re: Python or PHP?

2005-04-26 Thread Mike Meyer
John Bokma <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: > >> John Bokma <[EMAIL PROTECTED]> writes: >>> You already showed code like: >> Actually, I never showed you this code. > hence *like*, and yes you did, in a footnote. Yes, but *I* didn't say like, because I wanted to point out that you

Re: Python or PHP?

2005-04-26 Thread Axel
Jeremy Bowers <[EMAIL PROTECTED]> wrote: > Nobody ever changed their mind as a result of a 20-thread endless > reply-fest. As usual, the posters aren't about to admit anything, and none > of the bystanders are reading any more. Well I am reading... always interested to learn. Axel -- http://

Re: create python process

2005-04-26 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Hello, > > I would like to create python processes instead of thread. > Can anyone give me an example or site which shows a tutorial about how > to create processes ? See the os.fork documentation. http://www.mired.org/home/

Re: bytecode non-backcompatibility

2005-04-26 Thread Maurice LING
All you have to do is convince the developers to declare the set of bytecodes fixed, and they'd be stable. I don't think that will be easy, as it removes one of the methods used to improve the performance of Python. Since rebuilding the bytecode files is trivial (just invoke compileall.py in the l

Re: (PHP or Python) Developing something like www.tribe.net

2005-04-26 Thread Michele Simionato
Mir Nazim: > IMHO Zope3/Quixote seem to be the obvious choice here. > Though > functionality is not available on them but i think time > spent now will > be gained by gains in better design and maintainable code base. Well, you are comparing two frameworks that are just completely different. I s

Re: Python documentation moronicities (continued)

2005-04-26 Thread Claudio Grondi
Conclusion: --- I agree with Bill Mill saying "I'd suggest that he [Xah Lee] actually make an effort at improving the docs before submitting them." so I am still waiting for the final version before deciding which docu is better, believing, that if Xah Lee puts more work and serious eff

Re: what is the best way to determine system OS?

2005-04-26 Thread Roel Schroeven
googleboy wrote: What this script does is use take the output of vmstat to report idle cpu cycles (or memory stuff, etc.) over a period specified by a parameter, all the better to be a plugin for a monitoring service. Basically it parses the output of the command, runs through a whole bunch of re

Re: create python process

2005-04-26 Thread [EMAIL PROTECTED]
I use windows and os.fork is not working in windows. Can we create process inside python I mean I have function and I want to run it as a process not a thread ? Should I run code from os. in order to run a processes? Sincerely Yours, pujo -- http://mail.python.org/mailman/listinfo/python-list

Re: Python or PHP?

2005-04-26 Thread John Bokma
Leif K-Brooks wrote: > Mage wrote: >> However one of the worst cases is the sql injection attack. And sql >> injections must be handled neither by php nor by python but by the >> programmer. > > But Python's DB-API (the standard way to connect to an SQL database > from Python) makes escaping SQL

Re: Python or PHP?

2005-04-26 Thread John Bokma
Mike Meyer wrote: > "Simon John" <[EMAIL PROTECTED]> writes: > >> I still love Perl, it's a bit of an art form, as "there's more than >> one way to do it", whereas Python usually only allows one way to do >> it, which may or may not be a better mantra > > The Python mantra leads to 1) less p

Re: Python or PHP?

2005-04-26 Thread John Bokma
Leif K-Brooks wrote: > John Bokma wrote: >> Not. Perl and Java use similar methods where one can specify place >> holders, and pass on the data unescaped. But still injection is >> possible. > > How? my $sort = $cgi->param( "sort" ); my $query = "SELECT * FROM table WHERE id=? ORDER BY $sort";

Re: Python or PHP?

2005-04-26 Thread John Bokma
Leif K-Brooks wrote: > John Bokma wrote: >> my $sort = $cgi->param( "sort" ); >> my $query = "SELECT * FROM table WHERE id=? ORDER BY $sort"; > > And the equivalent Python code: > > cursor.execute('SELECT * FROM table WHERE id=%%s ORDER BY %s' % sort, > [some_id]) > > You're right, of course,

Re: Python or PHP?

2005-04-26 Thread John Bokma
Peter Ammon wrote: > Leif K-Brooks wrote: >> John Bokma wrote: >> >>> my $sort = $cgi->param( "sort" ); >>> my $query = "SELECT * FROM table WHERE id=? ORDER BY $sort"; >> >> >> And the equivalent Python code: >> >> >> cursor.execute('SELECT * FROM table WHERE id=%%s ORDER BY %s' % sort, >> [

Re: Python or PHP?

2005-04-26 Thread John Bokma
Leif K-Brooks wrote: > Peter Ammon wrote: >> I'm bewildered why you haven't mentioned magic quotes. A one line >> change to the configuration file can render your PHP site almost >> entirely immune to SQL injection attacks. > > PHP's magic quotes is one of the most poorly-designed features I c

Re: Python or PHP?

2005-04-26 Thread John Bokma
Mike Meyer wrote: > John Bokma <[EMAIL PROTECTED]> writes: > >> Mike Meyer wrote: >> >>> "Simon John" <[EMAIL PROTECTED]> writes: >>> I still love Perl, it's a bit of an art form, as "there's more than one way to do it", whereas Python usually only allows one way to do it, which m

Re: Python or PHP?

2005-04-26 Thread John Bokma
Mike Meyer wrote: > John Bokma <[EMAIL PROTECTED]> writes: > >> Mike Meyer wrote: >> >>> John Bokma <[EMAIL PROTECTED]> writes: >>> Mike Meyer wrote: > "Simon John" <[EMAIL PROTECTED]> writes: > >> I still love Perl, it's a bit of an art form, as "there's more >> than

Re: Python or PHP?

2005-04-26 Thread John Bokma
Mike Meyer wrote: > John Bokma <[EMAIL PROTECTED]> writes: > >> Mike Meyer wrote: >>> Depends on the problem. If it's one of the things for which Python >>> has an obvious solution (sort a list; split a string on whitespace; >>> pull select list elements based on a criteria of some kind; search a

Re: Getting into Python, comming from Perl.

2005-04-26 Thread John Bokma
Miguel Manso wrote: > What I would like to know is if anyone had these problems and if you can > share that experience with me. I'm trying to minimize my "frustration" :) Read the Python tutorial, front to back, 2 times. Next, read Dive into Python (free e-book) front to back, 2 times, make not

Re: Python or PHP?

2005-04-26 Thread John Bokma
Ville Vainio wrote: >> "John" == John Bokma <[EMAIL PROTECTED]> writes: > > >> Nah, they aren't slow. They just have to worry about more > >> things than the Python developers. > > John> Do you have references to this? I would love to see if > John> indeed 100 Python programm

Re: Python or PHP?

2005-04-26 Thread John Bokma
Mike Meyer wrote: > John Bokma <[EMAIL PROTECTED]> writes: > >> Mike Meyer wrote: >>> John Bokma <[EMAIL PROTECTED]> writes: Mike Meyer wrote: > Depends on the problem. If it's one of the things for which Python > has an obvious solution (sort a list; split a string on > whitespa

Re: regex over files

2005-04-26 Thread Richard Brodie
"Robin Becker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Gerald Klix wrote: > > Map the file into RAM by using the mmap module. > > The file's contents than is availabel as a seachable string. > > > > that's a good idea, but I wonder if it actually saves on memory? I just tried

Re: Changing a line in a text file

2005-04-26 Thread Simon Brunning
On 4/25/05, Kirk Job Sluder <[EMAIL PROTECTED]> wrote: > In addition, I would argue that editing a file in place using a > non-interactive program is dangerous and bad practice in general. By > the time you find a bug in your edit script, the original is lost. This > is something I learned from b

Re: Python documentation moronicities (continued)

2005-04-26 Thread Richie Hindle
[Xah] > I have produced my doc. > ( http://xahlee.org/perl-python/python_re-write/lib/module-re.html ) > > isn't there a hundred dollars due to me? I don't have the time to write a full review of your version, but for the record I've compared it with the original and I don't think it's a signifi

Re: regex over files

2005-04-26 Thread Robin Becker
Richard Brodie wrote: "Robin Becker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Gerald Klix wrote: Map the file into RAM by using the mmap module. The file's contents than is availabel as a seachable string. that's a good idea, but I wonder if it actually saves on memory? I just t

c++ÈçºÎÏòpythonµÄ½Å±¾´«µÝÒ»¸öÀà×÷Ϊ²ÎÊý¡£

2005-04-26 Thread zghelp
ʹÓõ½ÁËboost.python Ö÷³ÌÐòÈçÏ£º using namespace boost::python; struct World { void set(std::string msg) { this->msg = msg; } std::string greet() { return msg; } std::string msg; }; BOOST_PYTHON_MODULE(hello) { class_("World") .def("greet", &World::greet) .def("set", &World::set) ; }

Re: Python, Perl & PDF files

2005-04-26 Thread TZOTZIOY
On Mon, 25 Apr 2005 13:00:51 -0400, rumours say that Peter Hansen <[EMAIL PROTECTED]> might have written: >Peter Hansen wrote: >> Dennis Lee Bieber wrote: >>> On Mon, 25 Apr 2005 17:24:36 +0300, Christos "TZOTZIOY" Georgiou: I don't know any related myth of anglo-saxon origin to quote. >>>

Howto debug c++ (SWIG) extension under Windows

2005-04-26 Thread Alexander Eisenhuth
Hi alltogether, I use ActivePython 2.4.1 , also the debug part from http://ftp.activestate.com/ActivePython/etc/ and VC 6.0 unter Windows XP. I can't figure out howto debug my c++ extension. If i compile it as release version, I've of course no chance to set a breakpoint. If I compile as debug

Re: Python, Perl & PDF files

2005-04-26 Thread TZOTZIOY
On Tue, 26 Apr 2005 11:58:29 +0300, rumours say that Christos "TZOTZIOY" Georgiou <[EMAIL PROTECTED]> might have written: >http://www.mythfolklore.net/aesopica/oxford/480.htm BTW, does anyone see the connection between: > we should make every possible effort on our own behalf > and only then ask

How to pass a arg of object to python's script in a c++ program?

2005-04-26 Thread zghelp
/*I am sorry the prev post is a mistake...*/ //the c++ code using namespace boost::python; struct World { void set(std::string msg) { this->msg = msg; } std::string greet() { return msg; } std::string msg; }; BOOST_PYTHON_MODULE(hello) { class_("World") .def("greet", &World::greet) .def

Re: Injecting code into a function

2005-04-26 Thread Bengt Richter
On 25 Apr 2005 23:31:29 -0700, "George Sakkis" <[EMAIL PROTECTED]> wrote: >> I'm not clear on what your real goal is, but if you just want a >snapshot >> of what locals() is just before exiting func, that could be done with >> a byte-code-hacking decorator with usage looking something like >> >>

kdialog and unicode

2005-04-26 Thread Dumbkiwi
I'm trying to get python, unicode and kdialog to play nicely together. This is a linux machine, and kdialog is a way to generate dialog boxes in kde with which users can interact (for example input text), and you can use the outputted text in your script. Anyway, what I'm doing is reading from a u

Re: Order of elements in a dict

2005-04-26 Thread Peter Otten
Marcio Rosa da Silva wrote: > In other words, it is safe to do: > > >>> dd = dict(zip(d.values(),d.keys())) Yes, if the dictionary isn't modified between the invocation of values() and keys(). Quoting http://docs.python.org/lib/typesmapping.html """ Keys and values are listed in an arbitrary o

Re: Order of elements in a dict

2005-04-26 Thread Duncan Booth
Marcio Rosa da Silva wrote: > In other words, it is safe to do: > > >>> dd = dict(zip(d.values(),d.keys())) > > to exchange keys and values on a dictionary? See the Library Reference, section 2.3.8 Mapping Types: > Keys and values are listed in an arbitrary order which is non-random, > varies

Re: Order of elements in a dict

2005-04-26 Thread Fredrik Lundh
Marcio Rosa da Silva wrote: > In dictionaries, unlinke lists, it doesn't matter the order one inserts the > contents, elements are > stored using its own rules. > > Ex: > > >>> d = {3: 4, 1: 2} > >>> d > {1: 2, 3: 4} > > So, my question is: if I use keys() and values() it will give me the keys a

Re: Simple, elegant, pythonic solution for switch statement

2005-04-26 Thread bruno modulix
python_only wrote: Check it out! Readable switch construction without lambdas or dictionaries: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/410692 Not sure I'll have a need for it, but, yes, nice job !-) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::-1] for w in p.split

Re: Order of elements in a dict

2005-04-26 Thread Marcio Rosa da Silva
Thanks for the help! Marcio -- http://mail.python.org/mailman/listinfo/python-list

Re: kdialog and unicode

2005-04-26 Thread Peter Otten
Dumbkiwi wrote: > I'm trying to get python, unicode and kdialog to play nicely together. > This is a linux machine, and kdialog is a way to generate dialog boxes in > kde with which users can interact (for example input text), and you can > use the outputted text in your script. > > Anyway, what

Re: bytecode non-backcompatibility

2005-04-26 Thread Steve Holden
Maurice LING wrote: All you have to do is convince the developers to declare the set of bytecodes fixed, and they'd be stable. I don't think that will be easy, as it removes one of the methods used to improve the performance of Python. Since rebuilding the bytecode files is trivial (just invoke co

Re: Order of elements in a dict

2005-04-26 Thread Leif K-Brooks
Marcio Rosa da Silva wrote: So, my question is: if I use keys() and values() it will give me the keys and values in the same order? It should work fine with the current implementation of dictionaries, but (AFAIK) it's not guaranteed to work by the mapping protocol. So theoretically, it could bre

Re: Order of elements in a dict

2005-04-26 Thread Paul McGuire
Here is a brute-force list comprehension that does not depend on preserving order between dict.keys() and dict.values(): dict( [ (a[1],a[0]) for a in d.items() ] ) Or for map/lambda lovers: rev = lambda a: (a[1],a[0]) dict( map( rev, d.items() ) But you still have no control over the order retu

Re: Quote-aware string splitting

2005-04-26 Thread Paul McGuire
Quoted strings are surprisingly stateful, so that using a parser isn't totally out of line. Here is a pyparsing example with some added test cases. Pyparsing's quotedString built-in handles single or double quotes (if you don't want to be this permissive, there are also sglQuotedString and dblQuo

Re: bytecode non-backcompatibility

2005-04-26 Thread Mike Meyer
Maurice LING <[EMAIL PROTECTED]> writes: >> All you have to do is convince the developers to declare the set of >> bytecodes fixed, and they'd be stable. I don't think that will be >> easy, as it removes one of the methods used to improve the performance >> of Python. Since rebuilding the bytecode

Re: Do I need a nested lambda to do this?

2005-04-26 Thread Kent Johnson
raoul wrote: I can't figure this one out. Trying to be unnecessarily functional I suspect. I have the following lists. vals = [1.000,2.344,4.2342] tab = [((0,1),(0,3),(0,4)), ((2,2),(3,0),(3,9)), ((3,4),(6,3),(7,1))] I'm trying to create a one liner using map/reduce/lambda/zip(* etc t

delete will assure file is deleted?

2005-04-26 Thread [EMAIL PROTECTED]
Hello, If I use os.remove(fileName), does it always assure that the code will move to the next code only if the fileName is deleted completely? Pujo -- http://mail.python.org/mailman/listinfo/python-list

Re: what is the best way to determine system OS?

2005-04-26 Thread Mike Meyer
Roel Schroeven <[EMAIL PROTECTED]> writes: > googleboy wrote: > >> What this script does is use take the output of vmstat to report idle >> cpu cycles (or memory stuff, etc.) over a period specified by a >> parameter, all the better to be a plugin for a monitoring service. >> Basically it parses

Re: regex over files

2005-04-26 Thread Steve Holden
Robin Becker wrote: Richard Brodie wrote: "Robin Becker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Gerald Klix wrote: Map the file into RAM by using the mmap module. The file's contents than is availabel as a seachable string. that's a good idea, but I wonder if it actually saves

pstats: negative time values

2005-04-26 Thread Tom Mortimer
Hi, A quick question - can anyone tell me how to interpret negative time values in pstats.Stats.print_stats() output? Eg - 39052965 function calls (38035317 primitive calls) in -250.959 CPU seconds Ordered by: internal time List reduced from 202 to 20 due to restriction <20> ncall

Re: kdialog and unicode

2005-04-26 Thread Dumbkiwi
On Tue, 26 Apr 2005 11:41:01 +0200, Peter Otten wrote: > Dumbkiwi wrote: > >> I'm trying to get python, unicode and kdialog to play nicely together. >> This is a linux machine, and kdialog is a way to generate dialog boxes >> in kde with which users can interact (for example input text), and you

Order of elements in a dict

2005-04-26 Thread Marcio Rosa da Silva
Hi! In dictionaries, unlinke lists, it doesn't matter the order one inserts the contents, elements are stored using its own rules. Ex: >>> d = {3: 4, 1: 2} >>> d {1: 2, 3: 4} So, my question is: if I use keys() and values() it will give me the keys and values in the same order? In other words,

Re: delete will assure file is deleted?

2005-04-26 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Hello, > > If I use os.remove(fileName), does it always assure that the code will > move to the next code only if the fileName is deleted completely? Hmm. The documdentation doesn't say. A quick test on FreeBSD shows that if you don't have permiss

from comp.ai.vision - beside C also Python code included

2005-04-26 Thread Claudio Grondi
From: Thomas Deselaers <[EMAIL PROTECTED]> Subject: Q&A : FIRE (Flexible Image Retrieval Engine) sources available FIRE is an extensible image retrieval engine that was developed to investigate the impact of different features for content-based image retrieval. The system was used in the 2004

Re: Python, Perl & PDF files

2005-04-26 Thread davidb
Robin Becker wrote: > rbt wrote: > .. > > > > I just want to read PDF files in a portable way (windows, linux, mac) > > from within Python. > > > .. > > I suppose you mean extract PDF pages and do something with them. > http://www.reportlab.com does have a tool that handles that in > Python

Re: Order of elements in a dict

2005-04-26 Thread Steve Holden
Marcio Rosa da Silva wrote: Hi! In dictionaries, unlinke lists, it doesn't matter the order one inserts the contents, elements are stored using its own rules. Ex: >>> d = {3: 4, 1: 2} >>> d {1: 2, 3: 4} So, my question is: if I use keys() and values() it will give me the keys and values in the

Re: delete will assure file is deleted?

2005-04-26 Thread [EMAIL PROTECTED]
Hello Mike, I have to know this topic otherwise my program has to check whether the file / files are already deleted and this is a little bit messy. Pujo -- http://mail.python.org/mailman/listinfo/python-list

Re: Python documentation moronicities (continued)

2005-04-26 Thread Mike Meyer
"Claudio Grondi" <[EMAIL PROTECTED]> writes: > From my point of view both, the existing and > the proposed documentation assume some > knowledge about regular expressions as > such, so doesn't really explain, beeing > limited to showing the syntax of usage. It's not clear that this belongs in the

Re: delete will assure file is deleted?

2005-04-26 Thread Maciej Dziardziel
[EMAIL PROTECTED] wrote: > Hello, > > If I use os.remove(fileName), does it always assure that the code will > move to the next code only if the fileName is deleted completely? Yes, it will be deleted, but not necessary completly. Deleting isn't equal to erasing file's content, so it might be po

Interrupting execution of PyRun_SimpleScript()

2005-04-26 Thread stephan
Hi, Im am using PyRun_SimpleString() inside a BCB 5.0 GUI app on win32. All works fine. The PyRun_SimpleStript() runs a piece of python code which calls often a callback function to refresh my gui App so my Form still can react to user input. Now, I would like to implement a possibility to inte

Re: regex over files

2005-04-26 Thread Robin Becker
Steve Holden wrote: .. I seem to remember that the Medusa code contains a fairly good overlapped search for a terminator string, if you want to chunk the file. Take a look at the handle_read() method of class async_chat in the standard library's asynchat.py. . thanks I'll give it a whirl

Re: bytecode non-backcompatibility

2005-04-26 Thread Maurice LING
2. The current compilation scheme (compiling to bytecode as and when it is needed) works well for scripting purposes but is less desirable in commercial settings. Less distribution happens when it is used purely for scripting purposes, such as system maintenance or tuning. The solution with the c

How to use a Tkinter widget inside a PyGtk or wxPython HMI?

2005-04-26 Thread Sebastien Aubry
[This is the translation of a question issued on the fr.comp.lang.python newsgroup] Hello, I happen to use in my programs a widget based on Tkinter Canvas. It is Zinc (http://www.tkzinc.org), which allows to draw using transparency, gradients, translations, rotations, ... using OpenGL. However

how to pass an array to a VB array via COM

2005-04-26 Thread jelle
Hi, I'm trying to script Rhino -the nurbs modeller, not the server soft- via COM. Which is good fun, except i cant seem to pass arrays to the program. I suppose its expecting VB arrays, and is not to keen when i send a tuple: RS.AddCurve(((1,2,3),(4,5,6),(7,8,9)),3) --- Traceback (most recent cal

Re: kdialog and unicode

2005-04-26 Thread Peter Otten
Dumbkiwi wrote: >> Just encode the data in the target encoding before passing it to >> os.popen(): >> >> test = os.popen('kdialog --inputbox %s' % data.encode("utf-8")) > I had tried that, but then the text looks like crap. The text I'm using > for this is Polish, and there are a lot of non-En

Re: what is the best way to determine system OS?

2005-04-26 Thread Roel Schroeven
Mike Meyer wrote: In that case, it seems to be a better idea to check the version of vmstat that's on the system. At least, I presume that such differences in behaviour can be deduced from the vmstat version string. Hmm. That doesn't seem to work here: guru% vmstat --version vmstat: illegal option

How to exctract title of links

2005-04-26 Thread raver2046
here i have a link http://raver2046.ath.cx/CV/";>cv network admin how to extract "cv network admin" here is the code i have find to exctract link but not title of link import htmllib, formatter, urllib class x(htmllib.HTMLParser): def dump(self, tag, attrs):

Mail Delivery (failure [email protected])

2005-04-26 Thread Corinne Grosstephan
pourriez-vous m'envoyer l'adresse exacte du contact service technique freebox merci -- http://mail.python.org/mailman/listinfo/python-list

Re: Python documentation moronicities (continued)

2005-04-26 Thread Brian Quinlan
I think that there are some nice ideas in the new version e.g. "Regex functions" is a nicer title than "Module contents", examples, caveats. But there are some organizational problems and the actual writting is a bit weak. Cheers, Brian -- http://mail.python.org/mailman/listinfo/python-list

Re: regex over files

2005-04-26 Thread Steve Holden
Robin Becker wrote: Steve Holden wrote: .. I seem to remember that the Medusa code contains a fairly good overlapped search for a terminator string, if you want to chunk the file. Take a look at the handle_read() method of class async_chat in the standard library's asynchat.py. . thanks

Re: how to pass an array to a VB array via COM

2005-04-26 Thread Steve Holden
jelle wrote: Hi, I'm trying to script Rhino -the nurbs modeller, not the server soft- via COM. Which is good fun, except i cant seem to pass arrays to the program. I suppose its expecting VB arrays, and is not to keen when i send a tuple: RS.AddCurve(((1,2,3),(4,5,6),(7,8,9)),3) --- Traceback (most

Re: Python licence again

2005-04-26 Thread TZOTZIOY
On Sat, 23 Apr 2005 06:57:00 +1000, rumours say that John Machin <[EMAIL PROTECTED]> might have written: >On 22 Apr 2005 12:22:41 -0700, "fuzzylollipop" ><[EMAIL PROTECTED]> wrote: >>try spelling license correctly next time >Yup, pesky furriners, can't spell 'Merican prop'ly like God intended; >

Re: key binding with mac

2005-04-26 Thread Jim Sizelove
Eric Texier wrote: I am just starting to use python on the mac. How do I get backspace, the arrows up/down and all the control like ctrl-a to work nicely under the console. for now I am getting a bunch of ^? ^[[A when I use any tcsh type of control. thanks, I believe you need to install readline s

Re: How to exctract title of links

2005-04-26 Thread prasad
import htmllib, formatter, urllib class x(htmllib.HTMLParser): inanchor = True # indicates whether we are inside anchor element def dump(self, tag, attrs): #print tag, for a, v in attrs: if a in ['a', 'src', 'href']: print v, print #

Re: Python, Perl & PDF files

2005-04-26 Thread rbt
[EMAIL PROTECTED] wrote: Robin Becker wrote: rbt wrote: .. I just want to read PDF files in a portable way (windows, linux, mac) from within Python. .. I suppose you mean extract PDF pages and do something with them. http://www.reportlab.com does have a tool that handles that in Python. It'

Re: How to exctract title of links

2005-04-26 Thread Larry Bates
You should take a look at BeautifulSoup at: http://www.python.org/pypi/BeautifulSoup/2.0.2 Larry Bates raver2046 wrote: > here i have a link http://raver2046.ath.cx/CV/";>cv network > admin > > how to extract "cv network admin" > > > here is the code i have find to exctract link but not ti

Mailman attachments on archive

2005-04-26 Thread carlosea
Hi. How can I keep the attachments on mailman archive with friendly links, and without changing the file extension? Now messages look like this: - message blablabla... -- next part -- A non-text attachment was scrubbed

Re: Python documentation moronicities (continued)

2005-04-26 Thread Peter Hansen
Steve Holden wrote: I still await the specified five emails preferring your version to the current documentation. So, for the record Steve, how many of those emails have you received to date? (And how many from *anyone*, not just regulars, proclaiming Xah's version better?) -Peter -- http://mail.

How to start python interactively from python script?

2005-04-26 Thread [EMAIL PROTECTED]
Hi, I would like to have a python script which does some computations at the beginning and then changes to interactive mode (by displaying the prompt). How can I do this? Thanks in advance, Raghu. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to start python interactively from python script?

2005-04-26 Thread Mage
[EMAIL PROTECTED] wrote: >Hi, > >I would like to have a python script which does some computations at >the beginning and then changes to interactive mode (by displaying the >prompt). How can I do this? > > popen() Mage -- http://mail.python.org/mailman/listinfo/python-list

Re: Quote-aware string splitting

2005-04-26 Thread Jeffrey Froman
Bengt Richter wrote: > Oops, note some spaces inside quotes near ss and missing double quotes in > result. And here I thought the main problem with my answer was that it didn't split unquoted segments into separate words at all! Clearly I missed the generalization being sought, and a more robust

Re: How to start python interactively from python script?

2005-04-26 Thread Thomas Heller
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Hi, > > I would like to have a python script which does some computations at > the beginning and then changes to interactive mode (by displaying the > prompt). How can I do this? You call 'os.setenv["PYTHONINSPECT"] = "1"' at the somewher in your

TypeError: ssl() argument 1 must be _socket.socket, not _socketobject

2005-04-26 Thread Huzaifa Tapal
I am getting this error from python 2.3.5 when making secure socket connections from my mod_python based application. It is very odd because we cannot replicate this in the development environment, only in production on a cluster of 2 debian boxes with Apache2 MPM Worker w/ Mod Python 3.13. D

Re: How to start python interactively from python script?

2005-04-26 Thread [EMAIL PROTECTED]
Thank you. 'os.environ["PYTHONINSPECT"] = "1"' does the job. Raghu. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to start python interactively from python script?

2005-04-26 Thread Michele Simionato
$ python -i myscript.py Michele Simionato -- http://mail.python.org/mailman/listinfo/python-list

compile shebang into pyc file

2005-04-26 Thread Joerg Schuster
Hello, is there a way to compile a python file foo.py to foo.pyc (or foo.pyo) such that foo.pyc can be run with 'foo.pyc' (as opposed to 'python foo.pyc') on the command line? Jörg Schuster -- http://mail.python.org/mailman/listinfo/python-list

Re: Python documentation moronicities (continued)

2005-04-26 Thread Ivan Van Laningham
Hi All-- Richie Hindle wrote: > > Xah is right - I have a copy here of his message of 18th April, saying "i > have rewrote the Python's re module documentation.". > Which announcement alone I take as evidence sufficient unto itself. I shall not be reading the "rewrote" documentation. Metta, I

python equivalent of php implode

2005-04-26 Thread Maksim Kasimov
in php-scripts, to insert data to database, i'm doing like this: ... $query_param = array( 'field0' => 1, 'field1' => 3, 'field2' => $var2, 'field3' => $var3, ); ... $sql = "INSERT INTO $table (".implode(", ", array_keys($query_param)).") VALUES ('".implode("','", $quer

Re: delete will assure file is deleted?

2005-04-26 Thread rbt
[EMAIL PROTECTED] wrote: Hello Mike, I have to know this topic otherwise my program has to check whether the file / files are already deleted and this is a little bit messy. Pujo How about checking with isfile() before and after? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to pass an array to a VB array via COM

2005-04-26 Thread jelle
No I haven't, it might be an idea. Would it be an effective method though? I have little experience working with COM, but i suppose writing an (VB!) array wouldnt be the most challenging problem, though browsing through this list it looks like no good solution arrived yet. Cheers, Jelle -- http

Re: python equivalent of php implode

2005-04-26 Thread Jeff Epler
It looks like php's implode(sep, seq) is like sep.join(seq) in Python. But this is a lousy way to write database queries. You should use the Python's DB-API interface's execute(statement, parameters) instead. Assuming that paramstyle is 'qmark', I think it ends up looking something like this:

Re: create python process

2005-04-26 Thread Trent Mick
[EMAIL PROTECTED] wrote] > I use windows and os.fork is not working in windows. > Can we create process inside python I mean I have function and I want > to run it as a process not a thread ? > > Should I run code from os. in order to run a processes? Check out any or all of: subprocess (new

Shelve problem with Python 2.3.4 on RHEL 3 AS

2005-04-26 Thread Marco Cassiano
I installed python 2.3.4 on my system with configure/make/make altinstall in order to preserve the original python installation of RHEL3.I have the following error entering these few python lines : Python 2.3.4 (#3, Apr 26 2005, 14:48:36)[GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-49)] on linux2Type

Re: regex over files

2005-04-26 Thread Robin Becker
Steve Holden wrote: . thanks I'll give it a whirl Whoops, I don't think it's a regex search :-( You should be able to adapt the logic fairly easily, I hope. The buffering logic is half the problem; doing it quickly is the other half. The third half of the problem is getting re to co-o

Re: bytecode non-backcompatibility

2005-04-26 Thread Terry Reedy
"Maurice LING" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Now I understand that Python bytecodes are only dealing with pure python > source codes. Then stop blaming (machine-independent) CPython 'bytecodes' for any problems you have with compiled-to-machine-language C exten

  1   2   3   >