Re: Problems wth os.stat().st_mtime on Mac

2006-09-29 Thread Martin v. Löwis
Michael Glassford schrieb: > Although not mentioned in the Python 2.5 News, apparently there was a > similar change on Mac that I'm having some problems with. On the Mac, > just as on Windows, os.stat().st_mtime now returns a float instead of an > integer. It's isn't really new; os.stat_float_time

Re: MySQLdb for Python 2.5

2006-09-30 Thread Martin v. Löwis
Harold Trammel schrieb: > Does anyone know the status of a version of MySQLdb that will work with > Python 2.5? AFAICT, MySQLdb 1.2.1 builds and works just fine. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Martin v. Löwis
Hari Sekhon schrieb: > I'm sorry, this may seem dense to you but I have to ask. What on earth > are you talking about? You may not be dense, but you are certainly fairly aggressive in your postings. If you just want to complain, go ahead. If you want actual help, you should reconsider your tone.

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Martin v. Löwis
Giovanni Bajo schrieb: > I just read this mail by Brett Cannon: > http://mail.python.org/pipermail/python-dev/2006-October/069139.html > where the "PSF infrastracture committee", after weeks of evaluation, > recommends > using a non open source tracker (called JIRA - never heard before of course)

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Martin v. Löwis
Ben Finney schrieb: > I would be greatly dismayed to see the PSF choosing to move critical > Python development data into a non-free system. Then volunteer to help operating the Roundup installation. It will become reality if there are enough volunteers to keep it running. > I hope this > recomm

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Martin v. Löwis
Paul Rubin schrieb: > Sounds crazy, what's wrong with bugzilla? Nobody offers to operate it: that's wrong. We put out a call for trackers, and nobody (niemand, nirgendwo) was willing to setup a bugzilla installation, work on an SF data import, and offered to operate this installation for the perio

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Martin v. Löwis
Paul Rubin schrieb: > Ben Finney <[EMAIL PROTECTED]> writes: >> The existing SourceForge system runs on non-free software, which is a >> significant differentiator from Bugzilla. > > The SourceForge software, at least in some versions, is free software. > See for example http://savannah.gnu.org fo

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Martin v. Löwis
Paul Rubin schrieb: > "Martin v. Löwis" <[EMAIL PROTECTED]> writes: >> It is a fork of an old version. Existence of this version hasn't helped >> a bit when we tried to get our data out of sf.net. > > Yeah, I'd guessed it might be a fork. Is

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-17 Thread Martin v. Löwis
Leo Kislov schrieb: > How about returning two lists, first list contains unicode names, the > second list contains undecodable names: > > files, troublesome = os.listdir(separate_errors=True) > > and make separate_errors=True by default in python 3.0 ? That would be quite an incompatible change,

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-17 Thread Martin v. Löwis
gabor schrieb: > depends on the application. in the one where it happened i would just > display an error message, and tell the admins to check the > filesystem-encoding. > > (in other ones, where it's not critical to get the correct name, i would > probably just convert the text to unicode using

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-19 Thread Martin v. Löwis
gabor schrieb: > 1. simply fix the documentation, and state that if the file-name cannot > be decoded into unicode, then it's returned as byte-string. For 2.5, this should be done. Contributions are welcome. [...then] > [os.path.join(path,n) for n in os.listdir(path)] > > will not work. > > 2.

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-19 Thread Martin v. Löwis
gabor schrieb: >> I may have missed something, but did you present a solution that would >> make the case above work? > > if we use the same decoding flags as binary-string.decode(), > then we could do: > > [os.path.join(path,n) for n in os.listdir(path,'ignore')] That wouldn't work. The charact

Re: who is maintainer of xml-rpc module?

2006-11-26 Thread Martin v. Löwis
Mark Harrison schrieb: > So, I've made a couple of small but useful additions to > the xml-rpc package. Is there an assigned maintainer > of the package I should communicate with? The author of the module is Fredrik Lundh; you can try to contact him. If you want to contribute your changes to the

Re: --enable-shared, how do i set the rpath?

2006-11-27 Thread Martin v. Löwis
Mark Harrison schrieb: > I've built a python with --enable-shared in order to support mod_python, Why do you think you have to build with --enable-shared to support mod_python? I'd try to avoid --enable-shared if possible. It has undesirable consequences... > but now I have to set LD_LIBRARY_PATH

Re: Python 2.4 does not marshal infinity floating point properly under Win32

2006-11-30 Thread Martin v. Löwis
Pierre Rouleau schrieb: > Is this considered an important enough bug to fix it in Python 2.4? To the contrary - it's not considered a bug at all. Python didn't make any promises about "unregular" floating point values, so things like that just may happen. The fix that made Python offer stronger g

Re: Python25.zip

2006-12-02 Thread Martin v. Löwis
Colin J. Williams schrieb: > The role of Python25.zip is not clear. Is it required in the path just > to enable the import X.zip capability? To rephrase Georg's explanation: it allows Python distributors (e.g. Linux distributors, or ActiveState) to put all of the Python library (including site.py

Re: python 2.5 install from source problem

2006-12-02 Thread Martin v. Löwis
Fabian Braennstroem schrieb: > I just tried to install python 2.5 from source on my > ScienticLinux (Redhat Clone) machine. It seems to work > without any problem, at least I am able to run some of my > old scripts. I installed it with './configure > --prefix=/opt/python make make altinstall', but

Re: Python 2.5 bindings for Subversion 1.4.2 on Win32 binary

2006-12-02 Thread Martin v. Löwis
patkinson schrieb: > Great python Projects like TRAC or DJANGO are the "keys" to a wide > acceptance of python. Making this easy to the final users is (in my > opinion) a survival question for the future of Python. Please note that threatening is useless most of the time in free software. Very few

Re: os.mkdir and mode

2006-12-02 Thread Martin v. Löwis
Nick Craig-Wood schrieb: > So it looks like python mkdir() is applying the umask where as > /bin/mkdir doesn't. From man 2 mkdir Actually, mkdir(1) has no chance to not apply the umask: it also has to use mkdir(2), which is implemented in the OS kernel, and that applies the umask. Try strace mkd

Re: Deleting from a list while iterating

2006-12-03 Thread Martin v. Löwis
Rhamphoryncus schrieb: > setapproach = """\ > def func(count): > from random import random > items = [random() for i in xrange(count)] > remove = set() > for index, x in enumerate(items): > #...do something... > if x < 0.5: > remove.add(index) > items

Re: Deleting from a list while iterating

2006-12-03 Thread Martin v. Löwis
Rhamphoryncus schrieb: >> This is different from the other approaches in that it doesn't >> modify items. If you wanted a new list, you could incrementally >> build one already in the first pass, no need to collect the >> indices first (as BlackJack explains). > > I didn't feel this distinction wa

Re: Why not just show the out-of-range index?

2006-12-04 Thread Martin v. Löwis
Russ schrieb: > I love Python, but every time I get an out-of-range error message, I > wonder why it didn't just tell me what the out-of-range index was and > what the allowable range was. Certainly that information must be > available to the exception handler, or how would it know that it is out >

Re: Why not just show the out-of-range index?

2006-12-04 Thread Martin v. Löwis
Russ schrieb: > My suggestion that it would be much easier for the Python maintainers > than for me to implement the requested feature is just basic common > sense. I would have to spend many hours or days just to familiarize > myself with the code, but they are obviously already very familiar with

Re: Why not just show the out-of-range index?

2006-12-04 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > Thanks for explaining why the OP was rude. Having been > reading and listening to english for only a few decades > probably, I am sure the OP (and me too!) appreciates your > explanation of rudeness You mean, you don't feel insulted if somebody calls you silly? Regar

Re: Why not just show the out-of-range index?

2006-12-04 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: >>> Rather, they (like I) will encourage to OP to submit >>> a patch that fixes the problem. >> Now, that would be rather silly. I would have to familiarize >> myself with the code for the Python interpreter, > > Seems to me he called the suggestion (made without any > k

Re: No latin9 in Python?

2006-12-06 Thread Martin v. Löwis
Christoph Zwerschke schrieb: > Is there anything speaking against adding these as aliases? If no, I > would submit a patch. (Also, Python does not support the > latin10=iso8859-16 charset. I could try to add that as well.) Python tries to follow the IANA charset registry. http://www.iana.org/assi

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

2006-12-07 Thread Martin v. Löwis
Jim Tittsler schrieb: > Is there a standard recipe for getting the subversion revision number > into my Python-based application each time I package it up with > distutils? (Not just the package name, but also a string that I will > display in my app's "About" dialog.) You can't really use subver

Re: sys.stdin.encoding

2006-12-11 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > The following line in my code is failing because sys.stdin.encoding is > Null. This has only started happening since I started working with > Pydef in Eclipse SDK. Any ideas? > > uni=unicode(word,sys.stdin.encoding) That's a problem with pydev, where the standard mach

Re: merits of Lisp vs Python

2006-12-11 Thread Dmitry V. Gorbatovsky
[EMAIL PROTECTED] wrote: >I challenge anyone making psychological > claims about language X (for any X) being easier to either > read/learn/use than language Y (for any Y) to come up with any valid > evidence whatever. Put aside,that I don't understand meaning of term "psychological claim" in tha

Re: sys.stdin.encoding

2006-12-11 Thread Martin v. Löwis
Leo Kislov schrieb: > Environmental variable TERMENCODING ? Heck, maybe this will catch on > and will be used by other languages, libraries, terminals, etc. It's > not really Python only problem. I also considered environment variables. This can likely be made available only in 2.6, though. Plus,

Re: Tarfile .bz2

2006-12-11 Thread Martin v. Löwis
Jordan schrieb: > When using python to create a tar.bz2 archive, and then using winrar to > open the archive, it can't tell what the compressed size of each > individual file in the archive is. Is this an issue with winrar or is > there something that needs to be set when making the archive that i

Re: Tarfile .bz2

2006-12-11 Thread Martin v. Löwis
Jordan schrieb: > Not really on topic anymore but what's the method for tar.gz? It works like .tar.bz2, except that it uses gzip (www.gzip.org) as the compression library. The underlying compression algorithm is LZW. > And > even more off the topic, does anyone know a good lossless compression >

Re: Obtaining SSL certificate info from SSL object - proposal

2006-12-14 Thread Martin v. Löwis
John Nagle schrieb: > SSL certificates are trees, represented in a format, "ASN.1", which > allows storing numbers, strings, and flags. > Fields are identified by names or by assigned "OID numbers" > (see RFC 2459). > > The tree is returned as tuples. The first element of the

Re: No latin9 in Python?

2006-12-15 Thread Martin v. Löwis
Christoph Zwerschke schrieb: > Shall I proceed writing such a patch? Shall I also add latin0 and l0 > which are other inofficial aliases? Sure, go ahead. I see no need for the latin0/l0 aliases, though: they predate the formal adoption of iso-8859-15, and should be phased out by now (I'm sure that

Re: inquiry about installing Python 2.5

2006-12-16 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > If possible, I would like to have both Python 2.4 and Python 2.5 > installed on my workstaiton. I downloaded the .msi for Python 2.5 from > the python.org site. If I run the 2.5 installer, will it give me the > option of keeping Python 2.4 installed on my workstation?

Re: Smarter way to do this? Unicode + stdin, stdout

2006-12-17 Thread Martin v. Löwis
BenjaMinster schrieb: > I want to read and write unicode on stdin and stdout. I can't seem to > find any way to force sys.stdin.encoding and sys.stdout.encoding to be > utf-8, so I've got the following workaround: What operating system are you using? Why do you want to do this? Python attempts to

Re: New os.path.exists() behavior - bug or feature?

2006-12-18 Thread Martin v. Löwis
klappnase schrieb: > When I insert a floppy into A: os.path.exists('A:\\') will return True > on Python-2.5, too. > Does anyone know, is this inconsistent behavior a bug or a new feature? Neither, nor. In both cases, the operating system is asked, and gives this answer. However, in the Windows API

Re: urllib.unquote and unicode

2006-12-19 Thread Martin v. Löwis
Duncan Booth schrieb: > The way that uri encoding is supposed to work is that first the input > string in unicode is encoded to UTF-8 and then each byte which is not in > the permitted range for characters is encoded as % followed by two hex > characters. Can you back up this claim ("is supposed

Re: Support of IPv6 extension headers

2006-12-20 Thread Martin v. Löwis
cychong schrieb: > BTW, is there any way to send the packet with the IPV6 extension header > w/o using sendmsg? That depends on your operating system. Find out whether your operating system supports that; if it does, it is easy to tell whether that is exposed in Python or not. Regards, Martin --

Re: urllib.unquote and unicode

2006-12-21 Thread Martin v. Löwis
>>> The way that uri encoding is supposed to work is that first the input >>> string in unicode is encoded to UTF-8 and then each byte which is not in >>> the permitted range for characters is encoded as % followed by two hex >>> characters. >> Can you back up this claim ("is supposed to work") by

Re: urllib.unquote and unicode

2006-12-22 Thread Martin v. Löwis
Duncan Booth schrieb: > So you believe that because something is only recommended by a standard > Python should refuse to implement it? Yes. In the face of ambiguity, refuse the temptation to guess. This is *deeply* ambiguous; people have been using all kinds of encodings in http URLs. > You do

Re: add encoding to standard encodings works different in python 2.5?

2006-12-22 Thread Martin v. Löwis
henk-jan ebbers schrieb: > - how can i get this to work in 2.5 (nice if it would work in both 2.4 > and 2.5) You should implement a lookup function, and register it with codecs.register. Then you can structure your modules any way you like. Regards, Martin -- http://mail.python.org/mailman/lis

Re: Why does Python never add itself to the Windows path?

2006-12-29 Thread Martin v. Löwis
Ben Sizer schrieb: > I've installed several different versions of Python across several > different versions of MS Windows, and not a single time was the Python > directory or the Scripts subdirectory added to the PATH environment > variable. Every time, I've had to go through and add this by hand,

Re: per interpreter storage for C extensions

2006-12-29 Thread Martin v. Löwis
Robin Becker schrieb: > Is there a simple/cheap way for C code to cache these sorts of module > level globals on a per interpreter basis? Is there even a way to tell > which interpreter I'm being called in? There is no cheap way to add to the interpreter state. As Chris Mellon explains, you can us

Re: xml bug?

2006-12-29 Thread Martin v. Löwis
Imbaud Pierre schrieb: > - how do I spot the version of a given library? There is a __version__ > attribute of the module, is that it? Contrary to what others have said: for modules included in the standard library (and if using these modules, rather than using PyXML), you should use sys.version

Re: xml bug?

2006-12-29 Thread Martin v. Löwis
Imbaud Pierre schrieb: > But python.org was the right entry point, it sent me to the bug > tracker: http://sourceforge.net/tracker/?group_id=5470&atid=105470 > Its a bit short on explanations... And I found unsolved issues, > 3 years old! That's true, and likely to grow. Contributions are welcome!

Re: Minor problem with configure (2.4.4)

2006-12-29 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > configure.in:273: error: possibly undefined macro: AC_UNDEFINE > If this token and others are legitimate, please use > m4_pattern_allow. > See the Autoconf documentation. > > Ideas? RTFM (autoconf documentation, in this case). There is no AC_UNDEFINE. Reg

Re: bad marshal data in site.py in fresh 2.5 install win

2006-12-29 Thread Martin v. Löwis
TiNo schrieb: > # G:\Python25\lib\encodings\aliases.pyc matches [...] > File "F:\Python25\lib\encodings\__init__.py", line 32, in > > What can I do about this? Where does F:\Python25 come from? If you have set any PYTHON* environment variables (e.g. PYTHONPATH), unset them. Regards, Martin --

Re: per interpreter storage for C extensions

2006-12-30 Thread Martin v. Löwis
Robin Becker schrieb: > What is worrying is that in the extension init we're creating an > exception and version string etc and holding a pointer to them in C; is > it safe to use the same exception in different interpeters? It is safe as long as the base exception classes are also shared across

Re: Why does Python never add itself to the Windows path?

2007-01-03 Thread Martin v. Löwis
Ben Sizer schrieb: > Firstly, that solution only works for actual Python scripts; it doesn't > solve the utility scripts that are often installed to the /scripts > directory. Those packages should install .bat files into /scripts on Windows. > It's a shame that many responses on this thread don't

Re: Why does Python never add itself to the Windows path?

2007-01-03 Thread Martin v. Löwis
vbgunz schrieb: > I don't understand what all the fuss is about. Add a single page to the > installer and on it, have 3 radio buttons. The choices could be "add to > path (recommended)", "add to path with version", "do not add to path > (not recommended)". Please submit a patch to sf.net/projects/

Re: Filename encoding on XP

2007-01-03 Thread Martin v. Löwis
kent sin schrieb: > What encoding does the NTFS store the filename? In UTF-16LE. However, on-disk storage is mostly irrelevant, what matters is what encoding is used on the OS API. Windows has two forms of file API: Wide (Unicode) and ANSI (byte-oriented). On NT, the Wide API is "native"; the ANS

Re: bad marshal data in site.py in fresh 2.5 install win

2007-01-03 Thread Martin v. Löwis
TiNo schrieb: > File "F:\Python25\lib\encodings\__init__.py", line 32, in >from encodings import aliases > ValueError: bad marshal data > > also removed site.pyc, and run it again, but with the same result. It's likely rather aliases.pyc which is bad, so try removing that. If in doubt, remo

Re: type classobj not defined?

2007-01-03 Thread Martin v. Löwis
Wesley Brooks schrieb: >> type(b) == classobj > Traceback (most recent call last): > File "", line 1, in ? > NameError: name 'classobj' is not defined > > For the time being I'll use b.__name__ == b to ensure I'm getting the > right class. Is there a reason why the other types such as bool are >

Re: Why does Python never add itself to the Windows path?

2007-01-03 Thread Martin v. Löwis
Ben Sizer schrieb: >> Those packages should install .bat files into /scripts on Windows. > > Which still need their location to be be fully qualified, due to > /scripts not being in the path. This is not my experience with Linux > installations of the same packages. Ah, so you not only want the d

Re: When argparse will be in the python standard installation

2007-01-03 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > I feel argparse has some useful things that optparse doesn't have. But > I can't find it argparse in python library reference. I'm wondering > when it will be available in the python standard installation. On its own, never. Somebody has to contribute it to Python, and

Re: Why does Python never add itself to the Windows path?

2007-01-03 Thread Martin v. Löwis
vbgunz schrieb: >>> I don't understand what all the fuss is about. Add a single page to the >>> installer and on it, have 3 radio buttons. The choices could be "add to >>> path (recommended)", "add to path with version", "do not add to path >>> (not recommended)". >> Please submit a patch to sf.net

Re: Cannot build 2.5 on FC6 x86

2007-01-03 Thread Martin v. Löwis
Paul Watson schrieb: > ./configure > make > make test > > The result appears to hang after the test_tkl... line. I had to kill > the 'make test' process which terminated it. Any suggestions? There isn't (or shouldn't be) any "test_tkl..." line. What precisely was the line, and how long did you

Re: When argparse will be in the python standard installation

2007-01-04 Thread Martin v. Löwis
Steven Bethard schrieb: > If someone has an idea how to include argparse features into optparse, > I'm certainly all for it. But I tried and failed to do this myself, so I > don't know how to go about it. It's not necessary that the implementation is retained, only that the interface is preserved.

Re: minidom utf-8 encoding

2007-01-04 Thread Martin v. Löwis
fscked schrieb: > Hi guys/gals. > > I am trying to write and xml file from data parsed from a csv. > > I can get everything to work except that I cannot get minidom to do --> > ö which needless to say is driving me nuts. > > Any suggestions? Works fine for me: py> d = minidom.Document() py> r

Re: Cannot build 2.5 on FC6 x86

2007-01-04 Thread Martin v. Löwis
Paul Watson schrieb: > Martin v. Löwis wrote: >> Paul Watson schrieb: >>> ./configure >>> make >>> make test >>> >>> The result appears to hang after the test_tkl... line. I had to kill >>> the 'make test' process which t

Re: minidom utf-8 encoding

2007-01-04 Thread Martin v. Löwis
fscked schrieb: > Well, let me clarify. If I just print it to the screen/console it works > fine, but when I do: > > out.write( doc.toprettyxml()) > > it just removes the character that would be the "ö". > > I can post the code if anyone wants to see it, but it is fairly > straightforward. I fi

Re: Using External Libraries with python?

2007-01-04 Thread Martin v. Löwis
Ognjen Bezanov schrieb: > I have some external C libraries I would like to use with python. > > I have been searching on the internet and found many such > modules/bindings for libraries (e.g. Py-Lame) but have not yet > come across any information of how to actually go about creating such > bindi

Re: Best way to implement a timed queue?

2007-01-04 Thread Martin v. Löwis
Thomas Ploch schrieb: > I am having troubles with implementing a timed queue. I am using the > 'Queue' module to manage several queues. But I want a timed access, i.e. > only 2 fetches per second max. I am horribly stuck on even how I > actually could write it. Has somebody done that before? And wh

Re: minidom utf-8 encoding

2007-01-04 Thread Martin v. Löwis
fscked schrieb: > # Create the base element > boxes = doc.createElement("boxes") > myfile = open('ClientsXMLUpdate.txt') > csvreader = csv.reader(myfile) > for row in csvreader: > mainbox = doc.createElement("box") > doc.appendChild(boxes) > r2 = csv.reader(myfile) > b = r2.next()

Re: When argparse will be in the python standard installation

2007-01-05 Thread Martin v. Löwis
rnatively, could the actions become keyword arguments (with the action argument only preserved for backwards compatibility)? E.g. parser.add_option("-v", store_true_into="verbose") parser.add_option("-q", store_false_into="verbose") (same for store, append, count,

Re: PyType_IsSubtype ()

2007-01-05 Thread Martin v. Löwis
Sheldon schrieb: > Can anyone tell me what this error mean: > #0 0x4008376e in PyType_IsSubtype () from /usr/lib/libpython2.3.so.1.0 It's not an error. It is just a frame from the backtrace. To understand the crash better, one would need to see more frames from the backtrace. Ideally, one would

Re: checking one's type

2007-01-05 Thread Martin v. Löwis
belinda thom schrieb: > I've been using the following hack to determine if a type is acceptable > and I suspect there is a better way to do it: > > e.g. > > if type(s) == type("") : >print "okay, i'm happy you're a string" > > If anyone knows a better way, I'm all ears. There are several wa

Re: PyType_IsSubtype ()

2007-01-05 Thread Martin v. Löwis
Sheldon schrieb: > I ran the program in GDB and it crashed giving the following backtrace: > > #0 0x4008376e in PyType_IsSubtype () from /usr/lib/libpython2.3.so.1.0 > #1 0x4047730c in ?? () from > /usr/lib/python2.3/site-packages/Numeric/_numpy.so > > Can you make head or tail of this? Not ye

Re: File Closing Problem in 2.3 and 2.4, Not in 2.5

2007-01-05 Thread Martin v. Löwis
Carroll, Barry schrieb: > What I want to know is: > > * has anyone else encountered a problem like this, * how was the > problem corrected, * can the fix be retro-fitted to 2.5 and 2.4? >From your description, I suspect an error in your code. Your description indicates that you don't expect to ha

Re: Newbie XML SAX Parsing: How do I ignore an invalid token?

2007-01-06 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > My original posting has a funky line break character (it appears as an > ascii square) that blows up my program, but it may or may not show up > when you view my message. Looking at your document, it seems that this "funky line break character" is character \x1E, which

Re: Newbie XML SAX Parsing: How do I ignore an invalid token?

2007-01-07 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > Is there a Pythonic way to read the file and identify any illegal XML > characters so I can strip them out? this would keep my program more > flexible - if the vendor is going to allow one illegal character in > their document, there's no way of knowing if another one w

Re: OpenBSD, Apache and Python

2007-01-07 Thread Martin v. Löwis
Geoff schrieb: > I'm now looking at using fastcgi to run my python. This looks like it's > going to work fine, though I will be using a fcgi interface such as > http://jonpy.sourceforge.net/. There does not seem to be any official > fastcgi module for python. > > Should I be worried about the stab

Re: (newbie) Is there a way to prevent "name redundancy" in OOP ?

2007-01-07 Thread Martin v. Löwis
Stef Mientki schrieb: > Can this be achieved without redundancy ? You can use the registry design to use the object's name also to find the object. In the most simple way, this is registry = {} class pin: def __init__(self, name): registry[name] = self self.name = name pin('aap') prin

Re: Recommendations (or best practices) to define functions (or methods)

2007-01-07 Thread Martin v. Löwis
vizcayno schrieb: > Need your help in the "correct" definition of the next function. If > necessary, I would like to know about a web site or documentation that > tells me about best practices in defining functions, especially for > those that consider the error exceptions management. I agree with

Re: Module to read svg

2007-01-07 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > Does anyone know if there's an actual free implementation of this? For the dom module in it, xml.dom.minidom should work. Depending on your processing needs, that might be sufficient. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommendations (or best practices) to define functions (or methods)

2007-01-08 Thread Martin v. Löwis
Frank Millman schrieb: > If there is something wrong with the SQL statement, I do not want to > crash the server, I want to notify the client that there was something > wrong, so that the offending module can be corrected and reloaded. Right. In a distributed system, you should propagate the error

Re: Module to read svg

2007-01-08 Thread Martin v. Löwis
Robert Kern schrieb: >>> Does anyone know if there's an actual free implementation of this? >> For the dom module in it, xml.dom.minidom should work. Depending on >> your processing needs, that might be sufficient. > > I don't think it quite fits what the OP is asking for. SVG defines some > non-

Re: distutils and ctypes

2007-01-09 Thread Martin v. Löwis
[EMAIL PROTECTED] schrieb: > I suspect that I'm doing something stupid, I would like some other > opinions though. > I'm getting started with ctypes and am trying to use distutils to help > build my module. At the moment I simply want distutils to build a > shared c library (not a python extension!

Re: distutils and ctypes

2007-01-09 Thread Martin v. Löwis
Robert Kern schrieb: >> Not sure it's stupid, but I wonder why you want to use ctypes. What's >> wrong with extension modules? > > What's wrong with ctypes? They're both valid, useful approaches to connect to > C > libraries. See the original posting. Distutils doesn't support building arbitrary

Re: Python - C# interoperability

2007-01-09 Thread Martin v. Löwis
mc schrieb: > Is there an easy way to compile a Python class (or set of classes) into > a .DLL that a C# program can call? Or otherwise to use an existing > library of Python classes from a C# program as seamlessly as possible? You should take a look at IronPython, which supports that kind of thi

Re: What does the -O flag do?

2007-01-09 Thread Martin v. Löwis
Sard schrieb: > "Optimize generated bytecode (also PYTHONOPTIMIZE=x). Asserts are > suppressed." > > Is removing asserts all it does, where can I find more details? I'm > guessing it's not very useful as I hardly ever see it mentioned. It somewhat depends on the Python version. To find out preci

Re: Some thoughts on garbage collection

2006-01-23 Thread Martin v. Löwis
Frank Millman wrote: > In principle I agree. My concern was that I might have inadvertently > done something wrong (e.g. left a reference dangling) which would > prevent gc from removing all objects which I wanted to be removed. Depends on what it really is that you want to know. If you want to kn

Re: os.unlink() AND win32api.DeleteFile()

2006-01-23 Thread Martin v. Löwis
rbt wrote: > Can someone detail the differences between these two? On Windows which > is preferred? They do the same thing: unlink calls DeleteFile. The only difference is how errors are reported. For portability, os.unlink is preferred. Regards, Martin -- http://mail.python.org/mailman/listinf

Re: We have zipimport, how about dllimport?

2006-01-28 Thread Martin v. Löwis
[EMAIL PROTECTED] wrote: > I may be on particularly potent crack, but I was wondering whether it > would make sense to distribute python code in DLLs so that the memory > occupied by the bytecode would be consumed only once even if there were > multiple processes using the same bytecode. Or is ther

Re: Python loading library containing embedded python...

2006-01-29 Thread Martin v. Löwis
Brennus wrote: > I have a dll/so which embeds python. I can verify it works by > compiling it as an executable and adding an appropriate main. Please explain in more detail how you did the embedding. Did you statically link the Python interpreter into your dll/so, or did you use a shared one? > H

Re: Authenticating to Kerberos

2006-01-29 Thread Martin v. Löwis
David wrote: > I don't need to do anything except authenticate and gain the correct > credentials. I normally run kinit(1) to determine whether a password is correct. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python loading library containing embedded python...

2006-01-29 Thread Martin v. Löwis
Brennus wrote: > I have solved my problem, or at least part of it by downgrading > to Visual Studio 2003. For whatever reason, the same steps applied > to Visual Studio 2005 result in massive problems. > > Even the python.exe compiled by VS 2005 throws A/Vs on startup. > > Does Python have to use

Re: Python loading library containing embedded python...

2006-01-29 Thread Martin v. Löwis
Brennus wrote: > I compiled pythoncore.lib. I statically link this to my dll > and define Py_BUILD_CORE before including Python.h. Can you please elaborate? How did you do this? How do you know pythoncore.lib is a static library? What msvcrt is it linked with (use depends.exe to find out)? > The

Re: Python loading library containing embedded python...

2006-01-29 Thread Martin v. Löwis
Alex Martelli wrote: > I believe the python core developers who do develop on Windows have not > even tried VS 2005 and have no intention of so doing for the foreseeable > future. That is not true. I have already tried it. Many others did, too, and found that Microsoft managed to break ISO C comp

Re: Compiling

2006-02-05 Thread Martin v. Löwis
Ravi Teja wrote: > This is a standard response to a rather frequent question here. But I > am not sure I ever understood. Scheme / Lisp are about as dynamic as > Python. Yet they have quite efficient native compilers. Ex: Bigloo > Scheme. You might be missing two details here: 1. those compilers a

Re: Compiling

2006-02-06 Thread Martin v. Löwis
Ravi Teja wrote: > But more often I am looking to use Python libraries > in other languages since I am more familiar with them and they > typically tend to be more high level (the way I like it) than the > standard libraries of others. Ah. In that case, the normal C API should work fine to call in

Re: sys.path and unicode folder names

2006-02-07 Thread Martin v. Löwis
Nir Aides wrote: > Is there a solution or a work around for the sys.path problem with > unicode folder names on Windows XP? > > I need to be able to import modules from a folder with a non-ascii name. If the name is restricted to the CP_ACP code page (i.e. more than ASCII, less then full Unicode)

Re: Python 2.4.2 using msvcrt71.dll on Win and compatibility issues

2006-02-07 Thread Martin v. Löwis
Christoph Zwerschke wrote: > Is there a general strategy to avoid this kind of problems? In general, the only Microsoft-supported strategy is that you must use only a single msvcrt in the entire application. So either recompile PostGres, or recompile Python. In the specific case, having PQprint p

Re: Python 2.4.2 using msvcrt71.dll on Win and compatibility issues

2006-02-07 Thread Martin v. Löwis
Christoph Zwerschke wrote: >> So here is another strategy: flush the stream before going >> into postgres, then obtain the fileno() of the stream, and >> fdopen it with postgres' iostreams library. That might also >> be tricky to implement, but could work. > > > I understand what you mean. But th

Re: Problem with curses and UTF-8

2006-02-07 Thread Martin v. Löwis
Ian Ward wrote: > Any Ideas? I think there is one or more ncurses bugs somewhere. The ncurses documentation suggests that you should link with ncurses_w instead of linking with ncurses - you might try that as well. If it helps, please do report back. Ultimately, somebody will need to debug ncurs

Re: sys.path and unicode folder names

2006-02-08 Thread Martin v. Löwis
Nir Aides wrote: > I can not restrict the name to CP_ACP. > I am interested in the general case of Unicode. So you should implement a patch, and contribute this to sf.net/projects/python. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 2.4.2 using msvcrt71.dll on Win and compatibility issues

2006-02-08 Thread Martin v. Löwis
Christoph Zwerschke wrote: > I think this would only shift the problem. Because then I would have to > convert the msvcr71 stream I get from Python to a msvcrt stream. Using > fileno() (of msvcrt) to get the file descriptor will probably not work. It actually would: #define _fileno(_stream) ((_s

Re: Problem with curses and UTF-8

2006-02-08 Thread Martin v. Löwis
Thomas Dickey wrote: > no need for debugging - it's a well-known problem. UTF-8 uses more than > one byte per cell, normal curses uses one byte per cell. To handle UTF-8, > you need ncursesw. I tried that, but it didn't improve anything. Regards, Martin -- http://mail.python.org/mailman/listin

Re: Problem with curses and UTF-8

2006-02-08 Thread Martin v. Löwis
> I'll test it if someone would dumb down "link with ncursesw instead of > ncurses" a little for me. > > I tried: > ./configure --with-libs="ncursesw5" > > and it failed saying: > checking size of wchar_t... configure: error: cannot compute sizeof > (wchar_t), 77 If that was Python's configure:

<    5   6   7   8   9   10   11   12   13   14   >