Re: Killing threads (was Re: Cancel or timeout a long running regular expression)

2011-09-20 Thread Martin v. Loewis
> Is it just that nobody's implemented it, or is there a good reason for > avoiding offering this sort of thing? I've been considering to implement killing threads several times for the last 15 years (I think about it once every year), and every time I give up because it's too complex and just not

Re: Handling 2.7 and 3.0 Versions of Dict

2011-08-31 Thread Martin v. Loewis
Am 31.08.2011 03:43, schrieb Travis Parks: > I am writing a simple algorithms library that I want to work for both > Python 2.7 and 3.x. I am writing some functions like distinct, which > work with dictionaries under the hood. The problem I ran into is that > I am calling itervalues or values depen

Re: Python 2.7 and cmd on Windows 7 64 (files lost)

2011-06-24 Thread Martin v. Loewis
> Therefore, Windows has a "trick" for mark the file like visible, or not, > in 32 mode. What trick? It's called file system redirection. When you access \windows\system32 in a 32-bit process, you *actually* access \windows\syswow64, which has entirely different files. The same also happens for p

Re: minimal python27.dll?

2011-05-01 Thread Martin v. Loewis
> On the CJK issue, why python ship its own codec, not using OS builtin? The OS doesn't provide all the codecs that Python provides. For the one it does provide, it behaves semantically different in border cases from the ones that come with Python. > If I don't need the full Unicode5.1 can I just

Re: minimal python27.dll?

2011-05-01 Thread Martin v. Loewis
> I have vague recollections that pythonXY.dll could not be statically > linked on Windows, or that doing so causes some serious loss of > functionality. Was this ever true, and is it still? You'll have to rebuild Python to make use of static linkage, of course, but then: it is certainly possible

Re: Python wide-python-build unicode for Windows

2011-04-29 Thread Martin v. Loewis
> But how could i do this in Windows. It's not supported. Hopefully, it will be supported in Python 3.3, due to PEP 393. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: minimal python27.dll?

2011-04-27 Thread Martin v. Loewis
Am 27.04.2011 12:43, schrieb est: > Hi guys, > > I need to ship python runtime environment package on Windows, if I > want to stripping unnessasery functions from python27.dll to make it > as small as possible(and perhaps finally UPX it), which parts of > python27.dll do you think can be removed?

Re: When is PEP necessary?

2011-04-23 Thread Martin v. Loewis
Am 23.04.2011 14:16, schrieb Disc Magnet: > Is PEP necessary to add a new package to the standard library? A PEP is necessary if the proposed change is contentious. If there is widespread agreement that the change is desirable, no PEP is needed. > What if the community just wants to add a new mod

Re: multiple Python 2.7 Windows installations

2011-04-19 Thread Martin v. Loewis
> I tried to create another 2.7 key but regedit wouldn't let me. > So, if I can only have one 2.7 key, it would seem that the routine > GetPythonVersions will only ever get 1 version of 2.7. > Does this mean that it is unsupported to have more than one Python 2.7 > installation on Windows? Exactly

Re: [ANN] Python 2.5.6 Release Candidate 1

2011-04-19 Thread Martin v. Loewis
> Thanks Martin, I'm glad these older releases are still getting important > fixes. > > I notice http://www.python.org/download/releases/2.5.6/NEWS.txt says the > release date was 17 Apr 2010. Presumably that should have said 2011. Thanks for pointing it out. I fixed it in the repository, so it

Re: [ANN] Python 2.5.6 Release Candidate 1

2011-04-18 Thread Martin v. Loewis
Am 18.04.2011 09:59, schrieb Werner F. Bruhin: > On 04/17/2011 11:57 PM, "Martin v. Löwis" wrote: >> >> http://www.python.org/2.5.6 > Just FYI, getting a 404 error on the above. Thanks. There had been a number of glitches which have been corrected. If anything looks still incorrect, please le

Re: Feature suggestion -- return if true

2011-04-17 Thread Martin v. Loewis
>> be expanded to >> >>_temp = expr >>if _temp: return _temp > > This could be simplified to just: > > return expr or None > """ No, it can't be simplified in this way. If there is code after that snippet, then it will get executed in the original version if _temp is false, but won't get

Re: looking for libpython31.a 64bit (missing from python-3.1.3.amd64.msi)

2011-04-13 Thread Martin v. Loewis
Am 13.04.2011 10:17, schrieb Nathan Coulson: > Well, as the subject says, I am looking to find libpython31.a > [win64bit version] for use in a linux to windows 64bit cross compiler > [x86_64-w64-mingw32-gcc], but seems to be missing. I wouldn't call it "missing", but "just not there". I had no i

Re: Sandboxed Python: memory limits?

2011-04-07 Thread Martin v. Loewis
Am 07.04.2011 02:06, schrieb Chris Angelico: > On Thu, Apr 7, 2011 at 6:38 AM, Martin v. Loewis wrote: >> You can adjust the implementations of PyMem_Malloc and PyObject_Malloc. >> This would catch many allocations, but not all of them. If you adjust >> PyMem_MALLOC instead

Re: Sandboxed Python: memory limits?

2011-04-06 Thread Martin v. Loewis
> I have a vague memory of reading somewhere that it's possible to > replace the Python memory allocator. This would be an option, if > there's no simple way to say "your maximum is now 16MB", but I now > can't find it back. Was I hallucinating? You can adjust the implementations of PyMem_Malloc a

Re: Determining version of OpenSSL

2011-04-04 Thread Martin v. Loewis
> import ssl > ssl.OPENSSL_VERSION > > is there a way that this can be done in python2.4? It's annoying but I > need to support python2.4 for a while yet :-( ldd /usr/lib/python2.4/lib-dynload/_ssl.so [...] libssl.so.0.9.8 => /usr/lib/libssl.so.0.9.8 (0x7f6a5a9b7000) [...] HTH, Marti

Re: Guido rethinking removal of cmp from sort method

2011-03-24 Thread Martin v. Loewis
> The cmp argument doesn't depend in any way on an object's __cmp__ > method, so getting rid of __cmp__ wasn't any good readon to also get > rid of the cmp argument So what do you think about the cmp() builtin? Should have stayed, or was it ok to remove it? If it should have stayed: how should it

Re: "in house" pypi?

2011-03-23 Thread Martin v. Loewis
Am 24.03.2011 04:19, schrieb Miki Tebeka: > Greetings, > > My company want to distribute Python packages internally. We would like > something like an internal PyPi where people can upload and easy_install from > packages. > > Is there such a ready made solution? > I'd like something as simple

Re: PyCObject_FromVoidPtr etc.

2011-03-22 Thread Martin v. Loewis
> Is there a way to keep things (almost) as simple as this using the > 'Capsules' ?? Most certainly. Instead of PyCObject_FromVoidPtr, use PyCapsule_New. Either pass NULL as a name, or the class name for additional type-safety. Instead of PyCObject_AsVoidPtr, use PyCapsule_GetPointer. The only di

Re: os.stat bug?

2011-03-21 Thread Martin v. Loewis
> Could it be a problem with the operation system? Is it possible that an > os.stat call requires 100% CPU power from the OS? Or is it a problem > with the Python implementation? There is a chance that the CPU usage actually comes from the thread doing sleep(). If you have a very short sleep time,

Re: 下载 below Download, in python.org site menu

2011-03-06 Thread Martin v. Loewis
It's intentional. Notice that it goes to a different URL than the English download link. Which is a synonym for the English download link (/getit is /download at present) Perhaps a translated page is planned? No, translation is not the motivation at all. Chinese readers will know when to u

Re: 下载 below Download, in python.org site menu

2011-03-06 Thread Martin v. Loewis
Am 06.03.2011 12:18, schrieb Alex Willmer: > On the English version of http://python.org I'm seeing 下载 as a menu > item between Download and Community. AFAICT it's Simplified Chinese > for 'download'. Is it's appearance intentional, or a leak through from > a translation of the entire page? It's i

Re: 2to3 and maketrans

2011-03-03 Thread Martin v. Loewis
Am 03.03.2011 07:58, schrieb Gregory Ewing: > What is the recommended way to write code for 2.7 using > maketrans() on text strings in such a way that it will > convert correctly using 2to3? That depends on how you chose to represent text in 2.7. The recommended way for that (also with 3.x in mind

Re: Looking for some PyPI query help

2011-02-22 Thread Martin v. Loewis
Am 23.02.2011 07:53, schrieb Travis Griggs: > Howdy Python brethren. I'm a Smalltalker, doing a bit of research on > packaging ecospaces, in other languages and environments (I just > finished examining Debian for example). I found what seems to be the > big repository at PyPI. Correct. There is a

Re: Python 3.2 and html.escape function

2011-02-21 Thread Martin v. Loewis
> Well, I just learned something, thank you. I was under the mistaken > impression that adding new functionality after the first alpha release > was not permitted by the Python devs. It's the first beta release after which no new functionality could be added. Regards, Martin -- http://mail.pyt

Re: An amazing one-minute bit of fun at the interactive prompt

2011-02-20 Thread Martin v. Loewis
> eps would be a better name than e. py> ε = 10.0 ** -7; n = 0; z = c = complex(-0.75, ε) py> while abs(z) < 2.0: ... n += 1 ... z = z * z + c ... py> π = n * ε py> print(π) 3.1415926 Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 32-bit on Windows 64-bit

2011-02-11 Thread Martin v. Loewis
Am 11.02.2011 19:41, schrieb Craig Yoshida: > what kind of memory limitations to processes running on 32-bit python > (with 32-bit C extensions like scipy) have on 64-bit Windows? I'm > having occasional MemoryErrors when running a python program on > 64-bit Windows 7 that runs fine on my OS X ma

Re: WxPython versus Tkinter.

2011-01-25 Thread Martin v. Loewis
> You'll find that nearly all software used in Europe (and most other parts) > is internationalized or it wouldn't stand a chance. You mean, in lines of code? I very much doubt that. A lot of software gets written, in particular for web servers, that is only German, around here. Nobody thinks this

Re: WxPython versus Tkinter.

2011-01-24 Thread Martin v. Loewis
> Well i did "expect" that you would at least include some info as to > your OS and version. OS is Linux, wxPython is Debian python-wxgtk2.6 2.6.3.2.2-5+b1. > That would be helpful also. Obviously the > wx.ImageList is barfing. Do you have the Bitmap folder containing the > three images. Did you

Re: WxPython versus Tkinter.

2011-01-23 Thread Martin v. Loewis
> WxPython Challenge 1 code updated... > > * Fixed tab traveral > * Removed hand-holding code > * Removed some cruft > > https://sites.google.com/site/thefutureofpython/home/code-challenges > > Good luck! Still crashes the interpreter. Regards, Martin -- http://mail.python.org/mailman/li

Re: WxPython versus Tkinter.

2011-01-23 Thread Martin v. Loewis
> For something as common as displaying a file browser, it should be as > simple as this: > > import gui_toolkit # whichever > path = gui_toolkit.select_file() > > Something like zenity: > > [steve@sylar ~]$ zenity --file-selection > /home/steve/python/findsingle.py And indeed, it is that si

Re: WxPython versus Tkinter.

2011-01-23 Thread Martin v. Loewis
>> Segmentation fault >> >> [Actually this is the first time in my 10 years of python that Ive >> seen a pure python module segfault :-) ] > > Congratulations genius! However if you are really smart you would have > read the note in the source that says "tested on windows only!". > Segfault. Thank

Re: __pycache__, one more good reason to stck with Python 2?

2011-01-20 Thread Martin v. Loewis
> But you got me thinking... how far back does this behaviour go? = ==> Release 1.1 (11 Oct 1994) <== = - Passing the interpreter a .pyc file as script argument will execute the code in that file. (On the Mac such files can be do

Re: __pycache__, one more good reason to stck with Python 2?

2011-01-20 Thread Martin v. Loewis
> I know I've seen problems executing .pyc files from the shell in the > past... perhaps I was conflating details of something else. Ah, I know! > > [steve@sylar ~]$ chmod u+x toto.pyc > [steve@sylar ~]$ ./toto.pyc > : command not found �� > ./toto.pyc: line 2: syntax error near unexpected token

Re: Efficient python 2-d arrays?

2011-01-17 Thread Martin v. Loewis
> Using numpy, I can create large 2-dimensional arrays quite easily. IIUC (please confirm), you don't need a generic two-dimensional array, but rather an Nx2 array, where N may be large (but the other dimension will always have a magnitude of 2). > Since I want to keep the two elements together d

Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Martin v. Loewis
>> CGI is still used in some places today, hello? > > Yeah, James Cameron made a *ton* of money using it to make Avatar. He used compacted graphite iron in Avatar? I didn't know that. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: How to dump a Python 2.6 dictionary with UTF-8 strings?

2011-01-11 Thread Martin v. Loewis
> What's the right way to get the strings in UTF-8? This will work. I doubt you can get it much simpler in 2.x; in 3.x, your code will work out of the box (with proper syntactical adjustments). import pprint, cStringIO class UniPrinter(pprint.PrettyPrinter): def format(self, obj, context, ma

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

2011-01-01 Thread Martin v. Loewis
> 1. Code running in multiple versions has to be syntactically correct in > every detail all versions in order to be compiled without error. > However, version specific syntax *can* be used in modules that are > conditionally imported and therefore conditionally compiled and executed. I also encou

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

2011-01-01 Thread Martin v. Loewis
>> 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. > > I think the developers expected that most maint

Re: Python3 Web Framework

2010-12-31 Thread Martin v. Loewis
Am 31.12.2010 08:47, schrieb Aman: > Hey all... I just started with Python, and I chose Python3 because it > seemed a subtle choice as compared to doing Pthon 2.x now and then > porting to Python3.x later... I plan to start with Web Development > soon... I wanted to know what all web frameworks are

Re: Is there anyway to run JavaScript in python?

2010-12-30 Thread Martin v. Loewis
Am 30.12.2010 14:52, schrieb crow: > Hi, I'm writing a test tool to simulate Web browser. Is there anyway > to run JavaScript in python? Thanks in advance. See PyV8: http://pypi.python.org/pypi/PyV8 Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: round in 2.6 and 2.7

2010-12-28 Thread Martin v. Loewis
>> "Float-to-string and string-to-float conversions are correctly rounded. >> The round() function is also now correctly rounded." >> >> Not sure that this is correct English; I think it means that the >> round() function is now correct. > > Well, the correct result of the example the OP gave woul

Re: round in 2.6 and 2.7

2010-12-23 Thread Martin v. Loewis
> Type "help", "copyright", "credits" or "license" for more information. 9.95 > 9.9493 "%.16g" % 9.95 > '9.949' round(9.95, 1) > 10.0 > > So it seems that Python is going out of its way to intuitively round > 9.95, while the repr retains the unnecessary digit

Re: Python 3.2 beta 2

2010-12-21 Thread Martin v. Loewis
Am 21.12.2010 22:56, schrieb Luis M. González: > I wonder if Unladen Swallow is still being considered for merger with > Python 3.3. > Is it? 3.2 isn't even released yet, and 3.3 will appear 18 months after it (so in Summer 2012). It's much too early to tell. OTOH, to answer you literal question:

Re: "Download/windows" site page

2010-12-13 Thread Martin v. Loewis
Am 13.12.2010 23:38, schrieb Cristian Consonni: > Dear all, > > I'm not sure this is the right place to point this out, but on this page: > > http://www.python.org/download/windows/ > > It is not mentioned "Windows 7". > > Is there some problem with 7 or it is simply an omission? It's simply a

Re: while True or while 1

2010-12-12 Thread Martin v. Loewis
>> Python is designed to provide readable code. Writing >> >> while True: >> ... >> >> is much more legible than its pre-True couterpart >> >> while 1: >> ... > > No argue with that! I actually want to argue with that: I find "while 1" more legible. That's probably because

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

2010-12-11 Thread Martin v. Loewis
Am 11.12.2010 23:41, schrieb Peter C.: > Hello, I am looking at the possibility of making a program in C++. The > catch is it will require the ability to work with binding for use with > scripting in both Python 2.x and 3.x for various tool plugins. Is > there any way to bind a C++ app to work with

Re: Enabling the use of POSIX character classes in Python

2010-12-11 Thread Martin v. Loewis
Am 11.12.2010 18:33, schrieb Perry Johnson: > Python's re module does not support POSIX character classes, for > example [:alpha:]. It is, of course, trivial to simulate them using > character ranges when the text to be matched uses the ASCII character > set. Sadly, my problem is that I need to pro

Re: Comparison with False - something I don't understand

2010-12-05 Thread Martin v. Loewis
> result = myfunction (vars) > > if not result: > # error condition > > Now above I first realized that the function can also return an empty > list under some conditions and so changed it to If your function returns a list when successful, it should not return False in the error case. Ins

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-30 Thread Martin v. Loewis
> This sounds like a strong prospect for how to get things working (I > didn't realize open would accept a bytes argument for the filename), > but I'm also interested in whether reading filenames from stdin and > subsequently opening them is supposed to "just work" given a suitable > encoding - lik

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-30 Thread Martin v. Loewis
> The world does not revolve around Python. Unix filenames have been > encoding-agnostic long before Python was around. If Python3 does not > support this then it's a regression on Python's part. Fortunately, Python 3 does support that. Regards, Martin -- http://mail.python.org/mailman/listinf

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-30 Thread Martin v. Loewis
> Does anyone know what I need to do to read filenames from stdin with > Python 3.1 and subsequently open them, when some of those filenames > include characters with their high bit set? If your files on disk use file names encoded in iso-8859-1, don't set your locale to a UTF-8 locale (as you app

Re: Pypi (Cheeseshop) Score - derivation of ?

2010-11-25 Thread Martin v. Loewis
> Occurrence of search term weighted by field (name, summary, keywords, > description, author, maintainer) > > I thought PyPI used to offer a 'kwality' score for packages, based on > the presence of installers, doc files, tests etc. Does anyone know > what happened to that? There was indeed a kwa

Re: Glob in python which supports the ** wildcard

2010-11-22 Thread Martin v. Loewis
Am 22.11.2010 22:43, schrieb Martin Lundberg: > Hi, > > I want to be able to let the user enter paths like this: > > apps/name/**/*.js > > and then find all the matching files in apps/name and all its > subdirectories. However I found out that Python's glob function > doesn't support the recursi

Re: regenerating unicodedata for py2.7 using py3 makeunicodedata.py?

2010-11-18 Thread Martin v. Loewis
> Thanks for the confirmation Martin! > > Do you think, it the mentioned omission of the character names of some > CJK ranges in unicodedata intended, or should it be reported to the > tracker? It's certainly a bug. So a bug report would be appreciated, but much more so a patch. Ideally, the pat

Re: regenerating unicodedata for py2.7 using py3 makeunicodedata.py?

2010-11-13 Thread Martin v. Loewis
> Is this intended or even guaranteed for these generated files to be > compatible across py2.7 and py3, or am I going to be bitten by some > less obvious issues later? It works because the generated files are just arrays of structures, and these structures are the same in 2.7 and 3.2. However, th

Re: Cross compiling (i386 from amd64) with distutils

2010-11-08 Thread Martin v. Loewis
>> You can solve some of the >> problems by editing the Makefile which it uses to learn the compiler >> options from. > > I don't understand this - do you mean I should edit the Makefile in > the actual distutils package, and somehow use that in my project > instead of setup.py? No. A python *ins

Re: Cross compiling (i386 from amd64) with distutils

2010-11-07 Thread Martin v. Loewis
> So is it possible to get distutils to cross compile something like > this, and > if so, what am I missing? Or am I using the wrong tool for the job? At a minimum, you should be using the target's python binary. distutils has close-to-none cross-compiling support. You can solve some of the proble

Re: Py3: decode subprocess output

2010-11-03 Thread Martin v. Loewis
> Under Python 3, subprocess.check_output returns a bytestring that > doesn't parse. Since the CLI program (written in the 1990's) will > never send Unicode, is there a way to downconvert the bytestring into > type str so as to emulate Py2.6 behavior? What do you mean by "that doesn't parse"? Retu

Re: playful coding problems for 10 year olds

2010-11-01 Thread Martin v. Loewis
> My niece is interested in programming and python looks like a good > choice (she already wrote a couple of lines :)) She is 10 and I > thought it would be good to have a bunch of playful coding problems > for her, stuff that she could code herself maybe after some initial > help. I think anythin

Re: Allowing comments after the line continuation backslash

2010-11-01 Thread Martin v. Loewis
> Sorry if I am baking too many ideas today. > I am just having trouble with the backslashes > > I would like to have comments after the line continuation backslash. > if a > 0 \ #comments for this condition > and b > 0: > #do something here > > This is currently not OK, but t

Re: Compare source code

2010-10-31 Thread Martin v. Loewis
> Should I be worry about this comment in reindent.py "So long as the > input files get a clean bill of health from tabnanny.py, reindent should > do a good job." ? I don't think so: IIUC, this is about comments that are not reasonably aligned with preceding or following code lines, most likely, y

Re: Compare source code

2010-10-31 Thread Martin v. Loewis
> I've a project with tabs and spaces mixed (yes I know it's bad). > > I edit each file to remove tabs, but it's so easy to make a mistake. > Do you know a tools to compare the initial file with the cleaned one to > know if the algorithms are the same ? > By comparing pyc files for example. Tools

Re: A bug for raw string literals in Py3k?

2010-10-31 Thread Martin v. Loewis
> So I suppose this is a bug? It's not, see http://docs.python.org/py3k/reference/lexical_analysis.html#literals # Specifically, a raw string cannot end in a single backslash Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Suppressing __context__

2010-10-29 Thread Martin v. Loewis
> It is not easily discoverable, but it is possible to suppress > __context__ by using a bare re-raise afterwards: I see. I'd wrap this like this: def raise_no_context(e): try: raise e except: e.__context__=None raise d = {} try: val = d['nosuch'] except KeyEr

Re: Exception Handling in Python 3

2010-10-25 Thread Martin v. Loewis
Am 24.10.2010 23:48, schrieb Steve Holden: > On 10/24/2010 4:44 PM, John Nagle wrote: >> Are exception semantics changing in a way which would affect that? > > No, I don't believe so. I simply felt that the traceback gives too much > information in the case where an exception is specifically being

Re: Exception Handling in Python 3

2010-10-24 Thread Martin v. Loewis
Am 24.10.2010 07:01, schrieb Steve Holden: > I was somewhat surprised to discover that Python 3 no longer allows an > exception to be raised in an except clause (or rather that it reports it > as a separate exception that occurred during the handling of the first). I think you are misinterpreting

Re: 64 bit offsets?

2010-10-23 Thread Martin v. Loewis
Am 07.10.2010 23:20, schrieb MRAB: > On 07/10/2010 20:12, jay thompson wrote: >> I'm not sure if it is limited to 32 bit addresses or if it's only >> re.start() that is limited to 'em. >> >> jt >> > From what I can tell, Microsoft compilers (I'm assuming you're using > Windows) have a 32-bit 'int'

Re: weird error with python 2.7 installer under windows 7

2010-09-22 Thread Martin v. Loewis
> Any ideas? Try running the postinstall script by hand. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and unicode

2010-09-20 Thread Martin v. Loewis
Am 20.09.2010 12:57, schrieb Dotan Cohen: > On Mon, Sep 20, 2010 at 12:20, Peter Otten <__pete...@web.de> wrote: >> It may work by accident, if you declare it as UTF-8, because that is also >> the default in Python 3. >> > > That does seem to be the case. > > Thank you for the enlightenment and i

Re: Python and unicode

2010-09-19 Thread Martin v. Loewis
> One more thing, is there some mechanism to avoid writing all the time > 'something'.decode('utf-8')? Yes, use u'something' instead (i.e. put the letter u before the literal, to make it a unicode literal). Since Python 2.6, you can also put from __future__ import unicode_literals at the top of

Re: compile Py2.6 on SL

2010-09-19 Thread Martin v. Loewis
Am 16.09.2010 17:34, schrieb moerchendiser2k3: > Hi, > > I have some trouble with Python on Snow Leopard (10.6.3). I compile > Python as a framework(for 32/64bit) without any problems. > But implementing the lib in my C app, I get the following error on > linking: > > Undefined symbols: > "_Py_

Re: what is this kind of string: b'string' ?

2010-09-04 Thread Martin v. Loewis
Am 04.09.2010 19:27, schrieb Stefan Behnel: > Martin v. Loewis, 04.09.2010 18:52: >> Am 01.09.2010 23:32, schrieb Stef Mientki: >>> in winpdb I see strings like this: >>> >>> >>> a = b'string' >>> >>> a >>>

Re: what is this kind of string: b'string' ?

2010-09-04 Thread Martin v. Loewis
Am 01.09.2010 23:32, schrieb Stef Mientki: > in winpdb I see strings like this: > a = b'string' a > 'string' type(a) > > > what's the "b" doing in front of the string ? It's redundant. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Installation problem: Python 2.6.6 (32-Bit) on Windows 7 (32-Bit)

2010-09-04 Thread Martin v. Loewis
Am 01.09.2010 21:18, schrieb Cappy2112: > Has anyone else had problems running the msi for Python 2.6.6 on > Windows 7 Professional? I specifically tested whether "compile .py" works before the release, and it worked fine on my machine. I suspect you have a source file on your disk that it tries

Re: make install DESTDIR

2010-08-23 Thread Martin v. Loewis
> Thanks Martin. That seems to work. I will file a bug report. Also, can > you describe what the problem was? If you have / as the prefix, you get two leading slashes, e.g. for //lib/python2.x. Any other prefix would have given you only a single slash: e.g. if it had been /usr, then you end up wit

Re: Proper set-up for a co-existant python 2.6 & 3.1 installation

2010-08-23 Thread Martin v. Loewis
> When I am logged-in in a session as an administrator, the BAT file on > the Desktop, and I double-click on it, it does not work. This is not what I meant. Instead, right-click on the BAT file, and select "run as administrator". > When you say to double-escape the percent signs, do you mean that

Re: Proper set-up for a co-existant python 2.6 & 3.1 installation

2010-08-23 Thread Martin v. Loewis
> I tried to change file associations, first manually, in a CMD window. > But the system was responding "access denied" even when I used an > Administrator account (I was using FTYPE python.file="C: > \Python26\python.exe" "%1" %*). That works, in principle. Put that command into py26.bat, then, i

Re: make install DESTDIR

2010-08-23 Thread Martin v. Loewis
> Martin- Asking for help :) Ok. Please try the patch below. If this works, please make a bug report. Regards, Martin Index: Lib/distutils/util.py === --- Lib/distutils/util.py (Revision 84197) +++ Lib/distutils/util.py

Re: make install DESTDIR

2010-08-21 Thread Martin v. Loewis
> The whole point of DESTDIR is that it should be prepended to all > installed paths, but the binaries should not contain any references to > it.DESTDIR is commonly used by packagers, for example, to allow > installation without superuser privileges. So what is the point of your messages? Do you w

Re: Creating a PYD file

2010-08-19 Thread Martin v. Loewis
> (Pseudo code) > > result = arg1 + arg2 > return result For this code, the manually-written version will most likely be faster than the Pyrex-generated one. This is, most likely, because the manually-written version will assume a specific data type for the arguments (e.g. int), which Pyrex will

Re: Looking for an appropriate encoding standard that supports all languages

2010-08-19 Thread Martin v. Loewis
> I write a line of strings in the source code and I want my program to > show that as an output on GUI. And this line of strings includes a > character like "ü". Make sure you use Unicode literals in your source code, i.e. u"ü". HTH, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: shelf-like list?

2010-08-15 Thread Martin v. Loewis
> Does anyone know of such a module? ZODB supports persistent lists. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: writing \feff at the begining of a file

2010-08-14 Thread Martin v. Loewis
> Is there a standard way to autodetect the encoding of a text file? Use the chardet module: http://chardet.feedparser.org/ Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Why can't I set sys.ps1 to a unicode string?

2010-08-12 Thread Martin v. Loewis
> So... why does having a non-ascii character in sys.ps1 make the prompt > vanish? I can't pinpoint it to a specific line of code. Most likely, it tries to encode the prompt as ASCII before writing it to stdout. That fails, and it silently ignores the error. FWIW, this is fixed in Python 3. Reg

Re: Why is python not written in C++ ?

2010-08-10 Thread Martin v. Loewis
Am 10.08.2010 09:06, schrieb Ulrich Eckhardt: > Carl Banks wrote: >> I highly doubt the Python source would build with a C++ compiler. > > As Christian showed, it doesn't. However, look around the sources a bit. > There are lots of places where e.g. the returnvalue of malloc() (or, > rather, the m

Re: Win7. Why Don't Matplotlib, ... Show up in Control Panel Add-Remove?

2010-08-08 Thread Martin v. Loewis
>The basic answer is that nobody is in charge. There's nobody > even trying to herd the third-party modules. Unlike CPAN, which > has standards for Perl packages and some level of quality > control, PyPi is just a link farm. Do the standards of CPAN also include uninstallation? To my knowle

Re: Win7. Why Don't Matplotlib, ... Show up in Control Panel Add-Remove?

2010-08-08 Thread Martin v. Loewis
> There's a discrepancy because package management on Python is > completely broken. Distutils and Setuptools (and it's new fork, > Distribute) are inadequate- they act as installers, but don't provide > a way to uninstall the program. That's not true. If you use the bdist_wininst, bdist_msi, or b

Re: Python Portability

2010-08-08 Thread Martin v. Loewis
e. Perhaps it was installed by a different user, and will only show up when that user goes into CP? Do you recall what procedure you have used for installation? > Well, this is interesting. I just > noticed Martin v. Loewis on the Python 2.5 entry. That's you, right? Correct. I keep buil

Re: Python Portability

2010-08-07 Thread Martin v. Loewis
> To add to the msg I just sent to M. Torrie. We are given the msi > programs for Python, PIL,matplotlib, and numpy. The question of how to > uninstall and re-install a different version remains. I'd claim that this is not the real question. The real question is, instead: "What specific error did

Re: Python Portability

2010-08-07 Thread Martin v. Loewis
Am 07.08.2010 23:01, schrieb Michael Torrie: > On 08/07/2010 01:17 PM, W. eWatson wrote: >> Presumably I have him somehow delete the numpy site-package, the numpy >> 1.2.0 package? Just drill his way dow from the .../lib/site_packages? >> Then install 1.2.0. He's missed the boat on that before by

Re: Python Portability--Not very portable?

2010-08-07 Thread Martin v. Loewis
> As an example, my inexperienced Python partner 30 miles away has gotten > out of step somehow. I think by installing a different version of numpy > than I use. I gave him a program we both use months ago, and he had no > trouble. (We both use IDLE on 2.5). I made a one character change to it > an

Re: Why is python not written in C++ ?

2010-08-03 Thread Martin v. Loewis
> Has it ever been planned to rewrite in C++ the historical implementation > (of course in an object oriented design) ? Around the time Guido coined the term "Python 3000" (i.e. in 2000), he also said at a few occasions that it would be written in C++. He subsequently dropped the idea, for the rea

Python track at German Zope conference

2010-07-13 Thread Martin v. Loewis
[Das ist im Wesentlichen eine Kopie einer Nachricht, die Dinu an die Python-DE-Liste geschickt hat.] >From September 15 to September 17, 2010, the German Zope conference (organized by DZUG) takes place in Dresden. It has tracks for Python, Zope, and Plone. Dinu Gherman and me are organizing the P

Re: Any reason www.python.org is slow?

2010-07-10 Thread Martin v. Loewis
>> If your computer does have IPv6 connectivity, but it's broken >> (i.e. you have a gateway, but eventually packets are discarded), >> you see the IPv4 fallback after the IPv6 timeout. The IPv4 connection in >> itself then would be fast. > > I think it's what most users experience when they are t

Re: Any reason www.python.org is slow?

2010-07-10 Thread Martin v. Loewis
> I did disable IPv6 on my computer at home and it did speed it up. I'll > check the other computers where I experienced the same slowness. Of course, it would be interesting to find out what precisely went wrong. If you are curious to find out, let me know, and I'll help investigating. Regards,

Re: Any reason www.python.org is slow?

2010-07-10 Thread Martin v. Loewis
> For the last year?? > It's been mostly zippy here. > Is IPv6 enabled on your computer? If so, I'd try to disable it. > python.org domains resolve to both IPv4 and IPv6 addresses and, if your > computer has IPv6 enabled but you don't have any IPv6 connectivity, > this can result in slowdowns. Tha

Re: How do I add method dynamically to module using C API?

2010-07-08 Thread Martin v. Loewis
> I tried (1) adding a __del__, but no dice, I guess > because it wasn't really an object method but just a free function in a > module; and (2) the m_free callback in the module definition structure, > but it was not called. m_free will be called if the module object gets deallocated. So if m_fre

Re: The real problem with Python 3 - no business case for conversion (was "I strongly dislike Python 3")

2010-07-07 Thread Martin v. Loewis
> I just > couldn't get through on the python-dev list that I couldn't just > upgrade my code to 2.6 and then use 2to3 to keep in step across the > 2-3 chasm, as this would leave behind my faithful pre-2.6 users. Not sure whom you had been talking to. But I would have tried to explain that you don

Re: How do I add method dynamically to module using C API?

2010-07-07 Thread Martin v. Loewis
> And since things work for a single method when I declare 'def' as > 'static', I suspect that means that the function object created by > PyCFunction_NewEx holds on to a pointer to the PyMethodDef structure? Correct; it doesn't make a copy of the struct. So when you want the function object to ou

  1   2   3   >