Re: stripping fields from xml file into a csv

2010-02-28 Thread Stefan Behnel
Hai Vu, 28.02.2010 17:41: > By the way, Stefan, I am using Python 2.6. Do you know the differences > between ElementTree and cElementTree? Use cElementTree, it's implemented in C and a lot faster and more memory friendly. http://effbot.org/zone/celementtree.htm#benchmarks http://co

Re: stripping fields from xml file into a csv

2010-02-28 Thread Stefan Behnel
Hal Styli, 01.03.2010 00:15: > Stefan, I was happy to see such concise code. > Your python worked with only very minor modifications. > > Hai's test xml data *without* the first and last line is close enough > to the data I am using: > > > > > > &g

Re: Detecting new removable drives in Linux

2010-03-01 Thread Stefan Behnel
I can detect new removable drives? You could execute a script from HAL, e.g. using halevt, and let the script communicate with your program. http://www.nongnu.org/halevt/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-03 Thread Stefan Behnel
speed up your C wrapper code. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: python 2.6: how to modify a PIL image from C without copying forth and back

2010-03-03 Thread Stefan Behnel
News123, 03.03.2010 10:37: Stefan Behnel wrote: Take a look at Cython instead, it will allow you to access PIL's image buffer directly, instead of copying the data. It will also simplify and speed up your C wrapper code. I don't know Cython. Having looked at the web site I'm no

Re: Working group for Python CPAN-equivalence?

2010-03-03 Thread Stefan Behnel
27;m wondering - is there any work being done identifying .. (1) what is so good with CPAN? (2) how can it be brought to the Python world? Is there a working group/initiative for this? Web page? Discussion group? I think the right place to discuss any deficiencies of PyPI compared to CPA

Re: Working group for Python CPAN-equivalence?

2010-03-03 Thread Stefan Behnel
Stefan Behnel, 03.03.2010 13:52: Olof Bjarnason, 03.03.2010 13:45: The "Where is CPAN for Python?" question keeps popping up, with answers ranging from "There is no CPAN for Python" and "We already have CPAN for Python" (confusing). It confuses me that you

Re: SOAP 1.2 Python client ?

2010-03-03 Thread Stefan Behnel
to: http://effbot.org/zone/element-soap.htm Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Partly erratic wrong behaviour, Python 3, lxml

2010-03-04 Thread Stefan Behnel
et/mailman/listinfo/lxml-dev Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Partly erratic wrong behaviour, Python 3, lxml

2010-03-05 Thread Stefan Behnel
Jussi Piitulainen, 04.03.2010 22:40: Stefan Behnel writes: Jussi Piitulainen, 04.03.2010 11:46: I am observing weird semi-erratic behaviour that involves Python 3 and lxml, is extremely sensitive to changes in the input data, and only occurs when I name a partial result. I would like some help

Re: compiler with python

2010-03-07 Thread Stefan Behnel
mohamed issolah, 06.03.2010 14:07: I want to create a compiler which transform a code like pascal code (that what I do in C) to "quad" In C, I use BISON and FLEX tools. Hi, please stop starting new threads for the same topic. Instead, reply to responses you get. Stefa

Re: a simple def how-to

2010-03-07 Thread Stefan Behnel
ot;ranges" seems to fall into the same bucket, but I guess that's just because I can't extract the meaning from your code snippet (which is not a good sign). Try to use expressive names in your code, so that people who look at it for the first time get an idea about what it does with what kind of data. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: The C language like the Python, by the Python and for the Python --- PythoidC

2010-03-07 Thread Stefan Behnel
thing comparable, but I doubt it. Just out of curiosity, is this syntax converter actually used for any real projects? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: running a program on many processors

2010-03-07 Thread Stefan Behnel
virtual machine. http://fperez.org/py4science/ucb/talks/20091118_copperhead_bcatanzaro.pdf Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: remove element with ElementTree

2010-03-09 Thread Stefan Behnel
only have an element. see http://effbot.org/zone/element.htm#accessing-parents Also note that there is an independent ElementTree implementation called lxml.etree, which has parent pointers. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: remove element with ElementTree

2010-03-09 Thread Stefan Behnel
nk the easiest is to iterate not over the elements themselves, but over their parents, and then to remove all children of the specified tag in each step. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Are there in Python some static web site generating tools like webgen, nanoc or webby in Ruby ?

2010-03-09 Thread Stefan Behnel
in Python ? Here's a still incomplete but not so short list of web frameworks in Python: http://wiki.python.org/moin/WebFrameworks You might be interested in the templating frameworks if all you want is generate static pages. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Anything like "Effective Java" for Python?

2010-03-10 Thread Stefan Behnel
Chris Withers, 10.03.2010 17:46: kj wrote: Subject line pretty much says it all: is there a book like "Effective Java" oxymoronic, no? Sorry, couldn't resist ;-) Nothing to excuse for. I thought exactly the same thing. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Anything like "Effective Java" for Python?

2010-03-11 Thread Stefan Behnel
vestate.com/recipes/langs/python/ Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: file seek is slow

2010-03-12 Thread Stefan Behnel
language but rather restricts Python syntax to C language features (plus a bit of header file introspection, it seems, but C's preprocessor has a bit of that, too). Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: file seek is slow

2010-03-12 Thread Stefan Behnel
ed a for loop in your C code. Finally, I'm not sure why you think that these 30% matter at all. In your original post, you even state that seek-time isn't the "deal breaker", so maybe you should concentrate on the real issues? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Large regular expressions

2010-03-15 Thread Stefan Behnel
? Could anyone suggest other methods of these kind of string matching in Python? If what you are trying to match is in fact a set of strings instead of a set of regular expressions, you might find this useful: http://pypi.python.org/pypi/acora Stefan -- http://mail.python.org/mailman/listinfo

Re: extract occurrence of regular expression from elements of XML documents

2010-03-16 Thread Stefan Behnel
sing the regexp. That's doable in a couple of lines. But unless you provide more information, it's hard to give better advice. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: import antigravity

2010-03-16 Thread Stefan Behnel
eback (most recent call last): File "", line 1, in ? ImportError: No module named antigravity Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: C-API PyObject_Call

2010-03-16 Thread Stefan Behnel
moerchendiser2k3, 16.03.2010 17:08: But the stack is empty after PyObject_Call, isnt it? I think Steve was expecting that you wanted to debug into your program, step into the call, and find the line yourself. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: C-API PyObject_Call

2010-03-16 Thread Stefan Behnel
the return value of PyObject_Call is? Could you explain what you want to do with this information and in what cases you need it? Do you want to extract the information programmatically at runtime? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: C-API PyObject_Call

2010-03-16 Thread Stefan Behnel
also for non-Python functions. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: import antigravity

2010-03-16 Thread Stefan Behnel
27;ll just know it! Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: C++ code generation

2010-03-16 Thread Stefan Behnel
) It would be nice if you could start reading the posts before you answer, and then try to give an answer that fits the question. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python bindings tutorial

2010-03-17 Thread Stefan Behnel
execute it. The subprocess module is the tool of choice here. To use a DLL, link against it. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python bindings tutorial

2010-03-17 Thread Stefan Behnel
Dave Angel, 17.03.2010 12:14: Stefan Behnel wrote: I think the point here is that executable binaries are not supposed to be used as libraries. Libraries are. That's the difference between a DLL and an executable in the first place. To run an executable, execute it. The subprocess module i

Re: Swapping Content of Two Dictionaries.

2010-03-17 Thread Stefan Behnel
for and how they are supposed to be used by your own code and by external code. That will allow us to give an advice on how to design your module better. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: C-API PyObject_Call

2010-03-18 Thread Stefan Behnel
moerchendiser2k3, 17.03.2010 23:35: 1) put the line number information into the message string when you raise the exception you mean the line and file information of the C code, right? Funny that you (being the OP) ask *me* what kind of line information *you* want. Stefan -- http

Re: import antigravity

2010-03-18 Thread Stefan Behnel
an apology. Otherwise, it becomes grounds for an abuse complaint to your ISP. I hope you just had a bad day. Threatening others for figuring out your e-mail address is even worse than posting with an illegal e-mail address. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: import antigravity

2010-03-18 Thread Stefan Behnel
were not aware that you're posting your mail address in plaintext in every article? Uhm - where? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: C-API PyObject_Call

2010-03-18 Thread Stefan Behnel
moerchendiser2k3, 18.03.2010 14:58: Funny that you (being the OP) ask *me* what kind of line information *you* want. Stefan Well, I need the line/file information of Python : Then please explain what kind of Python line number you expect to find in C code. Hint: providing details often

Re: C-API PyObject_Call

2010-03-19 Thread Stefan Behnel
guess. Could you explain why you want to know the line number? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: C-API PyObject_Call

2010-03-20 Thread Stefan Behnel
r, after all. Again, take a look at Cython, where you can do the introspection in Python code. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: GC is very expensive: am I doing something wrong?

2010-03-22 Thread Stefan Behnel
line the word 'might' in the second. As this newsgroup shows, very often it's enough to look for a better algorithmic approach first. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: GC is very expensive: am I doing something wrong?

2010-03-23 Thread Stefan Behnel
is possibility, common string hash functions make it so rare in practice that a hash table will almost always outperform a trie for exact lookups. If it happens, it will either show up clearly enough in benchmarks or not be worth bothering. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode blues in Python3

2010-03-23 Thread Stefan Behnel
hon2 program and don't want to rewrite everything that uses that script. Are you writing text or binary data to stdout? Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: 'gcc' failed with exit status 1

2010-03-23 Thread Stefan Behnel
switches to the new 'io' module and works around this issue in older Python versions is available: http://hg.cython.org/cython-devel/raw-rev/751bdd38b55c That being said, the simplest way to work around this issue is to switch to Unix line endings in your source file. Most ed

Re: C-API: Extract information from function object

2010-03-25 Thread Stefan Behnel
about exception handling but rather about reporting incorrect return values. This is a good example when you need a reason why not to split threads on the same subject... Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: sum for sequences?

2010-03-25 Thread Stefan Behnel
(which defaults to 0). What part of that suggested to you that sum might not be polymorphic? Sure, it says numbers (which should be changed, in my opinion), but it doesn't specify what sort of numbers -- ints, floats, or custom types that have an __add__ method. WTF. Warning: trut

Re: Revisiting Generators and Subgenerators

2010-03-25 Thread Stefan Behnel
ask you to come back with an implementation that has proven to be useful in practice. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: [C-API] malloc error in PyDict_New

2010-03-26 Thread Stefan Behnel
d first. See the PyInterpreterState and PyThreadState functions here: http://docs.python.org/c-api/init.html Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: I'm looking for html cleaner. Example : convert my title => < h1>my title…

2010-03-29 Thread Stefan Behnel
h a helper package to do this "clean" processing. Take a look at lxml.html.clean first. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie with a encoding question, please help

2010-04-01 Thread Stefan Behnel
e conversion to a unicode string. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie with a encoding question, please help

2010-04-01 Thread Stefan Behnel
scrapy about the expected page encoding, so that it can return correctly decoded unicode strings directly, instead of resorting to dirty hacks that may or may not work depending on the page you are parsing. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: off topic but please forgive me me and answer

2010-04-02 Thread Stefan Behnel
)) + (math.log(1)/math.log(2) - math.log(2)/math.log(2)))*math.log(2)) 0.25 The above can be rewritten as print('0.25') which is much faster and also a lot more readable. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Is Unladen Swallow dead?

2010-11-20 Thread Stefan Behnel
; being a list, even if static analysis can't prove that. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Arrays

2010-11-24 Thread Stefan Behnel
, a deque is a better option. In any case, if you tell us more about what you actually want to do, we can give better suggestions. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: AIX 5.3 - Enabling Shared Library Support Vs Extensions

2010-11-25 Thread Stefan Krah
.o > -L/usr/local/lib *-lpython2.6* -o build/lib.aix-5.3-2.6/cStringIO.so Try these flags: -L. -L/usr/local/lib If this solves the problem and the issue is also present in Python-2.7, you should report a bug at http://bugs.python.org/ . Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: TDD in python

2010-11-28 Thread Stefan Behnel
Rustom Mody, 28.11.2010 11:58: Does anyone know of something like this for python? http://www.vimeo.com/13240481 The page seems to require a recent version of the Flash player. Could you describe what exactly you are looking for? Stefan -- http://mail.python.org/mailman/listinfo/python

Re: Python 3.1.3

2010-11-28 Thread Stefan Behnel
nary? (and, if the latter, from where?) Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing markup.

2010-11-29 Thread Stefan Behnel
27;) # should print [,] Yep, either use lxml.etree's HTML parser or lxml.html. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: SAX unicode and ascii parsing problem

2010-11-30 Thread Stefan Behnel
u should open the file with a well defined encoding (using codecs.open() or io.open() in Python >= 2.6), and then write the unicode strings into it just as you get them. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling FORTAN dll functions from Python

2010-12-07 Thread Stefan Behnel
Alex van der Spek, 07.12.2010 12:11: Does anyone know how to call functions from FORTRAN dlls in Python? Is it even possible? Sure, have a look at fwrap and Cython. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python critique

2010-12-10 Thread Stefan Behnel
Python 3. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python critique

2010-12-10 Thread Stefan Behnel
sier to keep it portable across CPython versions (and C compilers). It's also a lot easier to write it in the first place. Note also that Py3.2 introduces a stable ABI for extension modules. This implies a stable API as well. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python critique

2010-12-10 Thread Stefan Behnel
different variable within the block. Yep, keeps you from writing bad style code like the above. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Python critique

2010-12-10 Thread Stefan Behnel
John Nagle, 11.12.2010 00:51: On 12/10/2010 3:25 PM, Stefan Behnel wrote: Benjamin Kaplan, 11.12.2010 00:13: On Fri, Dec 10, 2010 at 5:46 PM, Octavian Rasnita wrote: The only scopes Python has are module and function. There's more. Both a lambda, and in Python 3.x, list comprehen

Re: Bind C++ program for use with both Python 2.x and 3.x

2010-12-12 Thread Stefan Behnel
.x versions), as the runtimes are not binary compatible. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: PyArg_ParseTuple question

2010-12-15 Thread Stefan Behnel
g. Even if you have already written a major part of your code in C, it's worth considering to (re-)write the Python API wrapper parts in Cython if you need better performance. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Is text processing with dicts a good use case for Python cross-compilers like Cython/Pyrex or ShedSkin?

2010-12-16 Thread Stefan Behnel
moving forward. If 3x is not enough for you, I strongly suggest you try Cython. The C code that it generates compiles nicely in all major Python versions, currently from 2.3 to 3.2. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Read / Write OpenOffice SpreadSheet ?

2010-12-17 Thread Stefan Behnel
=search&term=openoffice Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: PyUNO [Was: Read / Write OpenOffice SpreadSheet ?]

2010-12-17 Thread Stefan Behnel
guaranteed to work, either. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating custom types from C code

2010-12-17 Thread Stefan Behnel
still own the reference when it returns and have to manually decref it (again, a thing that you won't usually have to care about in Cython). So, yes, the above leaks one reference for each call to Py_BuildValue(). Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating custom types from C code

2010-12-20 Thread Stefan Behnel
type from C code. Maybe I'm over-thinking this whole thing. Is there a simple way that I can define a class in Python and instantiate that type from C? Sure, see my previous comments to your original mail. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to parse a HUGE(1gb) xml file

2010-12-21 Thread Stefan Behnel
ory, but even after 30-40 mins, nothing happens. I dont get an error, seg fault or out_of_memory exception. You need to process the document as a stream of elements; aka SAX. IMHO, this is the worst advice you can give. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to parse a HUGE(1gb) xml file

2010-12-21 Thread Stefan Behnel
examples that will help you here. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: lxml etree question

2010-12-25 Thread Stefan Behnel
ST NOT be declared as the default namespace. """ http://www.w3.org/TR/REC-xml-names/#ns-decl lxml knows about this special case, so you can write {http://www.w3.org/XML/1998/namespace}lang and lxml will take care of using the right prefix. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to parse a HUGE(1gb) xml file

2010-12-25 Thread Stefan Behnel
Steve Holden, 25.12.2010 16:55: On 12/23/2010 4:34 PM, Stefan Sonnenberg-Carstens wrote: For large datasets I always have huge question marks if one says "xml". But I don't want to start a flame war. I agree people abuse the "spirit of XML" using it to transfer g

Re: Trying to parse a HUGE(1gb) xml file

2010-12-26 Thread Stefan Behnel
he storage layout before hand. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to parse a HUGE(1gb) xml file

2010-12-26 Thread Stefan Behnel
Tim Harig, 26.12.2010 10:22: On 2010-12-26, Stefan Behnel wrote: Tim Harig, 26.12.2010 02:05: On 2010-12-25, Nobody wrote: On Sat, 25 Dec 2010 14:41:29 -0500, Roy Smith wrote: Of course, one advantage of XML is that with so much redundant text, it compresses well. We typically see gzip

Re: lxml etree question

2010-12-26 Thread Stefan Behnel
Jim, 26.12.2010 00:32: On Dec 25, 5:33 am, Stefan Behnel wrote: lxml knows about this special case, so you can write {http://www.w3.org/XML/1998/namespace}lang and lxml will take care of using the right prefix. Stefan, thank you for the software, which has helped me a great deal

Re: Trying to parse a HUGE(1gb) xml file

2010-12-27 Thread Stefan Behnel
Alan Meyer, 27.12.2010 21:40: On 12/21/2010 3:16 AM, Stefan Behnel wrote: Adam Tauno Williams, 20.12.2010 20:49: ... You need to process the document as a stream of elements; aka SAX. IMHO, this is the worst advice you can give. Why do you say that? I would have thought that using SAX in

Re: Trying to parse a HUGE(1gb) xml file

2010-12-27 Thread Stefan Behnel
inary format that stores the above information in 1 bit. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to parse a HUGE(1gb) xml file

2010-12-27 Thread Stefan Behnel
Alan Meyer, 28.12.2010 03:18: By the way Stefan, please don't take any of my comments as complaints. I don't. After all, this discussion is more about the general data format than the specific tools. I use lxml more and more in my work. It's fast, functional and pretty

Re: Trying to parse a HUGE(1gb) xml file

2010-12-27 Thread Stefan Behnel
Alan Meyer, 28.12.2010 01:29: On 12/27/2010 4:55 PM, Stefan Behnel wrote: From my experience, SAX is only practical for very simple cases where little state is involved when extracting information from the parse events. A typical example is gathering statistics based on single tags - not a very

Re: Interning own classes like strings for speed and size?

2010-12-28 Thread Stefan Behnel
le is, well, new, it will not be equal (read: identical) to any cached tuple, thus resulting in a new entry regardless of its content. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Removing an attribute from html with Regex

2010-12-30 Thread Stefan Behnel
assume "rml_accept" is the real name of the attribute? You may be able to do this with a look-ahead expression, e.g.: replace = re.compile('(wrong_tag\s*=\s*[^>=]*)(?=>|\s+\w+\s*=)').sub html_data = replace('', html_data) The trick is to match everything up to the next character that looks reasonable again, i.e. a closing tag character (">") or another attribute. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Digitally Signing a XML Document (using SHA1+RSA or SHA1+DSA)

2010-12-30 Thread Stefan Behnel
Jorgen Grahn, 30.12.2010 10:41: If you really *do* have a requirement to make the result XML-like and incompatible with anything else, I'm afraid you're on your own Well, there's always xmlsec if you need it. http://www.aleksey.com/xmlsec/ Stefan -- http://mail.python.org/m

Re: Tkinter: The good, the bad, and the ugly!

2010-12-30 Thread Stefan Behnel
it. http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ (the site is currently broken for me, you can use the following instead: http://webcache.googleusercontent.com/search?q=cache:WsGrJKw6ABoJ:www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ Stefan -- http://mail.python.org/mailman/listi

Re: Tkinter: The good, the bad, and the ugly!

2010-12-30 Thread Stefan Behnel
rantingrick, 30.12.2010 17:02: On Dec 30, 9:52 am, Stefan Behnel wrote: I hope you invested as much time into writing this "expose" as you did searching the web before writing it. in my second post i said... """However i need to stress that my intention is towards

Re: using python ftp

2010-12-30 Thread Stefan Schwarzer
e somewhere? ftputil will do most of these tasks easily. For step 4 you probably want to use Python's fnmatch module, see http://docs.python.org/library/fnmatch.html . If you have questions on ftputil, there's also a mailing list: http://ftputil.sschwarzer.net/trac/wiki/MailingLi

Re: How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-01 Thread Stefan Behnel
so older Python versions will consider it a syntax error. To support older Python versions, you need to write your own wrapper functions for bytes literals that do nothing in Python 2 and convert the literal back to a bytes literal in Python 3. That's ugly, but there's no other way to do it. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: How to port bytes formatting to Python 3.x ?

2011-01-01 Thread Stefan Behnel
his topic. You need to wrap the literal in a function call that converts it to a bytes literal when running in Python 3. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: How to port bytes formatting to Python 3.x ?

2011-01-01 Thread Stefan Behnel
Baptiste Lepilleur, 01.01.2011 12:53: 2011/1/1 Stefan Behnel Baptiste Lepilleur, 01.01.2011 10:01: I'm trying to port a small library to Python 3.x, and I'm wondering what is the best way to port statements such as the one belows that are frequently found in network protocol impl

Re: How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-02 Thread Stefan Behnel
ings out of the immediate sight of someone reading the sources, and that it requires the two string modules to be kept in sync. But at least for the synchronisation, a simplistic conversion tool run during installation could do the trick. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem inserting an element where I want it using lxml

2011-01-04 Thread Stefan Behnel
create a sibling for? if subElem == elem: There is an .index() method on Elements that does what you want to achieve here. However, the right way to do it is to use ".addnext()". http://codespeak.net/lxml/api/lxml.etree._Element-class.html Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating custom Python objects from C code

2011-01-05 Thread Stefan Behnel
lder Python versions and PyCapsule in Py2.7 and Py3.1+. Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: Attaching C++ libraries to Python app.

2011-01-06 Thread Stefan Behnel
Stefan Sonnenberg-Carstens, 06.01.2011 07:08: Am 05.01.2011 23:44, schrieb Rohit Coder: I am just asking. In future I may need to import any C++ library, not a Crypto, but some other. Is it possible? Yes. There are at least five possible ways: - Handcode the interface and glue code (http

Re: Resolve circular reference

2011-01-10 Thread Stefan Behnel
urces. Objects within a reference cycle will eventually get cleaned up, just not right away and not in a predictable order. If you need immediate cleanup, you should destroy the reference cycle yourself, e.g. by removing the widgets from the dialog when closing it. Stefan -- http://mail.pytho

[ANN] cdecimal-2.2 released

2011-01-10 Thread Stefan Krah
aefa00fef cdecimal-2.2-no-thread.win-amd64-py2.7.msi 413724ff20ede7b648f57dd9a78a12e72e064583 cdecimal-2.2-no-thread.win-amd64-py3.1.msi Stefan Krah -- http://mail.python.org/mailman/listinfo/python-list

Re: Resolve circular reference

2011-01-10 Thread Stefan Behnel
moerchendiser2k3, 10.01.2011 22:19: On Jan 10, 7:18 pm, Stefan Behnel wrote: moerchendiser2k3, 10.01.2011 18:55: If you can tell us why it's so important that the object be destroyed at that given time, even while a reference to it exists, maybe we can give you better suggestions. T

Re: String to char and decimal number conversion

2011-01-11 Thread Stefan Behnel
SANKAR ., 11.01.2011 01:00: I am reading a Test.txt (see atatchment) file using following code to get the T2: F =open('C:\Test.txt','r') T1 = F.readlines() for i in range(len(T1)): T2 = T1[i].split(',') print(T2) Take a look at the "csv"

Re: GURU NEEDED : break a command into several lines and comment each line

2011-01-13 Thread Stefan Monnier
mand$(: # comment1 )-sw1 $(: # comment2 )-sw2 $(: # comment3 ) arguments -- Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: python 3 and Unicode line breaking

2011-01-14 Thread Stefan Behnel
question at hand and has no point other than polluting people’s mailboxes. http://www.catb.org/~esr/faqs/smart-questions.html#beprecise http://www.catb.org/~esr/faqs/smart-questions.html#volume Stefan -- http://mail.python.org/mailman/listinfo/python-list

Re: python 3 and Unicode line breaking

2011-01-14 Thread Stefan Behnel
would have helped in answering. Stefan -- http://mail.python.org/mailman/listinfo/python-list

<    12   13   14   15   16   17   18   19   20   21   >