Pyro 3.11 released
Hi, Pyro 3.11 has been released! Pyro is a an advanced and powerful Distributed Object Technology system written entirely in Python, that is designed to be very easy to use. Have a look at http://www.xs4all.nl/~irmen/pyro3/ for more information. Highlights of this release are: - improved compatibility with Jython - fixed some threading problems regarding proxy connections - fixed a threading issue that could break COM calls - persistent mode nameserver improved As always the detailed changes are in the change log chapter in the manual. More info and download link available in PyPI: http://pypi.python.org/pypi/Pyro/ Enjoy, Irmen de Jong -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/
Re: Weibull distr. random number generation
Hello Mark, Exactly, thanks very much! Dimos --- On Sat, 11/20/10, Mark Dickinson dicki...@gmail.com wrote: From: Mark Dickinson dicki...@gmail.com Subject: Re: Weibull distr. random number generation To: python-list@python.org Date: Saturday, November 20, 2010, 7:09 PM On Nov 19, 3:21 pm, Dimos dimos_anastas...@yahoo.com wrote: I would like to use the random module, and if I understand well the Random class, to create 1300 decimal numbers in python, by providing the 2 Weibull parameters (b,c). How this can be done??? import random print random random.weibullvariate(b,c) How can I set the population size n=1300 in decimals? random.weibullvariate(b, c) generates a single sample from the specified Weibull distribution. If you want 1300 samples, you'd use this within a loop. For example, here's code to put 10 Weibull variates with scale parameter 12345.0 and shape parameter 6.0 into a list: import random samples = [] for i in xrange(10): ... samples.append(random.weibullvariate(12345.0, 6.0)) ... print samples [15553.186762792948, 14304.175032317309, 9015.5053691933044, 12585.469181732506, 9436.2677219460638, 13350.89758791281, 5687.4330250037565, 12172.747202474553, 9687.8685933610814, 11699.040541029028] A more experienced Python programmer might use a list comprehension to achieve the same effect in a single line: samples = [random.weibullvariate(12345.0, 6.0) for _ in xrange(10)] print samples [10355.396846416865, 14689.507803932587, 11491.850991569485, 14128.56397290655, 12592.739991974759, 9076.7752548878998, 11868.012238422616, 12016.784656753523, 14724.818462506191, 13253.477389116439] Is this the sort of thing you were looking for? -- Mark -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: MATLAB to Python?
On Nov 17, 10:53 am, Arnaud Delobelle arno...@gmail.com wrote: I guess that the step is supposed to be h, so you should write: xx = range(-kappa, kappa+1, h) This is what I have in the source code: ---8---8---8---8--- h = 0.105069988414 xx = range(-kappa, kappa+1, h) ---8---8---8---8--- This is what Python says: ValueError: range() step argument must not be zero Can step not be a float value? -- http://mail.python.org/mailman/listinfo/python-list
Re: MATLAB to Python?
On Mon, Nov 22, 2010 at 12:47 AM, MATLABdude matlab.d...@mbnet.fi wrote: On Nov 17, 10:53 am, Arnaud Delobelle arno...@gmail.com wrote: I guess that the step is supposed to be h, so you should write: xx = range(-kappa, kappa+1, h) This is what I have in the source code: ---8---8---8---8--- h = 0.105069988414 xx = range(-kappa, kappa+1, h) ---8---8---8---8--- This is what Python says: ValueError: range() step argument must not be zero Can step not be a float value? Correct. Note the DeprecationWarning which is also shown: __main__:1: DeprecationWarning: integer argument expected, got float There are too many subtleties with floating-point, so range() doesn't handle it; that way, you deal with the subtleties yourself, explicitly. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: MATLAB to Python?
MATLABdude wrote: On Nov 17, 10:53 am, Arnaud Delobelle arno...@gmail.com wrote: I guess that the step is supposed to be h, so you should write: xx = range(-kappa, kappa+1, h) This is what I have in the source code: ---8---8---8---8--- h = 0.105069988414 xx = range(-kappa, kappa+1, h) ---8---8---8---8--- This is what Python says: ValueError: range() step argument must not be zero Can step not be a float value? Indeed. Older Pythons will warn you and then try to convert the arguments to integers range(1.0) __main__:1: DeprecationWarning: integer argument expected, got float [0] and in 2.7 or 3.x you'll get a type error: range(1.0) Traceback (most recent call last): File stdin, line 1, in module TypeError: range() integer end argument expected, got float. Try numpy.arange() instead: numpy.arange(0, 1, .1) array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]) -- http://mail.python.org/mailman/listinfo/python-list
Reading bz2 file into numpy array
Hi, is there a convenient way to read bz2 files into a numpy array? I tried: from bz2 import * from numpy import * fd = BZ2File(filename, 'rb') read_data = fromfile(fd, float32) but BZ2File doesn't seem to produce a transparent filehandle. Kind regards! Johannes -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading bz2 file into numpy array
Johannes Korn wrote: I tried: from bz2 import * from numpy import * fd = BZ2File(filename, 'rb') read_data = fromfile(fd, float32) but BZ2File doesn't seem to produce a transparent filehandle. is there a convenient way to read bz2 files into a numpy array? Try import numpy import bz2 filename = ... f = bz2.BZ2File(filename) data = numpy.fromstring(f.read(), numpy.float32) print data -- http://mail.python.org/mailman/listinfo/python-list
Re: building a web interface
Shel wrote: Hello, I am pretty new to all this. I have some coding experience, and am currently most comfortable with Python. I also have database design experience with MS Access, and have just created my first mySQL db. So right now I have a mySQL db structure and some Python code. My end goal is to create a browser-based interactive fiction/game thing. My code is currently just using dummy data rather than pulling in data from the db, but I think/hope it won't be too big of a deal to interact with the db through Python (famous last words...). My main problem right now is how to do the web interface. I don't know much about web architecture, unfortunately. I think I need a CGI script? What I would really like is to find a GUI tool to design the interface that would have customizable templates or drag-and-drop elements or something, so I wouldn't have to code much by hand. Something easy, if such a tool exists. Also would prefer something that I would be able to install/use without having much access to the server where the site will be hosted (on a university server that I don't have control over). I don't fully understand how a lot of the tools I have been looking at work, but it seems like they're often things where you'd have to get an administrator to do stuff on the server (is that right?), which I would prefer to avoid. It looks like Django has some sort of standalone implementation, but I'm not clear on how that would work or how much of a learning curve there would be for using it. If anyone has any thoughts or suggestions, I would really appreciate it. Hope my questions make sense. I don't really know what I'm doing, so could be they're a bit silly. I apologize if that's the case, and please let me know if you need any additional informmation. Thanks, Shel Django is quite popular, they claim to be easy to learn/use. That's for the web framework. You could use pyjamas for the web interface, looks like it works well with django. Hmm, writing python code only, sounds like a dream come true :D Note that I never used one of these, it just happened I had to look for possible solutions for a web application. JM -- http://mail.python.org/mailman/listinfo/python-list
Accepting a SAML 2 Assertion
Hello, I am working on providing a SSO solution to a customer who acts as an identity provider. He already has IDP on his side to generate SAML 2 assertions with user first name , last name and time stamp as parameters. Our task is to accept this assertion which is signed, decrypt it and send it to the authenticator we already have. The authenticator validates the info and gives access to our application which is written using Python. Here we act as the *service provider.* I am new to SAML and have no idea how to integrate SAML to our current Python application. Can you help me on how to accept these assertion requests from the Idp and decrypt it at Service Provider end using Python. Thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: multiple times subprocess fails on windows
To be more specific, I have something like this in rvirtualenv itself (that's the pokus.py file): import os os.system(echo 128) I generate a batch file like this (that's the pokus.bat file): @echo off pokus.py And after that, I run the pokus.bat file from a test (that's the run.py file): from subprocess import Popen, PIPE p = Popen('pokus.bat', stdout=PIPE, stderr=PIPE, shell=True) stdout, stderr = p.communicate() print stdout.strip() And the problem is, that I don't receive the output of the os.system to the PIPE. Probable there is something different on windows stdout redirection, because similar stuff works on linux.. Thanks, Jakub. On Nov 21, 8:39 pm, kvbik jakub.vys...@gmail.com wrote: Hello, in a test suite in my project (called rvirtualenv [1]) I discovered a strange behaviour when calling from python a batch file which calles another python and this calles a shell command. [1]http://github.com/kvbik/rvirtualenv I know it sounds pretty strange, but I do this only because I am testing such specific tool (that has similar functionality like original virtualenv and there are things like activate.bat commands). I've uploaded some code snippet here: https://gist.github.com/709004/6ccc44d6aed5fe694bb2adbef2400bbea92998a1 If anyone could explain me this behaviour I would be more than happy, because right now it is the only failing test in my project ;). Thanks in advance, Jakub.. -- http://mail.python.org/mailman/listinfo/python-list
unittests with different parameters
Hi! I'm writing tests and I'm wondering how to achieve a few things most elegantly with Python's unittest module. Let's say I have two flags invert X and invert Y. Now, for testing these, I would write one test for each combination. What I have in the test case is something like this: def test_invert_flags(self): test flags to invert coordinates tests = [((10, 20), INVERT_NONE, (10, 20)), ((10, 20), INVERT_X, (-10, 20)), ((10, 20), INVERT_Y, (10, -20))] for input, flags, expected in tests: res = do_invert(input, flags) self.assertEqual(res, expected, %s caused wrong results % (flags,)) So, what I do that I test the function 'do_invert' for different input combinations and verify the result. The ugly thing is that this will abort the whole test if one of the tests in the loop fails. So, my question is how do I avoid this? I know that I could write a common test function instead: def _test_invert_flags(self, input, flags, expected): res = do_invert(input, flags) self.assertEqual(res, expected) def test_invert_flags_non(self): test not inverting coordinates self._test_invert_flags((10, 20), INVERT_NONE, (10, 20)) def test_invert_flags_x(self): test inverting X coordinates self._test_invert_flags((10, 20), INVERT_X, (-10, 20)) def test_invert_flags_y(self): test inverting Y coordinates self._test_invert_flags((10, 20), INVERT_Y, (10, -20)) What I don't like here is that this is unnecessarily verbose and that it basically repeats information. Also, I'd rather construct the error message from the data instead of maintaining it in different places, because manually keeping those in sync is another, errorprone burden. Any suggestions? Uli -- Domino Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list
Re: Some syntactic sugar proposals
if x in range(a, b): #wrong! it feels so natural to check it that way, but we have to write if a = x = b I understand that it's not a big deal, but it would be awesome to have some optimisations - it's clearly possible to detect things like that wrong one and fix it in a bytecode. You can implement it yourself: class between(object): def __init__(self, a,b): super(crang, self).__init__() self.a=a self.b=b def __contains__(self, value): return self.a = value = self.b 12.45 in between(-100,100) true But do you need a x b a = x b a = x = b or a x = b ? Sure, you could set a new parameter for this, but the normal way is not broken at all. Best -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On Nov 21, 10:38 pm, Ertugrul Söylemez e...@ertes.de wrote: Jon Harrop use...@ffconsultancy.com wrote: Ertugrul Söylemez e...@ertes.de wrote in message news:20101014052650.510e8...@tritium.streitmacht.eu... That's nonsense. Actually namekuseijin is right. You really need to persevere and familiarize yourself with some of the other languages out there. Haskell is many things but simple is not one of them. If Haskell were half of the things you think it is, it would have more credible success stories. Jon, I don't care about your opinion, because it's biased. All opinions are biased. -- http://mail.python.org/mailman/listinfo/python-list
Re: unittests with different parameters
On Nov 22, 11:38 am, Ulrich Eckhardt ulrich.eckha...@dominolaser.com wrote: Hi! I'm writing tests and I'm wondering how to achieve a few things most elegantly with Python's unittest module. Let's say I have two flags invert X and invert Y. Now, for testing these, I would write one test for each combination. What I have in the test case is something like this: def test_invert_flags(self): test flags to invert coordinates tests = [((10, 20), INVERT_NONE, (10, 20)), ((10, 20), INVERT_X, (-10, 20)), ((10, 20), INVERT_Y, (10, -20))] for input, flags, expected in tests: res = do_invert(input, flags) self.assertEqual(res, expected, %s caused wrong results % (flags,)) So, what I do that I test the function 'do_invert' for different input combinations and verify the result. The ugly thing is that this will abort the whole test if one of the tests in the loop fails. So, my question is how do I avoid this? I know that I could write a common test function instead: def _test_invert_flags(self, input, flags, expected): res = do_invert(input, flags) self.assertEqual(res, expected) def test_invert_flags_non(self): test not inverting coordinates self._test_invert_flags((10, 20), INVERT_NONE, (10, 20)) def test_invert_flags_x(self): test inverting X coordinates self._test_invert_flags((10, 20), INVERT_X, (-10, 20)) def test_invert_flags_y(self): test inverting Y coordinates self._test_invert_flags((10, 20), INVERT_Y, (10, -20)) What I don't like here is that this is unnecessarily verbose and that it basically repeats information. Also, I'd rather construct the error message from the data instead of maintaining it in different places, because manually keeping those in sync is another, errorprone burden. Any suggestions? Uli -- Domino Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 You could have a parameter to the test method and some custom TestLoader that knows what to do with it. See http://docs.python.org/library/unittest.html. I would venture that unit tests are verbose by their very nature; they are 100% redundant. The usual argument against unnecessary redundancy, that of ease of maintenance, really doesn't apply to unit tests. Anyway, good luck with your efforts. Chard. -- http://mail.python.org/mailman/listinfo/python-list
Re: unittests with different parameters
In article q91qr7-i9j@satorlaser.homedns.org, Ulrich Eckhardt ulrich.eckha...@dominolaser.com wrote: def test_invert_flags(self): test flags to invert coordinates tests = [((10, 20), INVERT_NONE, (10, 20)), ((10, 20), INVERT_X, (-10, 20)), ((10, 20), INVERT_Y, (10, -20))] for input, flags, expected in tests: res = do_invert(input, flags) self.assertEqual(res, expected, %s caused wrong results % (flags,)) So, what I do that I test the function 'do_invert' for different input combinations and verify the result. The ugly thing is that this will abort the whole test if one of the tests in the loop fails. So, my question is how do I avoid this? Writing one test method per parameter combination, as you suggested, is a reasonable approach, especially if the number of combinations is reasonably small. Another might be to make your loop: failCount = 0 for input, flags, expected in tests: res = do_invert(input, flags) if res != expected: print %s caused wrong results % (flags,) failCount += 1 self.assertEqual(failCount, 0, %d of them failed % failCount) Yet another possibility is to leave it the way you originally wrote it and not worry about the fact that the loop aborts on the first failure. Let it fail, fix it, then re-run the test to find the next failure. Perhaps not as efficient as finding them all at once, but you're going to fix them one at a time anyway, so what does it matter? It may also turn out that all the failures are due to a single bug, so fixing one fixes them all. -- http://mail.python.org/mailman/listinfo/python-list
Error Starting Python(Django) App using Apache+Mod_Wsgi
All, I have a problem in starting my Python(Django) App using Apache and Mod_Wsgi I am using Django 1.2.3 and Python 2.6.6 running on Apache 2.2.17 with Mod_Wsgi 3.3 When I try to access the app from Web Browser, I am getting these errors. [Mon Nov 22 09:45:25 2010] [notice] Apache/2.2.17 (Unix) mod_wsgi/3.3 Python/2.6.6 configured -- resuming normal operations [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] mod_wsgi (pid=1273874): Target WSGI script '/u01/home/apli/wm/app/gdd/pyserver/ apache/django.wsgi' cannot be loaded as Python module. [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] mod_wsgi (pid=1273874): Exception occurred processing WSGI script '/u01/home/ apli/wm/app/gdd/pyserver/apache/django.wsgi'. [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] Traceback (most recent call last): [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] File /u01/ home/apli/wm/app/gdd/pyserver/apache/django.wsgi, line 19, in module [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] import django.core.handlers.wsgi [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] File /usr/ local/lib/python2.6/site-packages/django/core/handlers/wsgi.py, line 1, in module [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] from threading import Lock [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] File /usr/ local/lib/python2.6/threading.py, line 13, in module [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] from functools import wraps [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] File /usr/ local/lib/python2.6/functools.py, line 10, in module [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] from _functools import partial, reduce [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] ImportError: rtld: 0712-001 Symbol PyArg_UnpackTuple was referenced [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] from module /usr/local/lib/python2.6/lib-dynload/_functools.so(), but a runtime definition [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] of the symbol was not found. [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] rtld: 0712-001 Symbol PyCallable_Check was referenced [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] from module /usr/local/lib/python2.6/lib-dynload/_functools.so(), but a runtime definition [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] of the symbol was not found. [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] rtld: 0712-001 Symbol PyDict_Copy was referenced [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] from module /usr/local/lib/python2.6/lib-dynload/_functools.so(), but a runtime definition [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] of the symbol was not found. [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] rtld: 0712-001 Symbol PyDict_Merge was referenced [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] from module /usr/local/lib/python2.6/lib-dynload/_functools.so(), but a runtime definition [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] of the symbol was not found. [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] rtld: 0712-001 Symbol PyDict_New was referenced [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] from module /usr/local/lib/python2.6/lib-dynload/_functools.so(), but a runtime definition [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] of the symbol was not found. [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] rtld: 0712-001 Symbol PyErr_Occurred was referenced [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] from module /usr/local/lib/python2.6/lib-dynload/_functools.so(), but a runtime definition [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] of the symbol was not found. [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] rtld: 0712-001 Symbol PyErr_SetString was referenced [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] from module /usr/local/lib/python2.6/lib-dynload/_functools.so(), but a runtime definition [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] of the symbol was not found. [Mon Nov 22 09:45:43 2010] [error] [client 108.10.0.191] \t0509-021 Additional errors occurred but are not reported. I assume that those missing runtime definitions are supposed to be in the Python executable. Doing an nm on the first missing symbol reveals that it does exist. root [zibal]% nm /usr/local/bin/python | grep -i PyArg_UnpackTuple .PyArg_UnpackTuple T 268683204 524 PyArg_UnpackTupleD 537073500 PyArg_UnpackTupled 537073500 12 PyArg_UnpackTuple:F-1 - 224 Please guide. Regards, Guddu -- http://mail.python.org/mailman/listinfo/python-list
Re: unittests with different parameters
Roy Smith wrote: Writing one test method per parameter combination, as you suggested, is a reasonable approach, especially if the number of combinations is reasonably small. The number of parameters and thus combinations are unfortunately rather large. Also, sometimes that data is not static but rather computed from a loop instead. There are a few optimised computations, where I compute the expected result with the slow but simple version, in those cases I want to check a whole range of inputs using a loop. I'm wondering, classes aren't as static as I'm still used to from C++, so creating the test functions dynamically with a loop outside the class declaration should be another possibility... Yet another possibility is to leave it the way you originally wrote it and not worry about the fact that the loop aborts on the first failure. Let it fail, fix it, then re-run the test to find the next failure. Perhaps not as efficient as finding them all at once, but you're going to fix them one at a time anyway, so what does it matter? Imagine all tests that use INVERT_X fail, all others pass. What would your educated guess be where the code is wrong? ;) Thanks Roy! Uli -- Domino Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list
Re: unittests with different parameters
Richard Thomas wrote: [batch-programming different unit tests] You could have a parameter to the test method and some custom TestLoader that knows what to do with it. Interesting, thanks for this suggestion, I'll look into it! Uli -- Domino Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On 2010-11-22 08:12:27 -0500, markhanif...@gmail.com said: All opinions are biased. All opinions show some bias. Not all opinions represent what is usually called a conflict of interest. Since JH makes his living selling tools and training for certain languages, he has a severe conflict of interest wrt asessing the value of various other languages. If these other languages are just as good or better than those he makes his living from, it would be very damaging to his livlihood for him to admit this fact. As a result, he is a completely unreliable source on the question. This is why judges must recuse themselves from both civil and criminal trials if they have some significant conflict of interest. The law recognizes that we cannot expect a fair judgement from someone who stands to profit significantly if the judgement goes one way or the other. Similarly, we cannot expect a fair judgement on the relative value of various language tools from a person whose livlihood depends on the audience choosing only those certain language tools that he sells services and training for. warmest regards, Ralph -- Raffael Cavallaro -- http://mail.python.org/mailman/listinfo/python-list
Re: unittests with different parameters
In article ddbqr7-5rj@satorlaser.homedns.org, Ulrich Eckhardt ulrich.eckha...@dominolaser.com wrote: Yet another possibility is to leave it the way you originally wrote it and not worry about the fact that the loop aborts on the first failure. Let it fail, fix it, then re-run the test to find the next failure. Perhaps not as efficient as finding them all at once, but you're going to fix them one at a time anyway, so what does it matter? Imagine all tests that use INVERT_X fail, all others pass. What would your educated guess be where the code is wrong? ;) Well, let me leave you with one last thought. There's really two kinds of tests -- acceptance tests, and diagnostic tests. I tend to write acceptance tests first. The idea is that if all the tests pass, I know my code works. When some test fails, that's when I start digging deeper and writing diagnostic tests, to help me figure out what went wrong. The worst test is a test which is never written because it's too hard to write. If it's easy to write a bunch of tests which verify correct operation but don't give a lot of clues about what went wrong, it might be worth doing that first and seeing what happens. If some of the tests fail, then invest the time to write more detailed tests which give you more information about each failure. -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On 22 Nov 2010 06:26:34 GMT Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Sun, 21 Nov 2010 23:57:21 -0500, Steve Holden wrote: Perhaps we could take this thread to alt.small.minded.bickering now? Alas, my ISP doesn't carry that newsgroup. Where else can I get my mindless off-topic bitching if not for cross-posts from comp.lang.scheme and comp.lang.functional? *wink* alt.off-topic *wink* /W -- To reach me via email, replace INVALID with the country code of my home country. But if you spam me, I'll be one sour Kraut. -- http://mail.python.org/mailman/listinfo/python-list
Python recursively __getattribute__
Hello, I need to implement such behavior: obj.attr1.attr2.attr3 -- obj.attr1__attr2__attr3 It looks like I have to override obj's class __getattribute__ and also use python descriptors somehow. Any help will be much appreciated. http://stackoverflow.com/questions/4247036/python-recursively-getattribute -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On Mon, 22 Nov 2010 05:38:53 +0100, Ertugrul Söylemez e...@ertes.de wrote: Haskell is a simple language with a comparably small specification. It's not as simple as Common Lisp, but it's simple. Note that simple doesn't mean easy. Haskell is certainly more difficult to learn than other languages, which explains the low number of success stories. On the other hand, I'm doing rapid web development in it. I wonder how much that difficulty is innate, and how much is due to learning other languages first. I'm an old time CoBOL programmer, and know of quite a few people who tried to learn OO-CoBOL without much luck. The way to learn it was to forget it - learn OO with some other language, then come back to it later.We had to divorce ourselves from the old paradigm first. -- In no part of the constitution is more wisdom to be found, than in the clause which confides the question of war or peace to the legislature, and not to the executive department. - James Madison -- http://mail.python.org/mailman/listinfo/python-list
Re: Python recursively __getattribute__
On Mon, 22 Nov 2010 07:46:47 -0800 (PST) Roman Dolgiy tost...@gmail.com wrote: Hello, I need to implement such behavior: obj.attr1.attr2.attr3 -- obj.attr1__attr2__attr3 It looks like I have to override obj's class __getattribute__ and also use python descriptors somehow. Any help will be much appreciated. http://stackoverflow.com/questions/4247036/python-recursively-getattribute Why? No, really: Why? In that link you say that you need to do this to support legacy code. I still don't see how this would be necessary. If you need to support legacy code, doesn't that mean that the solution you're asking for already exists? I really think you should go into detail about why you need this. I'm certain that there's a better solution to your problem. (Better being one that is reasonably easy to implement and maintain.) /W -- To reach me via email, replace INVALID with the country code of my home country. But if you spam me, I'll be one sour Kraut. -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On Nov 22, 10:57 am, Howard Brazee how...@brazee.net wrote: On Mon, 22 Nov 2010 05:38:53 +0100, Ertugrul S ylemez e...@ertes.de wrote: Haskell is a simple language with a comparably small specification. It's not as simple as Common Lisp, but it's simple. Note that simple doesn't mean easy. Haskell is certainly more difficult to learn than other languages, which explains the low number of success stories. On the other hand, I'm doing rapid web development in it. I wonder how much that difficulty is innate, and how much is due to learning other languages first. This is a good (if familiar) observation. Teaching children (or young people with little exposure to computers) how to program in various paradigms could produce interesting primary evidence. Pity that this isn't examined widely and systematically. We could learn something about how to teach programming and design languages this way, don't you agree? The OLPC might do some interesting things in this area but it is still one set of tools. More interesting might be to compare outcomes across a range of different tools, paradigms, syntaxes, and teaching strategies. I'm an old time CoBOL programmer, and know of quite a few people who tried to learn OO-CoBOL without much luck. The way to learn it was to forget it - learn OO with some other language, then come back to it later. We had to divorce ourselves from the old paradigm first. -- In no part of the constitution is more wisdom to be found, than in the clause which confides the question of war or peace to the legislature, and not to the executive department. - James Madison -- http://mail.python.org/mailman/listinfo/python-list
Re: print line number and source filename
Here is what you want for printing python source filename: print __file__ On Tuesday, June 22, 2010 12:44 PM Peng Yu wrote: I want to print filename and line number for debugging purpose. So far I only find how to print the line number but not how to print filename. import inspect print inspect.currentframe().f_lineno I found inspect.getsourcefile(), but I have to supply a class name to it. I have searched online, but I do not find how to print the source filename. Would you please let me know? Also, always importing the inspect module and getting the frame and accessing the lineno from the frame is not very convenient to type. Is there a shorter way to access the line number (for example, in C++ and perl, __LINE__ can be used to access line number, which is much more convenient than the way that I found in python). -- Regards, Peng Submitted via EggHeadCafe Merging SharePoint List Data into Word Documents http://www.eggheadcafe.com/tutorials/aspnet/6054abc5-c5fb-4e86-a352-afd0e8c4a7c6/merging-sharepoint-list-data-into-word-documents.aspx -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On Nov 22, 9:45 am, Raffael Cavallaro raffaelcavall...@pas.despam.s.il.vous.plait.mac.com wrote: On 2010-11-22 08:12:27 -0500, markhanif...@gmail.com said: All opinions are biased. All opinions show some bias. Not all opinions represent what is usually called a conflict of interest. Since JH makes his living selling tools and training for certain languages, he has a severe conflict of interest wrt asessing the value of various other languages. If these other languages are just as good or better than those he makes his living from, it would be very damaging to his livlihood for him to admit this fact. As a result, he is a completely unreliable source on the question. And you don't think that Jon Harrop could write a book about Haskell if he honestly came to think that it were a superior all-aroung language? The fact that he *didn't* mindlessly reject F# in favor of O'Caml when F# came out (despite the fact that at the time his company was deeply (exclusively?) invested in O'Caml and arguably had a vested interest in having F# fail to gain support) suggests that he is able to fairly evaluate the merits of other languages. Doubtless he has biases, but there is no reason to think that they are any greater than the bias of any programmer who has invested substantial amounts of time in becoming fluent in a particular language. This is why judges must recuse themselves from both civil and criminal trials if they have some significant conflict of interest. But an advocate isn't a judge. Nobody is handing down binding decisions here - they are just advocating their positions. It would be better to compare JH to a defense lawyer. You can't reject the defense's arguments just because the lawyer has a vested interest in the outcome of the trial. the law recognizes that we cannot expect a fair judgement from someone who stands to profit significantly if the judgement goes one way or the other. Similarly, we cannot expect a fair judgement on the relative value of various language tools from a person whose livlihood depends on the audience choosing only those certain language tools that he sells services and training for. warmest regards, Ralph -- Raffael Cavallaro -- http://mail.python.org/mailman/listinfo/python-list
Re: Python recursively __getattribute__
On Nov 22, 6:04 pm, Andreas Waldenburger use...@geekmail.invalid wrote: On Mon, 22 Nov 2010 07:46:47 -0800 (PST) Roman Dolgiy tost...@gmail.com wrote: Hello, I need to implement such behavior: obj.attr1.attr2.attr3 -- obj.attr1__attr2__attr3 It looks like I have to override obj's class __getattribute__ and also use python descriptors somehow. Any help will be much appreciated. http://stackoverflow.com/questions/4247036/python-recursively-getattr... Why? No, really: Why? In that link you say that you need to do this to support legacy code. I still don't see how this would be necessary. If you need to support legacy code, doesn't that mean that the solution you're asking for already exists? I really think you should go into detail about why you need this. I'm certain that there's a better solution to your problem. (Better being one that is reasonably easy to implement and maintain.) /W -- To reach me via email, replace INVALID with the country code of my home country. But if you spam me, I'll be one sour Kraut. I have a django project. obj is django-haystack's SearchResult instance, it contains a lot of de-normalized data (user__name, user__address) from django model, and I need to access it as result.user.name for compability reasons. -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On Mon, 22 Nov 2010 08:14:40 -0800 (PST), toby t...@telegraphics.com.au wrote: This is a good (if familiar) observation. Teaching children (or young people with little exposure to computers) how to program in various paradigms could produce interesting primary evidence. Pity that this isn't examined widely and systematically. We could learn something about how to teach programming and design languages this way, don't you agree? I do. A study such as that would be more useful than how to teach languages - it could be useful in teaching other stuff as well. -- In no part of the constitution is more wisdom to be found, than in the clause which confides the question of war or peace to the legislature, and not to the executive department. - James Madison -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On Mon, 22 Nov 2010 08:25:34 -0800, scattered wrote: On Nov 22, 9:45 am, Raffael Cavallaro raffaelcavall...@pas.despam.s.il.vous.plait.mac.com wrote: On 2010-11-22 08:12:27 -0500, markhanif...@gmail.com said: All opinions are biased. All opinions show some bias. Not all opinions represent what is usually called a conflict of interest. Since JH makes his living selling tools and training for certain languages, he has a severe conflict of interest wrt asessing the value of various other languages. If these other languages are just as good or better than those he makes his living from, it would be very damaging to his livlihood for him to admit this fact. As a result, he is a completely unreliable source on the question. And you don't think that Jon Harrop could write a book about Haskell if he honestly came to think that it were a superior all-aroung language? Until he writes one, it is useless to speculate about what he could or could not do. There are some pretty good books on Haskell, lots of excellent resources online, and the online community is very supportive. Writing a book which adds significant value to that would not be a trivial undertaking. Best, Tamas -- http://mail.python.org/mailman/listinfo/python-list
Re: Python recursively __getattribute__
On Mon, 22 Nov 2010 08:41:49 -0800 (PST) Roman Dolgiy tost...@gmail.com wrote: On Nov 22, 6:04 pm, Andreas Waldenburger use...@geekmail.invalid wrote: On Mon, 22 Nov 2010 07:46:47 -0800 (PST) Roman Dolgiy tost...@gmail.com wrote: Hello, I need to implement such behavior: obj.attr1.attr2.attr3 -- obj.attr1__attr2__attr3 It looks like I have to override obj's class __getattribute__ and also use python descriptors somehow. Any help will be much appreciated. http://stackoverflow.com/questions/4247036/python-recursively-getattr... Why? No, really: Why? [...] I have a django project. obj is django-haystack's SearchResult instance, it contains a lot of de-normalized data (user__name, user__address) from django model, and I need to access it as result.user.name for compability reasons. I don't know anything about django, so I may be babbling nonsense. Caveat emptor. How about taking your user__whatever thingies and have a function emit customized result instances. For this you can just create a plain object subclass, say ResultElement. If these user__whatever thingies are strings (you haven't told), split them by __ and create a new plain object for every level of attributes, attaching it to the previous level. You can probably make your life easier if you use defaultdicts first and then translate these to your object hierarchy. That's how I'd do it. I don't know if that helps you. If not, please provide more info. /W -- To reach me via email, replace INVALID with the country code of my home country. But if you spam me, I'll be one sour Kraut. -- http://mail.python.org/mailman/listinfo/python-list
Re: unittests with different parameters
On 11/22/2010 4:38 AM, Ulrich Eckhardt wrote: Let's say I have two flags invert X and invert Y. Now, for testing these, I would write one test for each combination. What I have in the test case is something like this: def test_invert_flags(self): test flags to invert coordinates tests = [((10, 20), INVERT_NONE, (10, 20)), ((10, 20), INVERT_X, (-10, 20)), ((10, 20), INVERT_Y, (10, -20))] for input, flags, expected in tests: res = do_invert(input, flags) self.assertEqual(res, expected, %s caused wrong results % (flags,)) So, what I do that I test the function 'do_invert' for different input combinations and verify the result. The ugly thing is that this will abort the whole test if one of the tests in the loop fails. So, my question is how do I avoid this? I know that I could write a common test function instead: def _test_invert_flags(self, input, flags, expected): res = do_invert(input, flags) self.assertEqual(res, expected) def test_invert_flags_non(self): test not inverting coordinates self._test_invert_flags((10, 20), INVERT_NONE, (10, 20)) def test_invert_flags_x(self): test inverting X coordinates self._test_invert_flags((10, 20), INVERT_X, (-10, 20)) def test_invert_flags_y(self): test inverting Y coordinates self._test_invert_flags((10, 20), INVERT_Y, (10, -20)) What I don't like here is that this is unnecessarily verbose and that it basically repeats information. The above code looks perfectly fine to me for testing. I think the question you should ask yourself is whether the different combinations you are testing represent tests of distinct behaviors, or tests of the same behavior on a variety of data. If the former case, as in the sample code you posted, then these should probably have separate tests anyway, so that you can easily see that both INVERT_X and INVERT_BOTH are failing, but INVERT_Y is not, which may be valuable diagnostic data. On the other hand, if your test is trying the INVERT_X behavior on nine different points, you probably don't need or want to see every individual point that fails. It's enough to know that INVERT_X is failing and to have a sample point where it fails. In that case I would say just run them in a loop and don't worry that it might exit early. Also, I'd rather construct the error message from the data instead of maintaining it in different places, because manually keeping those in sync is another, errorprone burden. I'm not sure I follow the problem you're describing. If the factored out workhorse function receives the data to test, what prevents it from constructing an error message from that data? Cheers, Ian -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On 22 nov, 14:47, Howard Brazee how...@brazee.net wrote: On Mon, 22 Nov 2010 08:14:40 -0800 (PST), toby t...@telegraphics.com.au wrote: This is a good (if familiar) observation. Teaching children (or young people with little exposure to computers) how to program in various paradigms could produce interesting primary evidence. Pity that this isn't examined widely and systematically. We could learn something about how to teach programming and design languages this way, don't you agree? I do. A study such as that would be more useful than how to teach languages - it could be useful in teaching other stuff as well. yes, pity most children are (used to be) taught Basic first. Also, with a study like this, it's likely some children would be taught some lame language and others would be taught some industrial strength language and still others would be taught some esoteric language. I'm not sure it'd prove as much as we are hoping for -- as they are all Turing equivalent and the kids would be able to eventually do the task asked for in any of them -- but I'm sure some of those children would be mentally hurt for all their life. Poor pioneers :p JH, nice to have you back! :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On Nov 22, 8:45 am, Raffael Cavallaro raffaelcavall...@pas.despam.s.il.vous.plait.mac.com wrote: On 2010-11-22 08:12:27 -0500, markhanif...@gmail.com said: All opinions are biased. All opinions show some bias. Not all opinions represent what is usually called a conflict of interest. Maybe, but in the case of regulars on newsgroups like c.l.l, there are conflicts of interest that either don't or don't indirectly have to do with profiting off the popularity or perception of a particular programming language. Harrop is annoying is the same way that MatzLisp guy is annoying on c.l.l. warmest regards, Ralph -- Raffael Cavallaro -- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On Nov 22, 12:28 pm, namekuseijin namekusei...@gmail.com wrote: On 22 nov, 14:47, Howard Brazee how...@brazee.net wrote: On Mon, 22 Nov 2010 08:14:40 -0800 (PST), toby t...@telegraphics.com.au wrote: This is a good (if familiar) observation. Teaching children (or young people with little exposure to computers) how to program in various paradigms could produce interesting primary evidence. Pity that this isn't examined widely and systematically. We could learn something about how to teach programming and design languages this way, don't you agree? I do. A study such as that would be more useful than how to teach languages - it could be useful in teaching other stuff as well. yes, pity most children are (used to be) taught Basic first. Also, with a study like this, it's likely some children would be taught some lame language and others would be taught some industrial strength language and still others would be taught some esoteric language. This is not worse than the status quo, which does exactly that, but without paying attention to outcomes. What I am proposing is doing it systematically, with observation. Then we can learn something. I'm not sure it'd prove as much as we are hoping for -- as they are all Turing equivalent and the kids would be able to eventually do the task asked for in any of them -- but I'm sure some of those children would be mentally hurt for all their life. Poor pioneers :p JH, nice to have you back! :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python recursively __getattribute__
On 11/22/2010 10:46 AM, Roman Dolgiy wrote: Hello, I need to implement such behavior: obj.attr1.attr2.attr3 -- obj.attr1__attr2__attr3 obj.attr1.attr2.attr3 is parsed as ((obj.attr1).attr2).attr3, so this cannot work in general but only if attr1 and attr2 are known to not be 'final' names. It looks like I have to override obj's class __getattribute__ and also use python descriptors somehow. Any help will be much appreciated. http://stackoverflow.com/questions/4247036/python-recursively-getattribute The code posted there by THC4k depened on such knowledge, which you gave there but not here. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: unittests with different parameters
Ian Kelly wrote: On 11/22/2010 4:38 AM, Ulrich Eckhardt wrote: Also, I'd rather construct the error message from the data instead of maintaining it in different places, because manually keeping those in sync is another, errorprone burden. I'm not sure I follow the problem you're describing. If the factored out workhorse function receives the data to test, what prevents it from constructing an error message from that data? Sorry, unprecise description of what I want. If you define a test function and run the tests with -v, the framework prints the first line of the docstring of that function followed by okay/fail/error, which is much friendlier to the reader than the exception dump afterwards. Using multiple very similar functions requires equally similar docstrings that repeat themselves. I'd prefer creating these from the input data. Thanks for your suggestion, Ian! Uli -- Domino Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932 -- http://mail.python.org/mailman/listinfo/python-list
Re: unittests with different parameters
Ulrich Eckhardt ulrich.eckha...@dominolaser.com writes: Let's say I have two flags invert X and invert Y. Now, for testing these, I would write one test for each combination. What I have in the test case is something like this: def test_invert_flags(self): test flags to invert coordinates tests = [((10, 20), INVERT_NONE, (10, 20)), ((10, 20), INVERT_X, (-10, 20)), ((10, 20), INVERT_Y, (10, -20))] for input, flags, expected in tests: res = do_invert(input, flags) self.assertEqual(res, expected, %s caused wrong results % (flags,)) The ‘testscenarios’ library is designed for just this reason URL:http://pypi.python.org/pypi/testscenarios/. It takes a sequence of scenarios, each of which is a tuple just like in your example, and causes a separate test run and report for each one. -- \ “If we listen only to those who are like us, we will squander | `\ the great opportunity before us: To live together peacefully in | _o__)a world of unresolved differences.” —David Weinberger | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list
Need advices regarding the strings (str, unicode, coding) used as interface for an external library.
I'm planning to build an external lib. This lib will exchange a lot of strings between the lib and the core Python code of applications. I wish this lib to be modern, 100% unicode compliant. It will be developped for Python 2.7 and for Python 3. In an early phase, technically, it will be developed on Python 2.7 before Python 3, probably 3.2. Two options for the strings interface. a) Pure unicode, that means only type 'unicode' in Python 2.7 and only type 'str' in Python 3. Similar to the Python io module. b) Like a) plus ascii and utf-8 encoded type 'str' to keep some kind of retro compatibility. This lib will anyway work in a unicode mode, so the ascii and the encoded utf-8 str's have to be converted into unicode. I'm very comfortable with all this coding stuff and aware of the pros and cons of each solutions. My favourite solution is clearly on the a) side. Advices and comments are welcome. Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python recursively __getattribute__
On Nov 22, 7:57 pm, Terry Reedy tjre...@udel.edu wrote: On 11/22/2010 10:46 AM, Roman Dolgiy wrote: Hello, I need to implement such behavior: obj.attr1.attr2.attr3 -- obj.attr1__attr2__attr3 obj.attr1.attr2.attr3 is parsed as ((obj.attr1).attr2).attr3, so this cannot work in general but only if attr1 and attr2 are known to not be 'final' names. It looks like I have to override obj's class __getattribute__ and also use python descriptors somehow. Any help will be much appreciated. http://stackoverflow.com/questions/4247036/python-recursively-getattr... The code posted there by THC4k depened on such knowledge, which you gave there but not here. -- Terry Jan Reedy I need to support a lot of legacy code, with THC4k's approach I'll have to modify project's existing code to use obj.attr1.val instead of obj.attr1 but this is not suitable. -- http://mail.python.org/mailman/listinfo/python-list
Glob in python which supports the ** wildcard
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 recursive ** wildcard. Is there any 3rd party glob function which do support **? Regards, Martin Lundberg -- http://mail.python.org/mailman/listinfo/python-list
Re: Glob in python which supports the ** wildcard
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 recursive ** wildcard. Is there any 3rd party glob function which do support **? Regards, Martin Lundberg os.walk() or os.path.walk() can be used. You need to traverse the file system. AFAIK there is no support for this. attachment: stefan_sonnenberg.vcf-- http://mail.python.org/mailman/listinfo/python-list
Re: Scheme as a virtual machine?
On 2010-11-22 11:25:34 -0500, scattered said: And you don't think that [JH] could write a book about Haskell if he honestly came to think that it were a superior all-aroung language? Until he actually does, he has a financial interest in trash-talking Haskell. This makes anything he says about Haskell suspect. The fact that he *didn't* mindlessly reject [musical note lang] in favor of [Irish Ship Of The Desert] when [musical note lang] came out (despite the fact that at the time his company was deeply (exclusively?) invested in [Irish Ship Of The Desert] and arguably had a vested interest in having [musical note lang] fail to gain support) suggests that he is able to fairly evaluate the merits of other languages. No, it suggests that he saw that supporting the Irish Ship Of The Desert meant going up against Microsoft, so he jumped to the MS supported variant of the Donut Dromedary. You miss the fundamental point; having a financial interest in the outcome of a debate makes anything that person says an advertisement for his financial interests, not a fair assessment. Doubtless he has biases, but there is no reason to think that they are any greater than the bias of any programmer who has invested substantial amounts of time in becoming fluent in a particular language. Just the opposite. A person who makes his living by being paid to program in a language he has developed some expertise in (rather than selling books on it and training for it) has no financial interest in seeing others develop expertise in it - they would just represent competition. By contrast, one who sells training and books for a language profits directly when others take an interest in that language. Their financial interests are in fact opposite. JH profits when people take an interest in languages he sells training for; a working lisp programmer sees additional *competition* when someone else develops expertise in common lisp. But an advocate isn't a judge. Nobody is handing down binding decisions here - they are just advocating their positions. Now you're arguing our point; JH is an *advocate* with a clear conflict of interest which prevents him from presenting anything but the most one sided, and therefore largely useless, assessment. His writing should be seen as a paid advertisement, not as a fair treatment of programming languages. warmest regards, Ralph -- Raffael Cavallaro -- http://mail.python.org/mailman/listinfo/python-list
Re: Glob in python which supports the ** wildcard
HI, Am 22.11.2010 um 23:05 schrieb Stefan Sonnenberg-Carstens: Am 22.11.2010 22:43, schrieb Martin Lundberg; 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 recursive ** wildcard. Is there any 3rd party glob function which do support **? os.walk() or os.path.walk() can be used. You need to traverse the file system. AFAIK there is no support for this. Or python only: -- #!/usr/bin/env python import os, fnmatch # generator: def find_files(directory, pattern): for root, dirs, files in os.walk(directory): for basename in files: if fnmatch.fnmatch(basename, pattern): filename = os.path.join(root, basename) yield filename # process each file as it is found: for filename in find_files('apps/name', '*.js'): print 'found java source:', filename -- Found at http://stackoverflow.com/questions/2186525/use-a-glob-to-find-files-recursively-in-python Have a nice day -- kurt.alfred.muel...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Glob in python which supports the ** wildcard
Hi, Am 22.11.2010 um 23:05 schrieb Stefan Sonnenberg-Carstens: Am 22.11.2010 22:43, schrieb Martin Lundberg: 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 recursive ** wildcard. Is there any 3rd party glob function which do support **? os.walk() or os.path.walk() can be used. You need to traverse the file system. AFAIK there is no support for this. If you are a lucky Unix/Linux/MacOS user: --- #!/usr/bin/env python # find files import os cmd = 'find apps/name/ -type f -name *.js -print' # find is a standard Unix tool for filename in os.popen(cmd).readlines(): # run find command # do something with filename --- find is very powerful, really. Have anice day -- kurt.alfred.muel...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Need advices regarding the strings (str, unicode, coding) used as interface for an external library.
On 11/22/2010 3:25 PM, jmfauth wrote: I'm planning to build an external lib. This lib will exchange a lot of strings between the lib and the core Python code of applications. Are you planning to exchange indirectly via disk files or directly via memory buffers? This pretty much amounts to whether the library will interface with Python-only or with anything. Also, what OSes? If 'all', you need to be able to work with both 2 and 4 byte unicodes. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
How to install uTidylib, easy_install problem
I'm using activepython 2.6 on XP. I am trying to install uTidylib 0.2 with easy_install. I like uTidylib more vs. newer modules.and want to use it. I get output below. How do I install it? I do see it in http://pypi.python.org/simple/uTidylib/ Thanks. C:\Documents and Settings\user1easy_install uTidylib install_dir C:\Python26\Lib\site-packages\ Searching for uTidylib Reading http://pypi.python.org/simple/uTidylib/ Reading http://utidylib.sf.net No local packages or download links found for uTidylib error: Could not find suitable distribution for Requirement.parse('uTidylib') -- http://mail.python.org/mailman/listinfo/python-list
Re: Glob in python which supports the ** wildcard
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 recursive ** wildcard. Is there any 3rd party glob function which do support **? mercurial.match supports apps/name/**.js (IIUC). mglob supports rec:*.js. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: How to install uTidylib, easy_install problem
On 2010-11-22, at 4:22 PM, goldtech wrote: I'm using activepython 2.6 on XP. I am trying to install uTidylib 0.2 with easy_install. I like uTidylib more vs. newer modules.and want to use it. I get output below. How do I install it? I do see it in http://pypi.python.org/simple/uTidylib/ Thanks. C:\Documents and Settings\user1easy_install uTidylib install_dir C:\Python26\Lib\site-packages\ Searching for uTidylib Reading http://pypi.python.org/simple/uTidylib/ Reading http://utidylib.sf.net No local packages or download links found for uTidylib error: Could not find suitable distribution for Requirement.parse('uTidylib') You could try using the Windows installer (uTidylib-0.2.1.win32.exe) from: http://developer.berlios.de/project/showfiles.php?group_id=1810 And perhaps also let Cory Dodt know that his 6-year old package entry has broken download link in it http://pypi.python.org/pypi/uTidylib/ There is not even a source release for 0.2.1. I'd be more than happy to make this available in PyPM http://code.activestate.com/pypm/utidylib/ once I can find at least the source release of 0.2.1 -srid -- http://mail.python.org/mailman/listinfo/python-list
File Reading In Mac
Hello , I have been trying to read contents from a file in MAC. I wrote the code filename = test.rtf FileHandle = open(filename,'r') fileStr = FileHandle.read() print fileStr FileHandle.close() When I see the output I see a lot of junk. The junk is like a lot of question marks, the font information and other details of the file. The actual content is lost in the junk. I have tried other methods like readline but still I see the junk. I tried the asme code in windows and it worked correctly. Can any one tell me the reason and the solution for this. Thanks In advance. -- http://mail.python.org/mailman/listinfo/python-list
bug? mmap doesn't like 0-length files
mmap.mmap (f.fileno(), 0, prot=mmap.PROT_READ) error: [Errno 22] Invalid argument According to http://docs.python.org/library/mmap.html, mmap on _windows_ doesn't accept 0-length file. But this was tested on linux. Is this a bug? I don't see anything in linux man-page about the underlying C mmap function not accepting 0-length files. -- http://mail.python.org/mailman/listinfo/python-list
Re: File Reading In Mac
In article 66e4164c-e81d-4a65-b847-c5ef900fa...@a37g2000yqi.googlegroups.com, dilip raghavan dilip198...@gmail.com wrote: I have been trying to read contents from a file in MAC. I wrote the code filename = test.rtf FileHandle = open(filename,'r') fileStr = FileHandle.read() print fileStr FileHandle.close() When I see the output I see a lot of junk. The junk is like a lot of question marks, the font information and other details of the file. The actual content is lost in the junk. I have tried other methods like readline but still I see the junk. I tried the asme code in windows and it worked correctly. Can any one tell me the reason and the solution for this. With an extension of rtf, the file is presumably a Rich Text Format file. http://en.wikipedia.org/wiki/Rich_Text_Format There are some Python packages out there for dealing with rtf format files. You might try rtf2xml to convert the file, preserving style attributes: http://pypi.python.org/pypi/rtf2xml/ Or look at the Mac OS X command line utility textutil (man 1 textutil) to convert the file to another format. Or use the OS X TextEdit.app. -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
Re: Round Trip: C to Python to C Module
On Nov 19, 11:05 am, Eric Frederich eric.freder...@gmail.com wrote: I have a proprietary software PropSoft that I need to extend. They support extensions written in C that can link against PropLib to interact with the system. I have a Python C module that wraps a couple PropLib functions that I call PyProp.From an interactive Python shell I can import PyProp and call a function. None of these functions really do anything outside the context of being logged into the PropSoft software; so all the functions fail when running from Python alone. To my amazement, I was able to run PyRun_SimpleString(import PyProp\nPyProp.some_function()) without setting PYTHONPATH or anything. How this works, I don't know and I don't really care (at the moment anyway). The problem I'm having now is how do I return things from my Python script back to C? Ultimately I won't be hard coding python inside of PyRun_SimpleString but loading the script from a file. So, how do I return values back to C? Python functions return values but running a python script?... doesn't that just have an exit status? Is there a mechanism for doing this? Thanks in advance, ~Eric If you find you can't make this work as planned, you might want to check out the SIMPL toolkit (http://www.icanprogram.com/06py/lesson1/ lesson1.html) for an alternative way to connect C programs to Python modules. bob -- http://mail.python.org/mailman/listinfo/python-list
Re: bug? mmap doesn't like 0-length files
On 22Nov2010 20:33, Neal Becker ndbeck...@gmail.com wrote: | mmap.mmap (f.fileno(), 0, prot=mmap.PROT_READ) | error: [Errno 22] Invalid argument | | According to http://docs.python.org/library/mmap.html, mmap on _windows_ | doesn't accept 0-length file. But this was tested on linux. Is this a bug? | | I don't see anything in linux man-page about the underlying C mmap function | not accepting 0-length files. On a local Gentoo Linux box mmap(2) says in the ERRORS section: EINVAL We don't like addr, length, or offset (e.g., they are too large, or not aligned on a page boundary). EINVAL (since Linux 2.6.12) length was 0. EINVAL flags contained neither MAP_PRIVATE or MAP_SHARED, or contained both of these values. Sure looks like a length of 0 is disliked. Cheers, -- Cameron Simpson c...@zip.com.au DoD#743 http://www.cskk.ezoshosting.com/cs/ Carpe Daemon - Seize the Background Process - Paul Tomblin ab...@freenet2.carleton.ca -- http://mail.python.org/mailman/listinfo/python-list
Re: bug? mmap doesn't like 0-length files
On 23Nov2010 13:59, I wrote: | On 22Nov2010 20:33, Neal Becker ndbeck...@gmail.com wrote: | | mmap.mmap (f.fileno(), 0, prot=mmap.PROT_READ) | | error: [Errno 22] Invalid argument [...] | | I don't see anything in linux man-page about the underlying C mmap function | | not accepting 0-length files. It's worth noting that any time you get an errno error/exception then it is almost certainly the underlying OS interface that has rejected your request, not the python library. Cheers, -- Cameron Simpson c...@zip.com.au DoD#743 http://www.cskk.ezoshosting.com/cs/ Don't have awk? Use this simple sh emulation: #!/bin/sh echo 'Awk bailing out!' 2 exit 2 - Tom Horsley tahors...@csd.harris.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Reading bz2 file into numpy array
On Mon, 22 Nov 2010 11:37:22 +0100, Peter Otten wrote: is there a convenient way to read bz2 files into a numpy array? Try f = bz2.BZ2File(filename) data = numpy.fromstring(f.read(), numpy.float32) That's going to hurt if the file is large. You might be better off either extracting to a temporary file, or creating a pipe with numpy.fromfile() reading the pipe and either a thread or subprocess decompressing the data into the pipe. E.g.: import os import threading class Pipe(threading.Thread): def __init__(self, f, blocksize = 65536): super(Pipe, self).__init__() self.f = f self.blocksize = blocksize rd, wr = os.pipe() self.rd = rd self.wr = wr self.daemon = True self.start() def run(self): while True: s = self.f.read(self.blocksize) if not s: break os.write(self.wr, s) os.close(self.wr) def make_real(f): return os.fdopen(Pipe(f).rd, 'rb') Given the number of situations where you need a real (OS-level) file handle or descriptor rather than a Python file-like object, something like this should really be part of the standard library. -- http://mail.python.org/mailman/listinfo/python-list
Re: bug? mmap doesn't like 0-length files
On Mon, 22 Nov 2010 20:33:08 -0500, Neal Becker wrote: I don't see anything in linux man-page about the underlying C mmap function not accepting 0-length files. My mmap(2) manpage says: ERRORS ... EINVAL (since Linux 2.6.12) length was 0. -- http://mail.python.org/mailman/listinfo/python-list
Re: CGI FieldStorage instances?
Let me rephrase the question. Say I have a query string like this: ?view=Dataitem=9875 What I want to do is simply invoke process view with variable Data. This would replace my existing query string mess which looks like this: if 'view' in form and 'item' in form: HTML=view(Data, item(9875)) so it just seems like it would be easier to encode the process in the query rather than filtering the query string. -- Gnarlie -- http://mail.python.org/mailman/listinfo/python-list
Re: MATLAB to Python?
On Nov 22, 11:11 am, Peter Otten __pete...@web.de wrote: Try numpy.arange() instead: numpy.arange(0, 1, .1) array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]) Thanks! It worked. What's wrong with the following code? ---8---8---8--- T0_orig = [5, 50, 500, 5000] for counter in T0_orig: T0 = (L**2)/(D*pi**2)*counter amax = T0/kappa alpha = (10**-6)*amax lambda_, xx, f = nonhomog_solver(kappa, alpha, nu, nx) V0 = sqrt( T0_orig*(m**-1) + pi**2 * D/(m*L**2)*lambda_ ) print V0 = , V0 print ---8---8---8--- Python says: ---8---8---8--- Traceback (most recent call last): File nonhomog.py, line 159, in module main() File nonhomog.py, line 157, in main nonhomog(0.2) File nonhomog.py, line 152, in nonhomog V0 = sqrt( T0_orig*(m**-1) + pi**2 * D/(m*L**2)*lambda_ ) TypeError: can't multiply sequence by non-int of type 'float' ---8---8---8--- -- http://mail.python.org/mailman/listinfo/python-list
Re: MATLAB to Python?
MATLABdude matlab.d...@mbnet.fi writes: On Nov 22, 11:11 am, Peter Otten __pete...@web.de wrote: Try numpy.arange() instead: numpy.arange(0, 1, .1) array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]) Thanks! It worked. What's wrong with the following code? ---8---8---8--- T0_orig = [5, 50, 500, 5000] for counter in T0_orig: T0 = (L**2)/(D*pi**2)*counter amax = T0/kappa alpha = (10**-6)*amax lambda_, xx, f = nonhomog_solver(kappa, alpha, nu, nx) V0 = sqrt( T0_orig*(m**-1) + pi**2 * D/(m*L**2)*lambda_ ) print V0 = , V0 print ---8---8---8--- Python says: ---8---8---8--- Traceback (most recent call last): File nonhomog.py, line 159, in module main() File nonhomog.py, line 157, in main nonhomog(0.2) File nonhomog.py, line 152, in nonhomog V0 = sqrt( T0_orig*(m**-1) + pi**2 * D/(m*L**2)*lambda_ ) TypeError: can't multiply sequence by non-int of type 'float' ---8---8---8--- T0_orig is a list and you are trying to multiply this list by a float (m**-1) -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list
Re: MATLAB to Python?
On Nov 23, 9:43 am, Arnaud Delobelle arno...@gmail.com wrote: T0_orig is a list and you are trying to multiply this list by a float (m**-1) Yes, yes of course. Thanks! :) This works: ---8---8---8--- T0_orig = [5, 50, 500, 5000] for counter in T0_orig: T0 = (L**2)/(D*pi**2)*counter amax = T0/kappa alpha = (10**-6)*amax lambda_, xx, f = nonhomog_solver(kappa, alpha, nu, nx) V0 = sqrt( counter*(m**-1) + pi**2 * D/(m*L**2)*lambda_ ) print V0 = , V0 print ---8---8---8--- -- http://mail.python.org/mailman/listinfo/python-list
[issue10483] http.server - what is executable on Windows
Martin v. Löwis mar...@v.loewis.de added the comment: Martin, that is an interesting viewpoint, and one I considered, but didn't state, because it seems much too restrictive. Most CGI programs are written in scripting languages, not compiled to .exe. So it seems the solution should allow for launching at least Perl and Python scripts, as well as .exe. Notice that it does support launching Python scripts. I disagree that Perl scripts need to be supported. The idea of CGI is really that programs get run by the web server, with the notion of programs clearly deviating from system to system. Window really doesn't support scripts (in the hash-bang sense), and it isn't the function of http.server to extend Windows here. At best, support for .bat files might be negotiable, using cmd.exe to launch them (but I personally would not). Anybody who wants support for other kinds of scripts on Windows will have to subclass CGIHTTPRequestHandler (and it might be useful to simplify subclassing that class). In any case, the bug as stated (def executable is simply wrong) has a clear resolution - make it match what the rest of the code supports. Anything beyond that is a feature request. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10483 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1284316] Win32: Security problem with default installation directory
Gynvael Coldwind gynv...@gmail.com added the comment: (since Issue 10491 is superseded by this one, I'll reply here) As I've said in issue 10491, in my opinion this is not a case of frustrating users because they have to elevate the console (I think they have to do that in case of UAC anyway), but a case of privilege escalation vulnerability on mutli-user Windows systems with Python installed globally (i.e. in the default installation directory). Though I am aware there are not many such systems to begin with, I am pretty certain they do exist (think: servers at an University giving Python access to students, and not using *nix for some reason). There are also non-multi-user systems with multiple accounts (think: production systems running stuff on different accounts), and this issue can be abused as one of many steps during an attack, after gaining shell access, but before gaining administrative rights. I acknowledge your right to choose not to fix this issue due to usability issues, but in such case imo there should be an explicit message during the installation making the user aware of this insecurity. The last months revealed issues like this in many applications and tools, and they have (mostly) been patched, so administrators might assume this was also fixed in Python (especially since this is known from 2005). -- nosy: +Gynvael.Coldwind ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1284316 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10459] missing character names in unicodedata (CJK...)
Martin v. Löwis mar...@v.loewis.de added the comment: For 3.2, this now fixed in r86681. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10459 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10500] Palevo.DZ worm msix86 installer 3.x installer
New submission from Vil viligno...@gmail.com: scan on msi installer x86 win 3.x python gives Win32/Palevo.DZ worm and erases. -- messages: 122101 nosy: VilIgnoble priority: normal severity: normal status: open title: Palevo.DZ worm msix86 installer 3.x installer type: security versions: Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10500 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10483] http.server - what is executable on Windows
Glenn Linderman v+pyt...@g.nevcal.com added the comment: The rest of the code has clearly never had its deficiencies exposed on Windows, simply because executable() has prevented that. So what the rest of the code already supports is basically nothing. Reasonable Windows support is appropriate to implement as part of the bugfix. You state that it isn't the function of http.server to extend Windows, however, even MS IIS has extended Windows to provide reasonable web scripting functionality, albeit it its own way, thus convicting the Windows facilities of being insufficient. Attempting to use http.server to get a web testing environment running so that Python scripts can be tested locally requires some way of using an existing environment (except, of course, for all new web sites). I suppose you would claim that using http.server for a web testing environment is an inappropriate use of http.server, also. Yet http.server on Unix appears to provide an adequate web testing environment: yes, some of that is because of Unix's #! feature. This would certainly not be the first case where more code is required on Windows than Unix to implement reasonable functionality. My desire for support for Perl is not an attempt to convince Python developers to use Perl instead of Python, but simply a reflection of the practicality of life: There are a lot of Perl CGI scripts used for pieces of Web servers. Reinventing them in Python may be fun, but can be more time consuming than projects may have the luxury to do. Your claim that it already supports Python CGI scripts must be tempered by the documentation claim that it provides altered semantics. altered semantics, as best as I can read in the code, is that the query string is passed to the Python script as a command line if it doesn't happen to contain an = sign. This is weird, unlikely to be found in a real web server, and hence somewhat useless for use as a test server also. http.server has chosen to use subprocess which has chosen to use CreateProcess as its way of executing CGI. There are other Windows facilities for executing programs, such as ShellExecute, but of course it takes the opposite tack: it can execute nearly any file, via registry-based associations. Neither of these seem to be directly appropriate for use by http.server, the former being too restrictive without enhancements, the latter being too liberal in executing too many file types, although the requirement that CGI scripts live in specific directories may sufficiently rein in that liberality. However, you have made me think through the process: it seems that an appropriate technique for Windows is to allow for a specific set of file extensions, and permit them to be executed using the registry-based association to do so. However, for .cgi files, which depend heavily on the Unix #!, emulation of #! seems appropriate (and Windows doesn't seem to have an association for .cgi files either). Your suggestion of making CGIHTTPRequestHandler easier to subclass is certainly a good one, and is almost imperative to implement to fix this bug in a useful manner without implementing an insufficient set of Windows extensions (for someone's definition of wrong). There should be a way to sidestep the altered semantics for Python scripts (and Python scripts shouldn't have to be a special case, they should work with the general case), without replacing the whole run_cgi() function. There should be a hook to define the list of executable extensions, and how to run them, and/or a hook to alter the command line passed to subprocess.Popen to achieve same. So is_executable and is_python both seem to currently be replacable. What is missing is a hook to implement cmdline creation before calling subprocess.Popen() (besides the other reported bugs, of course) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10483 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10231] SimpleHTTPRequestHandler directory bugs
Hallvard B Furuseth h.b.furus...@usit.uio.no added the comment: Senthil Kumaran writes: I have doubts on the validity of this bug itself. - First is, query and fragment are usually for the file being served from the webserver, not on the directories. If there are characters such as '?' and '#' in the directory names, which may get featured in the path, then those should be quoted in the request. So foo/dir?baz is wrong where as foo/dir%3Fbaz it the correct request. That's backwards. Start with the URL spec (RFC 3986), not with thinking of filesystem paths. If '?' or '#' do occur in the URL, they are not part of the path. That is the case this bug report is about. That's because it reserves these characters for query and fragment. So yes, the if filesystem path contains '?' or '#', these must be escaped in the URL. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10231 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10501] make_buildinfo regression with unquoted path
New submission from Martin gzl...@googlemail.com: My build got broken by the change for issue 9981 in revision 86137. The problem is it adds $(IntDir) to various places in the vcproj file, including the command line arguments to make_buildinfo, and my svn checkout is under a dir with a space in. Ideally it could just use a relative path, but just making sure it's quoted works too. -- components: Build files: issue9981_regression.patch keywords: patch messages: 122104 nosy: gz, krisvale priority: normal severity: normal status: open title: make_buildinfo regression with unquoted path versions: Python 3.2 Added file: http://bugs.python.org/file19769/issue9981_regression.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10501 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10470] python -m unittest ought to default to discovery
Michael Foord mich...@voidspace.org.uk added the comment: Eli - I quite agree. TestProgram is a *particularly* obscure part of unittest. A much better solution (well - both would be ideal) would be to refactor the code so that it isn't so obscure. TestProgram is an artefact of unittest's history and should be a series of functions rather than a class. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10470 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9771] add an optional default argument to tokenize.detect_encoding
STINNER Victor victor.stin...@haypocalc.com added the comment: no cookie found, returns ('utf-8', [line1, line2]) I never understood the usage of the second item. IMO it should be None if no cookie found. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9771 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10459] missing character names in unicodedata (CJK...)
Martin v. Löwis mar...@v.loewis.de added the comment: The patch for 3.1 is r86685. The patch for 2.7 is r86686. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10459 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10483] http.server - what is executable on Windows
Martin v. Löwis mar...@v.loewis.de added the comment: Your suggestion of making CGIHTTPRequestHandler easier to subclass is certainly a good one, and is almost imperative to implement to fix this bug in a useful manner without implementing an insufficient set of Windows extensions (for someone's definition of wrong). It's indeed the approach I would prefer over the alternatives you suggested - I particularly dislike Python implementing a strategy where #! files become considered on Windows (you then immediately run into subsequent problems, such as /usr/bin/perl being no valid filename on most Windows installations). So I maintain that technically, in order to resolve the *reported* issue (msg121875), it is sufficient to define that executables on Windows are the files ending with .exe. To recall, the reported issue is is simply wrong ... is not clear what to use instead (to you as the reporter). My job as a maintainer is to resolve this, and I will decide to resolve this as suggested. Even the refactoring to allow substitution of process creation is an independent feature, but I'm willing to accept patches. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10483 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10501] make_buildinfo regression with unquoted path
Martin v. Löwis mar...@v.loewis.de added the comment: Kristjan, can you take a look? -- assignee: - krisvale nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10501 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1675455] Use getaddrinfo() in urllib2.py for IPv6 support
Changes by Senthil Kumaran orsent...@gmail.com: -- assignee: facundobatista - orsenthil nosy: -BreamoreBoy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1675455 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10483] http.server - what is executable on Windows
Changes by Senthil Kumaran orsent...@gmail.com: -- nosy: +orsenthil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10483 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10502] Add unittestguirunner to Tools/
New submission from Michael Foord mich...@voidspace.org.uk: Add the unittestgui test runner, built with Tk, to the Tools directory. It would be good to have this script included in the bin/ directory of the Mac installer as well. The unittestgui runner can be found at: https://bitbucket.org/markroddy/unittestgui The code is a modification of the original unittestgui by Steve Purcell and updated for test discovery by Mark Roddy. I have asked Mark if he is willing to help maintain the code and asked him to complete a contributor agreement. -- assignee: michael.foord components: Library (Lib) messages: 122110 nosy: michael.foord, ronaldoussoren priority: low severity: normal stage: needs patch status: open title: Add unittestguirunner to Tools/ type: behavior versions: Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10502 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10502] Add unittestguirunner to Tools/
Michael Foord mich...@voidspace.org.uk added the comment: It will need documenting, or at least pointing to in the documentation, probably with a note recommending Hudson for production use - unittestgui is a tool for beginners / convenience. Note also that Brian Curtin has contributed a patch to make unittestgui Python 3 compatible. This has not yet been 'merged upstream': http://lists.idyll.org/pipermail/testing-in-python/2010-November/003604.html -- nosy: +brian.curtin ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10502 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7257] Improve documentation of list.sort and sorted()
Ole Laursen o...@iola.dk added the comment: Okay. I can only say that while the current docstrings are likely good reminders for you, knowing Python in and out, they were pretty useless to me as documentation, which I believe docstrings should be, they're called docstrings, after all, not reminderstrings. :) I fail to see how including more info can hurt in any way, you're not forced to read it if you don't need it, so I hope you (or somebody else) will reconsider at some point. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7257 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10501] make_buildinfo regression with unquoted path
Kristján Valur Jónsson krist...@ccpgames.com added the comment: Ah yes, spaces in filenames. One always forgets. Fixed the make_buildinfo.c (quote whole string, not just part of it) and committed in revision 86689 -- resolution: - accepted status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10501 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: Actually, I don't think it's a great idea in general to use temporary files for logging, though of course there are specific cases where one might do this. So for the logging examples in the docs (which used '/tmp/XXX') I just removed the '/tmp/' part. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8525] Small enhancement to help()
Rob Cliffe rob.cli...@btinternet.com added the comment: Thanks for your work. Glad if I have made a contribution to Python, however small. Rob Cliffe On 22/11/2010 00:26, Éric Araujo wrote: Éric Araujomer...@netwok.org added the comment: Thank you. I uploaded your patch to Rietveld and reviewed it: http://codereview.appspot.com/3169042/ -- ___ Python trackerrep...@bugs.python.org http://bugs.python.org/issue8525 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8525 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8525] Small enhancement to help()
Rob Cliffe rob.cli...@btinternet.com added the comment: I would not be at all surprised if my patch could be simplified (in fact I'd be surprised if it couldn't). However, I did try out your version on Python 2.5 specifically, and it did not work for me. Trying it out on help(Exception), the relevant members of object.__subclasses__() viz. type 'exceptions.StandardError', type 'exceptions.StopIteration' etc. had a __module__attribute which equalled 'exceptions', not 'builtins'. Best wishes Rob Cliffe On 22/11/2010 01:33, Alexander Belopolsky wrote: Alexander Belopolskybelopol...@users.sourceforge.net added the comment: The following passes tests in elp_8525.patch, but is much simpler: === --- Lib/pydoc.py (revision 86600) +++ Lib/pydoc.py (working copy) @@ -1139,6 +1139,15 @@ push('' + makename(base)) push('') +# List the built-in subclasses, if any: +subclasses = [cls.__name__ for cls in object.__subclasses__() + if cls.__module__ == 'builtins'] +if subclasses: +push(Built-in subclasses:) +for subclassname in sorted(subclasses): +push('' + subclassname) +push('') + # Cute little class to pump out a horizontal rule between sections. class HorizontalRule: def __init__(self): -- nosy: +belopolsky ___ Python trackerrep...@bugs.python.org http://bugs.python.org/issue8525 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8525 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10503] os.getuid() documentation should be clear on what kind of uid it is referring
New submission from Giampaolo Rodola' g.rod...@gmail.com: http://docs.python.org/library/os.html#os.getuid os.getuid() documentation just states: Return the current process’s user id. It is not clear, however, whether user id refers to real, effective or saved user id. As per: http://linux.about.com/library/cmd/blcmdl2_getuid.htm ...it should refer to _real_ user id. -- assignee: d...@python components: Documentation messages: 122117 nosy: d...@python, giampaolo.rodola priority: normal severity: normal status: open title: os.getuid() documentation should be clear on what kind of uid it is referring versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10503 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8525] Small enhancement to help()
Éric Araujo mer...@netwok.org added the comment: New features can only go into 3.2, so you have to test with an updated checkout of the Subversion branch named py3k. See the link I have in a previous message. (P.S. Would you be so kind as to edit quoted text out of your replies? It’s unnecessary noise. Thanks in advance.) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8525 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10466] locale.py resetlocale throws exception on Windows (getdefaultlocale returns value not usable in setlocale)
Marc-Andre Lemburg m...@egenix.com added the comment: I think that's a bug in the resetlocale() API. The correct way to reset the locale setting to defaults, it to use setlocale(category, ) The other issues here is that getlocale() appears to return non-ISO language codes on Windows. If that's indeed the case, then we would need to add mappings of the Windows codes to the ISO ones and use a reverse mappings to make setlocale() work with the ISO codes. Perhaps it's easier to just update the mapping used by getdefaultencoding() to return the non-ISO codes used by Windows and then update the documentation to say that on Windows, non-ISO codes are returned. BTW: I wonder why this hasn't popped up earlier. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10466 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9424] Disable unittest.TestCase.assertEquals and assert_ during a regrtest run
Ezio Melotti ezio.melo...@gmail.com added the comment: Committed in r86690 on py3k, blocked in r86691 and r88692 on 3.1/2.7. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9424 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4493] urllib2 doesn't always supply / where URI path component is empty
Wes Chow wes.c...@gmail.com added the comment: This same bug also exists in HTTPClient, and my patch addresses that. Addressing it in HTTPClient has a side effect of taking care of it for urllib2 as well (and all future libraries that use HTTPClient). Even if the urllib2 patch is preferable, shouldn't we fix the problem in HTTPClient as well? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4493 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10504] Trivial mingw compile fixes
New submission from Johann Hanne pyt...@jf.hanne.name: There are a number of mingw compile issues which are easily fixed * some _MSC_VER #if's should be MS_WINDOWS instead * for cross-compiling, windows.h should be all-lowercase * mingw has a strcasecmp, so private implementations must not use that name -- components: Build files: Python-2.7.diff keywords: patch messages: 122122 nosy: jonny priority: normal severity: normal status: open title: Trivial mingw compile fixes versions: Python 2.7 Added file: http://bugs.python.org/file19770/Python-2.7.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10504 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue940286] pydoc.Helper.help() ignores input/output init parameters
Changes by Éric Araujo mer...@netwok.org: -- stage: unit test needed - patch review versions: +Python 2.7, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue940286 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10503] os.getuid() documentation should be clear on what kind of uid it is referring
Giampaolo Rodola' g.rod...@gmail.com added the comment: Update: I think also os.getlogin() doc is wrong. This is what it states (2.7 doc): Return the name of the user logged in on the controlling terminal of the process. For most purposes, it is more useful to use the environment variable LOGNAME to find out who the user is, or pwd.getpwuid(os.getuid())[0] to get the login name of the currently effective user id. Since os.getuid() refers to _real_ uid the last sentence should be changed as such: - ... to get the login name of the currently effective user id. + ... to get the login name of the currently real user id. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10503 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
Éric Araujo mer...@netwok.org added the comment: Whatsnew documents are not edited after the corresponding release is done. Using either /home/user or tempfile depending on the example seems good to me. -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10490] mimetypes read_windows_registry fails for non-ASCII keys
Changes by And Clover a...@doxdesk.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10490 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10351] Add autocompletion for keys in dictionaries
Éric Araujo mer...@netwok.org added the comment: Review time! +elif [ in text: +self.matches = self.dict_key_matches(text) Does this complete only dicts? What about other mappings? What about other sequences implementing __getitem__? One of the function name and the function docstring (“Compute matches when text contains a [”) is wrong. I’m not familiar with rlcompleter’s internals, so I’d like a few comments sprinkled in the code. Please wrap your lines at 79 columns, and follow other advice given at http://www.python.org/dev/patches/ for the next version of your patch. +The evaluation of the part before the '[' could be enhanced. This belongs in a comment or a test, not the docstring. + 'DictCompleteMe[\'öh, вау!\']', I find it more readable to avoid escaped quotes whenever possible. Here I would use DictCompleteMe['öh, вау!']. -- assignee: d...@python - components: -Documentation nosy: -d...@python ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10351 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9095] patchcheck should handle extraneous whitespace in .rst files
Éric Araujo mer...@netwok.org added the comment: I tried to use “make patchcheck” after edits to reST files and it hung. Do you have the same behavior? I suspect reindent-rst is the culprit. I’m wondering about the reindenting; other checks in patchcheck don’t edit files, they just print warnings. On the other hand, removing trailing whitespace and reindenting is not a very good use of people’s time, so having a tool do them is good. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9095 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10466] locale.py resetlocale throws exception on Windows (getdefaultlocale returns value not usable in setlocale)
R. David Murray rdmur...@bitdance.com added the comment: I had a report from a user on IRC during the bug weekend that they could not reproduce the failure on windows. So it may be dependent on the windows version. That doesn't answer your question of why it hasn't come up before, though, since my tests were done on XP. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10466 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8890] Use tempfile instead of /tmp in examples
anatoly techtonik techto...@gmail.com added the comment: On Mon, Nov 22, 2010 at 3:59 PM, Éric Araujo rep...@bugs.python.org wrote: Using either /home/user or tempfile depending on the example seems good to me. There is no /home/user on Windows. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8890 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10505] test_compileall: failure on Windows
New submission from Stefan Krah stefan-use...@bytereef.org: On Windows, test_compileall fails due to #10197: == FAIL: test_quiet (test.test_compileall.CommandLineTests) -- Traceback (most recent call last): File D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_compileall.py, line 227, in test_quiet self.assertGreater(len(noise), len(quiet)) AssertionError: 89 not greater than 89 The patch uses subprocess.check_output() instead. Technically, now byte strings are compared instead of strings, but that should not matter for the outcome. Does the patch look ok? -- components: Tests files: test_compileall.patch keywords: buildbot, patch messages: 122129 nosy: brian.curtin, r.david.murray, skrah priority: normal severity: normal stage: patch review status: open title: test_compileall: failure on Windows type: behavior versions: Python 3.2 Added file: http://bugs.python.org/file19771/test_compileall.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10505 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10505] test_compileall: failure on Windows
Éric Araujo mer...@netwok.org added the comment: Can you post on #10453? Thanks in advance. -- nosy: +eric.araujo resolution: - duplicate stage: patch review - committed/rejected status: open - closed superseder: - Add -h/--help option to compileall ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10505 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10087] HTML calendar is broken
Chris Lambacher ch...@kateandchris.net added the comment: I don't understand what you mean by elides the line breaks in output. They are still there, you just don't see them as \n because print() is no longer implicitly converting the bytes to a string (which appears to actually result in a repr). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10087 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10087] HTML calendar is broken
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10087 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com