Re: lxml/ElementTree and .tail

2006-11-16 Thread Stefan Behnel
feature. Hiding XML language specific behaviour directly in the Element classes really helps in getting your code clean, especially in larger code bases. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Secure Python

2006-11-17 Thread Stefan Behnel
If you want a secure system, build it without having to run arbitrary code from untrusted sources. Stefan -- http://mail.python.org/mailman/listinfo/python-list

[ANN] lxml 1.0 released

2006-06-02 Thread Stefan Behnel
beta) is rather small, this version contains a large number of bug fixes found by various users and testers. Thank you all for your help! Stefan Features added since 0.9.2: * Element.getiterator() and the findall() methods support finding arbitrary elements from a namespace (pattern {na

Re: [ANN] lxml 1.0 released

2006-06-03 Thread Stefan Behnel
Kent Johnson wrote: > Stefan Behnel wrote: >> Hallo everyone, >> >> I have the honour to announce the availability of lxml 1.0. >> >> http://codespeak.net/lxml/ >> >> It's downloadable from cheeseshop: >> http://cheeseshop.python.org/pypi/lx

RE: embedding Python in COM server loaded with win32com

2006-06-06 Thread Stefan Schukat
our server. Stefan > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Fozzie > Sent: Monday, June 05, 2006 3:57 PM > To: python-list@python.org > Subject: embedding Python in COM server loaded with win32com > > Hi, > &g

Re: xml.sax.xmlreader and expat

2006-06-27 Thread Stefan Behnel
r to lxml (if you want to do more than just parsing): http://cheeseshop.python.org/pypi/lxml/1.1alpha Why? http://effbot.org/zone/celementtree.htm#benchmarks http://codespeak.net/lxml/performance.html#parsing-and-serialising Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: [Pyrex] pyrex functions to replace a method (Re: replace a method in class: how?)

2006-06-28 Thread Stefan Behnel
> #- > > #module_pyrex.pyx > > def pyrex_update(self,val): > print "pyrex module",val What is the 'self' for? After all, you are sticking a /function/ into the object, not a /method/. Your function will not receive a 'self' argument automatically as it is stuck into the instance and not part of the class. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: [Pyrex] pyrex functions to replace a method (Re: replace a method in class: how?)

2006-06-28 Thread Stefan Behnel
hod. You can't call unbound methods without specifying the object you want to call them on (i.e. the 'self' argument). http://docs.python.org/tut/node11.html#SECTION001134 When you're using 'plain classes', you can do with them whatever you do in standard Python, so replacing a method is just done with an attribute assignment. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Replace Whole Object Through Object Method

2006-07-01 Thread Stefan Schwarzer
akes the software easiest to maintain in the long run. (If you don't know what the long run is, consider the "medium run" and refactor later. :) ) > Now I do agree that it can become tricky to manage correctly wrt/ mro > rules !-) See? ;-) Software shouldn't be tricky (or only as tricky as necessary). I value clarity over cleverness. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: python/libxml2dom questions

2006-07-01 Thread Stefan Behnel
lxml? It's pretty well documented. http://codespeak.net/lxml For the rest of the questions: please read the Python tutorial on python.org. It's very helpful for beginners. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: xpath question

2006-07-04 Thread Stefan Behnel
y the EXSLT module. Same for lxml, although it's currently only enabled in XSLT: http://codespeak.net/lxml/api.html#xslt Guess I should change that for 1.1... Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: iterate over a series of nodes in an XML file

2006-07-05 Thread Stefan Behnel
getparent().remove(last) last = myid Internally, iterparse builds up a tree, so the last three lines are there to remove the myid elements from the tree that were already handled. This saves a lot of memory for large documents. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Intro to Python course, Aug 16-18, San Francisco

2006-07-06 Thread Stefan Behnel
living in the closer area and I don't think anyone of them uses Python. Anyway, I wanted to announce it to the world so that people who expect to come close to Bornhövede any time soon can contact me on this. The cost will be somewhere near a bottle of wine per attendee to get my tongue movin

Re: python/xpath question...

2006-07-06 Thread Stefan Behnel
xpath, that gets me all of the tr.. i only want to get the > sibling tr up until i hit a 'tr' that has a 'th' anybody have an idea as to > how this query might be created?.. I'm not quite sure how this is supposed to be related to Python, but if you're trying to

Re: web app breakage with utf-8

2006-07-06 Thread Stefan Behnel
he output > for the browser. > > I really am at a loss for what is going wrong, when everything works fine > on crusty old 2.2.1. What are others doing for caputre, store, and output > for web utf-8? You didn't tell us what database you are using, which encoding your database uses, which Python-DB interface library you deploy, and lots of other things that might be helpful to solve your problem. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: lxml and SimpleXMLWriter

2006-07-06 Thread Stefan Behnel
import sys > > w = XMLWriter(sys.stdout) > > html = w.start("html") [snip] Note that the SimpleXMLWriter is in no way related to the ElementTree implementation. Feel free to copy the module from the elementtree package and use it with lxml. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Solution for XML-RPC over a proxy

2006-07-07 Thread Stefan Krah
> > Comments welcome. No real comment, just to point out an alternative that works well for me: http://docs.python.org/dev/lib/xmlrpc-client-example.html Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

RE: COM Makepy Question

2006-07-07 Thread Stefan Schukat
It seems that the ocx only works in a GUI environment. Perhaps you could try to embed the ocx in a pythonwin dialog which you create invisible since the dialog is then a control container see "Python24\Lib\site-packages\pythonwin\pywin\Demos\ocx\ocxtest.py" Stefan >

Re: Looking for a HTML like rendering library (wishlist)

2006-07-11 Thread Stefan Behnel
fter reading this, I still do not understand why you want to do this with images. Virtually any GUI toolkit can display text, most can natively display HTML, just look at Qt for a good example. So why not just use the native features? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: XML parsing and writing

2006-08-29 Thread Stefan Behnel
c00i90wn wrote: > Stefan Behnel wrote: >> c00i90wn wrote: >>> Hey, I'm having a problem with the xml.dom.minidom package, I want to >>> generate a simple xml for storing configuration variables, for that >>> purpose I've written the following code, b

Re: Getting Process Name on Win32

2006-09-06 Thread Stefan Rank
n [1]: import win32com.client In [2]: wmi = win32com.client.GetObject('winmgmts:') In [3]: procs = wmi.ExecQuery('Select * from win32_process') In [4]: for proc in procs: ...: print proc.Name ...: System Idle Process ... [censored] There are also python-pack

Re: Data sticking around too long

2006-09-07 Thread Stefan Schwarzer
e considered immutable also I guess you confuse this with tuples. > but since it is a container > type it behaves somewhat differently. Again, this has nothing per se to do with being a container though many containers are mutable objects and often are modified in-place. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Minidom XML output - attributes in wrong order ?

2006-09-09 Thread Stefan Behnel
What I expected was : Attributes in XML are not ordered and no XML library will keep the order. All you could do is serialise by hand, which is not that difficult either. Is there any reason why you might want to keep the order? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: lxml Windows binaries

2006-09-14 Thread Stefan Behnel
ul egg contributors are pretty reliable. BTW, there's also a mailing list for lxml, it's always a good idea to discuss lxml related stuff there. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: high level, fast XML package for Python?

2006-09-16 Thread Stefan Behnel
the same time. http://codespeak.net/lxml/objectify.html It's part of the lxml distribution: http://codespeak.net/lxml/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Embedding Python and command history

2006-09-20 Thread Stefan Bellon
ractiveLoop? Thanks a lot for your hints in advance! -- Stefan Bellon -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding Python and command history

2006-09-20 Thread Stefan Bellon
Stefan Bellon wrote: > int main(void) > { > Py_Initialize(); > PyRun_InteractiveLoop(stdin, ""); > Py_Finalize(); > } > How can I make use of command history when embedded Python via > PyRun_InteractiveLoop? Sorry to follow up my own posting ... I fou

Re: Makin search on the other site and getting data and writing in xml

2006-09-27 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > ok i close this discussion No, you don't. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Computer Language Popularity Trend

2006-09-27 Thread Stefan Scholl
In comp.lang.lisp Jon Ribbens <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: >>> http://xahlee.org/lang_traf/index.html >> >> Careful there with the sweeping generalizations and quick judgments >> about languages :) > > I just read "PHP as a language is rath

Re: Quadratic Optimization Problem

2006-11-22 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > I need to do a quadratic optimization problem in python where the > constraints are quadratic and objective function is linear. > > What are the possible choices to do this. Too bad these homework assignments get trickier every time, isn't it?

Re: XML Validation in Python using XSV

2006-11-22 Thread Stefan Behnel
s > functions. You can use "dpkg" to install the .deb. Read "man dpkg". BTW: any reason you need to use XSV? There are some other libraries out there that can validate XML based on XML Schema and RelaxNG, e.g. lxml. They are much more powerful than XSV. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Pyparsing Question.

2006-11-22 Thread Stefan Behnel
Ant wrote: > So I thought I'd look into the pyparsing module, but can't find a > simple example of processing random text. Have you looked at the examples on the pyparsing web page? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: XML Validation in Python using XSV

2006-11-22 Thread Stefan Behnel
> [EMAIL PROTECTED] wrote: > Stefan Behnel wrote: >> BTW: any reason you need to use XSV? There are some other libraries out there >> that can validate XML based on XML Schema and RelaxNG, e.g. lxml. They are >> much more powerful than XSV. > > No particular r

Re: XML Validation in Python using XSV

2006-11-22 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > Stefan Behnel wrote: >>> [EMAIL PROTECTED] wrote: >>> Stefan Behnel wrote: >>>> BTW: any reason you need to use XSV? There are some other libraries out >>>> there >>>> that can validate XML based on XML Schema

Re: len(var) is [CONSTANT] equal to len(var) == [CONSTANT]?

2006-11-23 Thread Stefan Behnel
Tor Erik Soenvisen wrote: > (len(['']) is 1) == (len(['']) == 1) => True >>> len(['']) 1 >>> len(['']) is 1 True >>> len(['']) == 1 True >>> True == True True >>> (

Re: A mail from Steve Ballmer. See what Microsoft will do and follow.

2006-12-03 Thread Stefan Scholl
JustStand <[EMAIL PROTECTED]> wrote: > In many ways, it was the launch of Windows 95 and Office 95 eleven > years ago that signaled the start of this transformation. ..." Right. 11 years ago I switched from Amiga to Linux. -- Web (en): http://www.no-spoon.de/ -*- Web (de): http://www.frell.de/

Re: merits of Lisp vs Python

2006-12-09 Thread Stefan Nobis
e, that's really hard to understand. So Python is a bad language? No, quite not. So why do you think, Common Lisp or Macros are a bad thing? What's the difference (from the perspective of understanding) between a function foo and a macro bar? Both just transform their inputs. It&#

Re: merits of Lisp vs Python

2006-12-09 Thread Stefan Nobis
ed some languages -- maybe some are a little bit worse for the uneducated, but all languages are really unreadable. Intuitive interfaces (GUI, languages,...) are an urban legend, pure illusion. You have to do hard work and practice to understand them. -- Stefan. -- http://mail.python.org/mailma

Re: subversion revision number string within an application packaged with distutils?

2006-12-14 Thread Stefan Behnel
Here's how we do it in lxml: https://codespeak.net/svn/lxml/trunk/versioninfo.py Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Validate XML against a set of XSD files, with Python

2006-12-14 Thread Stefan Behnel
, but I've already stumbled into schemas that just don't work (especially generated ones). RelaxNG support in libxml2 is pretty much perfect, BTW. Stefan -- http://mail.python.org/mailman/listinfo/python-list

convert from date string to epoch

2006-12-15 Thread Stefan Antonelli
Hi, i have to convert several timestamps. The given format, eg "-mm-dd hh:mm:ss" has to be converted to an epoch string. Is there any proper way to do this? If not, i have to split the given string and resolve this by a calculation? Thanks for help. Stefan. -- http://mail.

Re: convert from date string to epoch

2006-12-18 Thread Stefan Antonelli
it = str(timestamp).split(' ') tdate = map(int,split[0].split('-')) ttime = map(int,split[1].split(':')) tcode = (tdate[0], tdate[1], tdate[2], ttime[0], ttime[1], ttime[2]) epoch = timegm(tcode) return (int(epoch)) Stefan. -- http://mail.python.org/mailman/listinfo/python-list

[ANN] ftputil 2.2 released

2006-12-25 Thread Stefan Schwarzer
Source software, released under the revised BSD license (see http://www.opensource.org/licenses/bsd-license.php ). Stefan -- Dr.-Ing. Stefan Schwarzer SSchwarzer.com - Softwareentwicklung f??r Technik und Wissenschaft http://sschwarzer.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How to depress the output of an external module ?

2006-12-26 Thread Stefan Schwarzer
rding threads which also use sys.stdout, perhaps implicitly via print statements. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: simple ftputil ssl client

2007-01-02 Thread Stefan Schwarzer
se M2Crypto, try to make sure that you have a class which is compatible with ftplib.FTP. You can pass such a class as session_factory to ftputil.FTPHost's constructor. If you don't have such a class, you might be able to write it yourself. Stefan -- Dr.-Ing. Stefan Schwarzer SSchwarzer.c

Re: code optimization (calc PI)

2007-01-03 Thread Stefan Schwarzer
ython2006.pdf Stefan -- Dr.-Ing. Stefan Schwarzer SSchwarzer.com - Softwareentwicklung für Technik und Wissenschaft http://sschwarzer.com -- http://mail.python.org/mailman/listinfo/python-list

Re: How to get file name on a remote server with ftplib?

2007-01-05 Thread Stefan Schwarzer
>>> file_names ['wanted_filename'] >>> file_name = file_names[0] >>> host.download(file_name, file_name, "b") >>> host.close() Ok, I admit this isn't a pure-ftplib solution. :-) Stefan -- Dr.-Ing. Stefan Schwarzer SSchwarzer.com - Softwareentwicklung für Technik und Wissenschaft http://sschwarzer.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Using sax libxml2 html parser

2007-01-06 Thread Stefan Behnel
top' command). Try the lxml binding for libxml2. It relieves you from having to do your own memory management and makes using that library plain easy. http://codespeak.net/lxml/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Why less emphasis on private data?

2007-01-06 Thread Stefan Schwarzer
he distinction between public and non-public attributes IMHO makes sense, but I don't think that the distinction should be enforced by the language as in C++ or Java. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: clarification on open file modes

2007-01-06 Thread Stefan Schwarzer
data??? You won't corrupt the data in the file, but you will kind of corrupt the data that arrives in your program. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Module to read svg

2007-01-08 Thread Stefan Behnel
ermail/xml-sig/2004-June/010325.html In case you still end up wanting to write something yourself, you might consider lxml's namespace implementation feature a good starting point. http://codespeak.net/lxml/element_classes.html Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: lxml namespaces problem

2007-01-08 Thread Stefan Behnel
ement the namespace replacement in XSLT. You might also want to try to copy the elements to a newly created document that does not have the original namespace declaration. Note, however, that this is not guaranteed to work and might break depending on the lxml version. Stefan -- http://mail.python.org/mailman/listinfo/python-list

RE: win32com early binding problem

2006-01-25 Thread Stefan Schukat
win32com does only support late bound interfaces in python scripts. To support early bound interfaces a pyd has to be created. If you want to script early bound interfaces try ctypes.com aka. comtypes from Thomas Heller. Stefan > -Original Message- > From: [EMAIL PRO

Re: While loop - print several times but on 1 line.

2006-01-26 Thread Stefan Neumann
hing like that: >>> print "text"*5 texttexttexttexttext cheers Stefan pgp470Yem6sNX.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Daemon terminates unexpected

2006-02-06 Thread Stefan Neumann
out double-fork, can someone explain, why to use this way for starting a daemon? Thanks in advanced. Stefan pgpWIkZJooXfQ.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Avoiding FTP server timeout for files based on sockets (long posting)

2006-02-08 Thread Stefan Schwarzer
FTP server without requiring the user of the ftputil library to explicitly send data with _FTPFile.write? Stefan [1] http://ftputil.sschwarzer.net/ [2] http://ftputil.sschwarzer.net/trac/browser/trunk/ftputil.py [3] http://ftputil.sschwarzer.net/trac/browser/trunk/ftp_file.py [4] http://docs.python.

Re: removing characters before writing to file

2006-02-09 Thread Stefan Neumann
at the begining and at the end of the string, you could also use: >>> "('sometext1', 1421248118, 1, 'P ')"[1:-1] "'sometext1', 1421248118, 1, 'P '" cheers Stefan pgpEdJ9SLHXXB.pgp Description: PGP signature -- http://mail.python.org/mailman/listinfo/python-list

Re: PyUNO with different Python

2006-02-22 Thread Stefan Behnel
line 37, in ? > import pyuno > ImportError: Module use of python23.dll conflicts with this version of > Python. Sounds like you might want to switch back to Python 2.3 ... Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Stefan Rank
iscussion needs to move to python-dev ?) As for the metaclass versions: For myself, the above version feels more natural and straightforward (in the same way as the PEP author describes it), though I understand the subclassing ideas. But are there use cases for subclassing, that aren't better served with a new enum or something homegrown? Can C++/Pascal/Java enums be subclassed? cheers, stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 354: Enumerations in Python

2006-02-28 Thread Stefan Rank
on 28.02.2006 12:14 Carl Banks said the following: [snip] > >>> It's a pretty weak case to have a dedicated builtin to prevent >>> duplicates in something that changes maybe once a month, as enums tend >>> to change rather slowly. (At least, that's the way enums in other >>> languages are used, a

Re: text strings to binary...

2005-05-03 Thread Stefan Näwe
he pack function but I can't get it to work. I'm using Python 2.3.3 in > Windows XP. Why don't you post some pieces of your code ? Maybe someone can help you fix it. Stefan -- -- http://mail.python.org/mailman/listinfo/python-list

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

2005-05-09 Thread Stefan Schukat
A patch is available at sourceforge: https://sourceforge.net/tracker/index.php?func=detail&aid=1195096&group_id=78018&atid=551956. Stefan > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of > jelle > Sent: Friday,

Re: Newbie : checking semantics

2005-05-16 Thread Stefan Nobis
about this as the above point. BTW: I would also appreciate a nicer syntax for classes (no explicit self, no masses of _). But that's another story... :) -- Stefan. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie : checking semantics

2005-05-16 Thread Stefan Nobis
ttle less of a problem. So I would appreciate optional statements to end a block (indentation rules may be mandatory). This comes also very handy in something like Python Server Pages of mod_python (where a comment line to explicitly end a block is sometimes needed). -- Stefan. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie : checking semantics

2005-05-16 Thread Stefan Nobis
sometimes it causes at least a little bit trouble. -- Stefan. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie : checking semantics

2005-05-16 Thread Stefan Nobis
Andrew Dalke <[EMAIL PROTECTED]> writes: > See the program "pindent.py" Thanks for the hint, i didn't know about it. -- Stefan. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie : checking semantics

2005-05-17 Thread Stefan Nobis
mportant. What Python got really wrong is mixing binding and assignment (because this way you have little chance to catch typos in identifiers). -- Stefan. -- http://mail.python.org/mailman/listinfo/python-list

RE: What are com_record objects

2005-05-18 Thread Stefan Schukat
Use the Record Method from win32com.client object = win32com.client.Dispatch("Server.Object") IPAddress = win32com.client.Record("IPADDRESS_STRUCT", object) IPAddress.b1 = 192 IPAddress.b2 = 168 IPAddress.b3 = 0 IPAddress.b4 = 1 object.connect(IPAddress) Stefan >

None module reference

2005-05-21 Thread Stefan Seefeld
;) is 'None' ! What does that mean ? Have those modules already been unloaded ? If so, why, given that my current module still references them ? Any help is highly appreciated, Stefan -- http://mail.python.org/mailman/listinfo/python-list

Announcement: Synopsis 0.8

2005-06-09 Thread Stefan Seefeld
I'm pleased to announce the release of Synopsis 0.8. Synopsis is a multi-language source code introspection tool that provides a variety of representations for the parsed code, to enable further processing such as documentation extraction, reverse engineering, and source-to-source translation. W

Re: Best Web dev language

2005-06-11 Thread Stefan Nobis
re is JPython). I don't like Perl syntax much, so it's not on the list, and PHP is a rather chaotic language with (personal view!) at least a couple of new security issues eacht month, so it's the worst choice one can make (i think). Hope that helps a little bit. -- Stefan. -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding Python

2005-06-17 Thread Stefan Seefeld
pass global and local dictionaries as context. That may provide more fine-grained control, depending on what you want. Regards, Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting SAX results

2007-06-06 Thread Stefan Behnel
ak.net/lxml/dev/ http://codespeak.net/lxml/dev/objectify.html Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: read xml file from compressed file using gzip

2007-06-07 Thread Stefan Behnel
It reads in gzip compressed XML files transparently and provides loads of other nice XML goodies. http://codespeak.net/lxml/dev/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: read xml file from compressed file using gzip

2007-06-09 Thread Stefan Behnel
IP archive. Use the zipfile library: file:///usr/share/doc/python2.5-doc/html/lib/module-zipfile.html Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Gzip - gunzip using zlib

2007-06-09 Thread Stefan Behnel
zipfile module instead. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Needed: FTP Upload Directory Tree script

2007-06-10 Thread Stefan Schwarzer
.py?format=txt [3] http://ftputil.sschwarzer.net/trac/wiki/Download [4] mailto:[EMAIL PROTECTED] [5] mailto:[EMAIL PROTECTED] Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread Stefan Behnel
an only be received between atomic > actions of the python interpreter", presumably - and control will not > return to Python unless something appears on the socket). Does anyone > have a tip of a good way to do this? Twisted *should* be able to do this, as it uses non-blocking IO

Re: SimplePrograms challenge

2007-06-12 Thread Stefan Behnel
uot;outdated". > > Given the simplicity of the ElementSoup code above, I'd still contend > that using HTMLParser here shows too complex an answer to too simple a > problem. Here's an lxml version: from lxml import etree as et # http://codespeak.net/lxml html = et.HTML(page2) for href in html.xpath("//a/@href[string()]"): print href Doesn't count as a 15-liner, though, even if you add the above HTML code to it. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Output of HTML parsing

2007-06-15 Thread Stefan Behnel
t; writer = csv.writer(open("professor.csv", "wb")) > writer.writerows(output) #output CSV file writer = csv.writer(open("professor.csv", "wb")) writer.writerows(name_list) #output CSV file > -- End of Program > -- > > 3.Should I close the opened csv file("professor.csv")? How to close > it? I guess it has a "close()" function? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing HTML, extracting text and changing attributes.

2007-06-18 Thread Stefan Behnel
use. lxml is what you're looking for, especially if you're familiar with XPath. http://codespeak.net/lxml/dev Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing HTML, extracting text and changing attributes.

2007-06-18 Thread Stefan Behnel
Jay Loden wrote: > Someone else mentioned lxml but as I understand it lxml will only work if > it's valid XHTML that they're working with. No, it was meant as the OP requested. It even has a very good parser from broken HTML. http://codespeak.net/lxml/dev/parsing.html#pars

Re: Parsing HTML, extracting text and changing attributes.

2007-06-18 Thread Stefan Behnel
codespeak.net/lxml/dev/tutorial.html http://codespeak.net/lxml/dev/parsing.html#parsing-html http://codespeak.net/lxml/dev/xpathxslt.html#xpath Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: HTMLParser.HTMLParseError: EOF in middle of construct

2007-06-18 Thread Stefan Behnel
The docs: http://codespeak.net/lxml/dev/ The SVN branch: http://codespeak.net/svn/lxml/branch/html/ You seem to be on Linux, so compiling lxml should be simple enough: http://codespeak.net/lxml/dev/build.html#subversion Have fun, Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Output of HTML parsing

2007-06-19 Thread Stefan Behnel
Jackie schrieb: > On 6 15 , 2 01 , Stefan Behnel <[EMAIL PROTECTED]> wrote: >> Jackie wrote: > >> import lxml.etree as et >> url = "http://www.economics.utoronto.ca/index.php/index/person/faculty/"; >> tree = et.parse(url) >> > >> S

Re: easy_install from svn

2007-06-19 Thread Stefan Behnel
mber, or a tag and have that version > installed. > > Is it simply a case of appending a fragment to the url? > Would anyone be so kind as to provide a working example? This is how we do it for lxml: http://cheeseshop.python.org/pypi/lxml/1.2.1 Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: HTMLParser.HTMLParseError: EOF in middle of construct

2007-06-19 Thread Stefan Behnel
bug of HTMLParser Sure, and next time your key doesn't open your neighbours house, please report to the building company to have them fix the door. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: caseless dictionary howto ?

2007-06-20 Thread Stefan Behnel
it's some kind of flags or attributes, maybe a class to hold them would look better), but that's a good solution to the problem IMHO. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting SAX results

2007-06-20 Thread Stefan Behnel
you might think "Ok, I'll just use SAX". And now you have two problems. SAX is a great way to hide your real problems behind a wall of unreadable code. If you want my opinion, lxml is currently the straightest way to get XML work done in Python. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: caseless dictionary howto ?

2007-06-20 Thread Stefan Behnel
stef wrote: > I think you might be right, > but for a one-time/one-programmer program, > I think the documentation will be good enough. Famous last words. Stefan :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Looking to embed python into html like mason

2007-06-21 Thread Stefan Behnel
Steven W. Orr wrote: > Does something like that exist? Many of them, as usual :) http://wiki.python.org/moin/WebProgramming Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessing variable from a function within a function

2007-06-24 Thread Stefan Bellon
... print a ... return inner ... >>> f=outer() >>> f() Traceback (most recent call last): File "", line 1, in ? File "", line 4, in inner UnboundLocalError: local variable 'a' referenced before assignment -- Stefan Bellon -- http://mail.python.org/mailman/listinfo/python-list

Re: Which XML?

2007-06-25 Thread Stefan Behnel
ElementTree: > > http://codespeak.net/lxml/dev/objectify.html lxml is not part of ElementTree (only mostly compatible), but it's a must if you want to have a simple API *and* XPath *and* good performance. http://codespeak.net/lxml/ The API is not W3C-DOM compatible, but that's

Re: Which XML?

2007-06-25 Thread Stefan Behnel
thon wrapper is for: keep the people who use it from worrying about segfaults and memory management and let them concentrate on their own problems. It's more important to make the users happy than the libs. :) Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Output XML buffer?

2007-06-25 Thread Stefan Behnel
claration. No need to have it, though, as ET will create well-formed XML anyway. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Info.

2007-06-25 Thread Stefan Behnel
Brandon wrote: > Check it out: www.BrandonsMansion.com Why? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing python under the linux

2007-06-26 Thread Stefan Behnel
from python.org and unpack it if you want to play with it. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: XML from SQL result

2007-06-27 Thread Stefan Behnel
] = [] c3_list.append(c3) root = ET.Element("root") # in case "col1" has more than one value for c1, c2d in c1d.iteritems(): el_c1 = ET.SubElement(root, "tag1", col1=c1) for c2, c3_list in c2d.iteritems(): el_c2 = ET.SubElement(

Re: Reversing a string

2007-06-27 Thread Stefan Behnel
Scott wrote: > So how on earth would be the best way to: Write a function that takes a > string as an argument and outputs the letters backward, one per line. Homework? Anyway, what about: for c in string[::-1]: print c Stefan -- http://mail.python.org/mailman/listinfo/python-list

Hooking __import__ when embedding the interpreter

2007-06-29 Thread Stefan Bellon
can I find out from which module the import was initiated? 3) My final point is related to 2) ... if I get to the module object, then how do I get at the source file name of that? I noticed that when a .pyc is available, then this is preferred. I'd like to get at the .py file itself.

<    3   4   5   6   7   8   9   10   11   12   >