ANN: MyNewspaper-1.0
Hi there, I'm really pleased to announce the first public release of MyNewspaper. MyNewspaper is a personal RSS Aggregator and Reader, licensed under GPL. Why? As everybody says, I couldn't find any which fulfills all my requirements. In fact I used liferea and was pretty happy with it, but it eats lot of memory when you have many feeds and the program is running for much time, but the main problem was that it's a desktop program and I couldn't read the feeds from the work. So I started writing my own RSS aggregator and reader. MyNewspaper is written in Python with a bit of javascript and uses sqlite as permanent storage for the articles. It is installed as a CGI, so in order to use and manage it you need a web browser and a web server. Feeds are updated by a command run by cron or from the WebUI. Read more and download it from: http://inigo.katxi.org/devel/mynewspaper or http://www.terra.es/personal7/inigoserna/mynewspaper Of course, all comments, suggestions etc. are welcome. And yes, I know code is really awful now, but I wanted to make a public release to get some feedback while improving the code. Best regards, -- Iñigo Serna [EMAIL PROTECTED] Katxijasotzaileak signature.asc Description: This is a digitally signed message part -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations.html
Python HTTP digest authentication woes...
I'm trying to access the XML version of my Tivo now playing list with python. It uses auth digest HTTP authentication. I could really use some help! I'm able to get this page using curl: curl --dump-header tivoHeaders --insecure --anyauth --user tivo:808 https://192.168.1.102/TiVoConnect?Command=QueryContainerContainer=%2FNowPlayingRecurse=Yes; But when I use my python script, I get rejected: https://192.168.1.102/TiVoConnect?Container=%2FNowPlayingCommand=QueryContainerRecurse=Yes Error 401 Server: tivo-httpd-1:7.1b-01-2:140 Set-Cookie: sid=DEC2D78EABF48A6D; path=/; expires=Saturday, 16-Feb-2013 00:00:00 GMT; WWW-Authenticate: Digest realm=TiVo DVR, nonce=FD08EF226909CA85, qop=auth Content-Length: 31 Content-Type: text/html Connection: close Digest realm=TiVo DVR, nonce=FD08EF226909CA85, qop=auth I've scrounged for examples out there and the couple that I've found just don't seem to work for me.. Here's one way I've tried: = import urllib2 theurl = 192.168.1.102/TiVoConnect?Container=%2FNowPlayingCommand=QueryContainerRecurse=Yes print theurl protocol = 'https://' username = 'tivo' password = '808' passman = urllib2.HTTPPasswordMgrWithDefaultRealm() passman.add_password(None, theurl, username, password) authhandler = urllib2.HTTPDigestAuthHandler(passman) opener = urllib2.build_opener(authhandler) urllib2.install_opener(opener) try: pagehandle = urllib2.urlopen(protocol + theurl) except IOError, e: if hasattr(e, 'code'): if e.code != 401: print 'We got another error' print e.code else: print Error 401 print e.headers print e.headers['www-authenticate'] === I get 401 every time! This was taken from an example online almost verbatim, the only major thing I changed was HTTPBasicAuthHandler -- HTTPDigestAuthHandler. Any ideas or help would be greatly appreciated! Thanks, -John -- http://mail.python.org/mailman/listinfo/python-list
Re: SSL problem... SSL23_GET_SERVER_HELLO:unknown protocol
John Reese wrote: Morning. I've been running into an error message pertaining to SSL that I don't understand, and I was hoping someone had some insight. Gmail provides POP access over SSL on port 587, so I tried to use poplib.POP_SSL, with the following results: [...] socket.sslerror: (1, 'error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol') Any suggestions or insight? It appears that pop.gmail.com *doesn't* provide SSL on port 587. [EMAIL PROTECTED]:~/doc$ telnet pop.gmail.com 587 Trying 64.233.185.111... Connected to pop.gmail.com. Escape character is '^]'. 220 mx.gmail.com ESMTP 13sm5173422wrl This rather looks like an unencrypted SMTP connection to me. Indeed, port 587 is the mail submission protocol. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I import a py script by its absolute path name?
Hello James, James Dennett [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] J.Bijsterbosch wrote: [ snip ] and didn't remember Windows uses path names which need special treatment. Hmm, what you call special treatmentg comes from pythons deep underlying C and C++ language heietidge I presume. A backslash in a C or C++ string means the following character is a so called escape character, like \n represents a newline and \r a return to the beginning of a line. If you really want a backslash you need to type it twice like so \\. Has nothing to do with Windows...;-)) Actually, it does have a connection to Windows. On Unix, backslashes are rarely used for anything *except* escape characters. Pathnames tend not to include backslashes, so in most cases it's not necessary to escape backslashes in path names. I knowg, I've had mandrake installed for some time until that pc died on me, the pc that is, not mandrake... On Windows, however, backslash is a valid path separator, and must be escaped. So, on Unix, for a path separator, you type /. On Windows you can either do the same, or type \\. (Or (ab)use raw strings.) Okay, point taken, but I still think it's more a C(++) string thing than a Windows issue. I could of course argue that the backslash path separator is there for backward compatebility with Dos, but I won't, much to off topic...;-)) James Greetings from overcast Amsterdam, Jan -- http://mail.python.org/mailman/listinfo/python-list
I just wanna know about os.path module..
I've just started digging into how python works.. I found that other mudules are clearly declared like one file per a module.. But the only os.path doesn't have their own file.. ye I know is has actually depending on os like in my case posixpath.. What I'd love to know is.. when I call import os.path.. how happened under the hood? I'm currently using python 2.4 in linux machine.. I'd appreciate it -- http://mail.python.org/mailman/listinfo/python-list
Re: SSL problem... SSL23_GET_SERVER_HELLO:unknown protocol
Martin v. Löwis [EMAIL PROTECTED] writes: [EMAIL PROTECTED]:~/doc$ telnet pop.gmail.com 587 Trying 64.233.185.111... Connected to pop.gmail.com. Escape character is '^]'. 220 mx.gmail.com ESMTP 13sm5173422wrl This rather looks like an unencrypted SMTP connection to me. Indeed, port 587 is the mail submission protocol. It wants a STARTTLS command. -- http://mail.python.org/mailman/listinfo/python-list
Re: I just wanna know about os.path module..
kimes wrote: I've just started digging into how python works.. I found that other mudules are clearly declared like one file per a module.. But the only os.path doesn't have their own file.. ye I know is has actually depending on os like in my case posixpath.. What I'd love to know is.. when I call import os.path.. how happened under the hood? I'm currently using python 2.4 in linux machine.. I'd appreciate it See line 5 of os.py (comment) - os.path is one of the modules posixpath, ntpath, or macpath It says it sets os.path depending on the platform and does so in line 132 sys.modules['os.path'] = path In your case, os.path should be implemented in posixpath.py See line 48 to see where it came from In short, use the source, Luke :-) especially when Python is exceptionally readable. -- http://mail.python.org/mailman/listinfo/python-list
Ordering Products
Here might be an interesting puzzle for people who like sorting algorithms ( and no I'm not a student anymore and the problem is not a students 'homework' but a particular question associated with a computer algebra system in Python I'm currently developing in my sparetime ). For motivation lets define some expression class first: class Expr: def __init__(self, name=): self.name = name self.factors = [self] def __mul__(self, other): p = Expr() if isinstance(other,Expr): other_factors = other.factors else: other_factors = [other] p.factors = self.factors+other_factors return p def __rmul__(self, other): p = M() p.factors = [other]+self.factors return p def __repr__(self): if self.name: return self.name else: return *.join([str(x) for x in self.factors]) One can create arbitrary products of Expr objects ( and mixing numbers into the products ): a,b,c = Expr(a),Expr(b),Expr(c) a*b a*b 7*a*8*9 7*a*8*9 The goal is to evaluate such products and/or to simplify them. For expressions like x = 7*a*8*9 this might be easy, because we just have to sort the factor list and multiply the numbers. x.factors.sort() x a*7*8*9 - a*504 This can be extended to arbitrary products: x = 7*a*b*a*9 x.factors.sort() x a*a*b*7*9 - (a**2)*b*63 Now lets drop the assumption that a and b commute. More general: let be M a set of expressions and X a subset of M where each element of X commutes with each element of M: how can a product with factors in M be evaluated/simplified under the condition of additional information X? It would be interesting to examine some sorting algorithms on factor lists with constrained item transpositions. Any suggestions? Regards, Kay -- http://mail.python.org/mailman/listinfo/python-list
Re: SSL problem... SSL23_GET_SERVER_HELLO:unknown protocol
John Reese wrote: Morning. I've been running into an error message pertaining to SSL that I don't understand, and I was hoping someone had some insight. Gmail provides POP access over SSL on port 587, so I tried to use poplib.POP_SSL, with the following results: GMail uses port 995. -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
Steven D'Aprano wrote: On Sat, 16 Jul 2005 16:42:58 -0400, Peter Hansen wrote: Come on, Steven. Don't tell us you didn't have access to a Python interpreter to check before you posted: Er, as I wrote in my post: Steven who is still using Python 2.3, and probably will be for quite some time Sorry, missed that! I don't generally notice signatures much, partly because Thunderbird is smart enough to grey them out (the main text is displayed as black, quoted material in blue, and signatures in a light gray.) I don't have a firm answer (though I suspect the language reference does) about when dedicated parentheses are required around a generator expression. I just know that, so far, they just work when I want them to. Like most of Python. :-) -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Tuples in function argument lists
Steven D'Aprano wrote: I'm trying to understand the use of tuples in function argument lists. I did this: def tester(a, (b,c)): ... print a, b, c ... tester(1, 2) Traceback (most recent call last): File stdin, line 1, in ? File stdin, line 1, in tester TypeError: unpack non-sequence That was obvious result. tester(1, (2, 3)) 1 2 3 tester('ab', 'ab') ab a b And so were those. Then I tried this: def tester(a, (b,c)=None): ... if (b,c) is None: ... print a, None ... else: ... print a, b, c Needless to say, it did not do what I expected it to do. I didn't expect it to either :-) I tried looking at the language reference here: http://docs.python.org/ref/function.html but I can't seem to find anything in their that says that tuples-as-args are legal. Am I misreading the docs, or is this accidental behaviour that shouldn't be relied on? Tuples-as-arg are legal. Tuple-as-keyword, too *if* the default value is something that can actually unpack to a tuple. A default of None is...silly. In [6]: def tester(a, (b,c)=(1,2)): ...: print a,b,c ...: In [7]: tester(1) 1 1 2 Tuple-as-arg is probably pretty safe. Tuple-as-keyword, possibly not-so-much. Does anyone use this behaviour, and if so, under what circumstances is it useful? import math def distance((x1,y1), (x2,y2)): return math.sqrt((x2-x1)**2 + (y2-y1)**2) distance(point1, point2) Personally, I prefer to explicitly unpack the tuple in the function body. -- Robert Kern [EMAIL PROTECTED] In the fields of hell where the grass grows high Are the graves of dreams allowed to die. -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list
beginner question fibonacci
# Fibonacci series: ... # the sum of two elements defines the next ... a, b = 0, 1 while b 10: ... print b ... a, b = b, a+b ... 1 1 2 3 5 8 a, b = 0, 1 while b 10: print b a = b b = a+b 1 2 4 8 Why a, b = b, a+b isn't a = b; b = a+b ? -- http://mail.python.org/mailman/listinfo/python-list
Re: beginner question fibonacci
Joon wrote: # Fibonacci series: ... # the sum of two elements defines the next ... a, b = 0, 1 while b 10: ... print b ... a, b = b, a+b ... 1 1 2 3 5 8 a, b = 0, 1 while b 10: print b a = b b = a+b 1 2 4 8 Why a, b = b, a+b isn't a = b; b = a+b ? It's actually equivalent to: temp = (b, a+b) a = temp[0] b = temp[1] The temporary tuple object is created first, with the old values of a and b. Then a and b are reassigned. The value of a doesn't change until *after* a+b is calculated. -- Robert Kern [EMAIL PROTECTED] In the fields of hell where the grass grows high Are the graves of dreams allowed to die. -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list
Re: beginner question fibonacci
Joon wrote: a, b = 0, 1 while b 10: print b a = b b = a+b 1 2 4 8 Why a, b = b, a+b isn't a = b; b = a+b ? Because you changed a before you added it to b. Let's call your existing a and b a0 and b0, and the next a and b a1 and b1. When you do a, b = b, a+b you are assigning: a1 = b0 b1 = a0 + b0 But when you use separate statements, you are assigning: a1 = b0 b1 = a1 + b0 = b0 + b0 = 2*b0 -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list
Re: beginner question fibonacci
The case is that Python in attribution commands solves first the right side, so he atributes the vars. So the a+b expression is executed first. Joon escreveu: # Fibonacci series: ... # the sum of two elements defines the next ... a, b = 0, 1 while b 10: ... print b ... a, b = b, a+b ... 1 1 2 3 5 8 a, b = 0, 1 while b 10: print b a = b b = a+b 1 2 4 8 Why a, b = b, a+b isn't a = b; b = a+b ? -- http://mail.python.org/mailman/listinfo/python-list
Re: beginner question fibonacci
Yes, i see. Thank you very much for the fast help! -- http://mail.python.org/mailman/listinfo/python-list
Re: ssh popen stalling on password redirect output?
In article [EMAIL PROTECTED], Cantankerous Old Git [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: In general, it is good idea to use expect kind of tool to deal with interactive programs like ssh. You may try using pexpect (http://pexpect.sourceforge.net). I tried tha once (on Solaris) and found that ssh could tell that pexpect wasn't a real tty and refused to connect. In the end, I had pexpect do a telnet 127.0.0.1, log in, then so ssh to the real destination. Pain in the ass but it worked. The Cog 1. Pexpect is designed to do better than this. Please report specific deficiencies in its operation. 2. (The original) Expect has had years of working out pty vagaries. In a pinch, I'd write in Expect, and, if necessary, control the Expect process from Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: Environment Variable
In article [EMAIL PROTECTED], Sybren Stuvel [EMAIL PROTECTED] wrote: tuxlover enlightened us with: No, the replies from Grant's and Sybren's do answer my question. It would be a lot more polite to actually thank the people helping you. . . . Expressing gratitude is indeed a courtesy. As an old-time Usenetter, I also have a high regard for economy or brevity; I generally communicate my thanks in private e-mail, unless I can embed them in a comment which I think is likely to interest a wider audience. I have in mind something on the order of, Thanks, timbot! I notice that not only does that solution conform to IEEE 754, as requested, but it's compatible with the Rayleigh-Ritz implementation found in ... I'm certain neither of Mr. Stuvel's point, nor of whether it applied to tuxlover's actual behavior. I wouldn't want readers to think, though, that every well-formed clp thread must necessarily terminate in a follow-up whose content is limited to Thx. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python vs. Access VBA
If you are going to go with Python, don't include Access in the mix at all. If you want a small light-weight, serverless database back-end, you would be better to go with SQLite. Its cross platform and well proven. I think Firebird will give you that too, though I have never used it. Most people who use Oracle don't need it. Unless you REALLY need it (Think terabytes of data), Oracle is like cracking a nut with a sledge hammer. You can do it. But you have to slug around a lot more weight in order to do what you can accomplish with a nut cracker. In other words its overly complicated. -Chris On Sun, Jul 17, 2005 at 08:06:22AM -0400, Ed Leafe wrote: On Jul 15, 2005, at 11:19 PM, William Lodge wrote: Finally, does anybody know of any Web sites having examples of database apps in Python? You might want to look at Dabo, which is a database application framework for Python. In about 30 seconds you can create an application that queries a database, displays the results, and allows for editing/updating/inserting/deleting records. Currently we do not have an ODBC interface, which is what you'd need if the data is in Access, since no one involved has written that module. However, if you are interested in developing your app in Dabo, we'd be glad to add that module as long as you're willing to give us the feedback we need to get it working smoothly. BTW, I wouldn't suggest scaling up to Oracle - why get involved with all that licensing? There are many open-source databases, such as PostgreSQL, MySQL and Firebird that can handle large data sets without getting stuck with huge license fees. ___/ / __/ / / Ed Leafe http://leafe.com/ http://dabodev.com/ -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
ConfigParser : overwrite ?
Hi, I'm trying and updating an .ini file with ConfigParser but each time I call 'write', it appends the whole options another time to the file. For example : Here's the inital ini file [section1] foodir: %(dir)s/whatever dir: foo Here's my code : filename = ... config = ConfigParser.ConfigParser() config.read(filename) config.set('section1', 'dir', 'anotherdir') f = open(filename, 'r+') config.write(f) f.close() Then I get : [section1] foodir: %(dir)s/whatever dir: anotherdir [section1] foodir: %(dir)s/whatever dir: foo I tried also with 'w', 'w+', 'a' ... What's the correct way to avoid this ? -- http://mail.python.org/mailman/listinfo/python-list
Re: ConfigParser : overwrite ?
cantabile wrote: Hi, I'm trying and updating an .ini file with ConfigParser but each time I call 'write', it appends the whole options another time to the file. For example : Here's the inital ini file [section1] foodir: %(dir)s/whatever dir: foo Here's my code : filename = ... config = ConfigParser.ConfigParser() config.read(filename) config.set('section1', 'dir', 'anotherdir') f = open(filename, 'r+') config.write(f) f.close() Then I get : [section1] foodir: %(dir)s/whatever dir: anotherdir [section1] foodir: %(dir)s/whatever dir: foo I tried also with 'w', 'w+', 'a' ... Are you sure you tried it with 'w' as the mode? In [1]: !cat foo.ini [section1] foodir: %(dir)s/whatever dir: foo In [2]: fn = 'foo.ini' In [3]: import ConfigParser In [4]: cfg = ConfigParser.ConfigParser() In [5]: cfg.read(fn) Out[5]: ['foo.ini'] In [6]: cfg.set('section1', 'dir', 'anotherdir') In [7]: f = open(fn, 'w') In [8]: cfg.write(f) In [9]: f.close() In [10]: !cat foo.ini [section1] foodir = %(dir)s/whatever dir = anotherdir -- Robert Kern [EMAIL PROTECTED] In the fields of hell where the grass grows high Are the graves of dreams allowed to die. -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list
Re: ConfigParser : overwrite ?
Robert Kern a écrit : cantabile wrote: Hi, I'm trying and updating an .ini file with ConfigParser but each time I call 'write', it appends the whole options another time to the file. For example : Here's the inital ini file [section1] foodir: %(dir)s/whatever dir: foo Here's my code : filename = ... config = ConfigParser.ConfigParser() config.read(filename) config.set('section1', 'dir', 'anotherdir') f = open(filename, 'r+') config.write(f) f.close() Then I get : [section1] foodir: %(dir)s/whatever dir: anotherdir [section1] foodir: %(dir)s/whatever dir: foo I tried also with 'w', 'w+', 'a' ... Are you sure you tried it with 'w' as the mode? In [1]: !cat foo.ini [section1] foodir: %(dir)s/whatever dir: foo In [2]: fn = 'foo.ini' In [3]: import ConfigParser In [4]: cfg = ConfigParser.ConfigParser() In [5]: cfg.read(fn) Out[5]: ['foo.ini'] In [6]: cfg.set('section1', 'dir', 'anotherdir') In [7]: f = open(fn, 'w') In [8]: cfg.write(f) In [9]: f.close() In [10]: !cat foo.ini [section1] foodir = %(dir)s/whatever dir = anotherdir You are right, it works. I thought I had tried it ... Thanks. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: I just wanna know about os.path module..
Thanks for all you guys help.. But Peter, You said 'At first os - module, or package, it doesn't matter here - is imported.' I'm still confused about that.. When I just call import os.path without calling import os.. In that case, you mean 'import os' is called implicitly? Why? and How? how python knows it should call import when we call import os? Please make me clear.. :) Thanks.. -- http://mail.python.org/mailman/listinfo/python-list
Re: SSL problem... SSL23_GET_SERVER_HELLO:unknown protocol
On Sun, 17 Jul 2005 11:05:06 +0100, Stephen Illingworth [EMAIL PROTECTED] wrote: John Reese wrote: Morning. I've been running into an error message pertaining to SSL that I don't understand, and I was hoping someone had some insight. Gmail provides POP access over SSL on port 587, so I tried to use poplib.POP_SSL, with the following results: GMail uses port 995. Yeah. I misread the instructions. I apologize for being an idiot. It works just fine on port 995. -- http://mail.python.org/mailman/listinfo/python-list
Re: Ordering Products
Kay Schluehr wrote: Here might be an interesting puzzle for people who like sorting algorithms ( and no I'm not a student anymore and the problem is not a students 'homework' but a particular question associated with a computer algebra system in Python I'm currently developing in my sparetime ). folded x = 7*a*b*a*9 x.factors.sort() x a*a*b*7*9 - (a**2)*b*63 Now lets drop the assumption that a and b commute. More general: let be M a set of expressions and X a subset of M where each element of X commutes with each element of M: how can a product with factors in M be evaluated/simplified under the condition of additional information X? It would be interesting to examine some sorting algorithms on factor lists with constrained item transpositions. Any suggestions? Regards, Kay Looks interesting Kay. I think while the built in sort works as a convenience, you will need to write your own more specialized methods, both an ordering (parser-sort), and simplify method, and call them alternately until no further changes are made. (You might be able to combine them in the sort process as an optimization.) A constrained sort would be a combination of splitting (parsing) the list into sortable sub lists and sorting each sub list, possibly in a different manner, then reassembling it back. And doing that possibly recursively till no further improvements are made or can be made. On a more general note, I think a constrained sort algorithm is a good idea and may have more general uses as well. Something I was thinking of is a sort where instead of giving a function, you give it a sort key list. Then you can possibly sort anything in any arbitrary order depending on the key list. sort(alist, [0,1,2,3,4,5,6,7,8,9]) # Sort numbers forward sort(alist, [9,8,7,6,5,4,3,2,1,0]) # Reverse sort sort(alist, [1,3,5,7,9,0,2,4,6,8]) # Odd-Even sort sort(alist, [int,str,float]) # sort types These are just suggestions, I haven't worked out the details. It could probably be done currently with pythons built in sort by writing a custom compare function that takes a key list. How fine grained the key list is is also something that would need to be worked out. Could it handle words and whole numbers instead of letters and digits? How does one specify which? What about complex objects? Here's a quick sort function that you might be able to play with.. There are shorter versions of this, but this has a few optimizations added. Overall it's about 10 times slower than pythons built in sort for large lists, but that's better than expected considering it's written in python and not C. Cheers, Ron # Quick Sort def qsort(x): if len(x)2: return x# Nothing to sort. # Is it already sorted? j = min = max = x[0] for i in x: # Get min and max while checking it. if imin: min=i if imax: max=i if ij: # It's not sorted, break # so stop checking and sort. j=i else: return x # It's already sorted. lt = [] eq = [] gt = [] # Guess the middle value based on min and max. mid = (min+max)//2 # Divide into three lists. for i in x: if imid: lt.append(i) continue if imid: gt.append(i) continue eq.append(i) # Recursively divide the lists then reassemble it # in order as the values are returned. return q(lt)+eq+q(gt) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Programming Contest
* Brian Quinlan [EMAIL PROTECTED] [2005-07-15 02:08]: You can find the first problem here: http://www.sweetapp.com/pycontest/contest1 I have one question about the problem. Is the cost we are to minimize the cost of arriving in the target city at all, or the cost of arriving at the target city at the end of the final day of the schedule? (If you were traveling to a conference, for example, you'd have a specific arrival time, and a cost to stay in the destination city until that time. But, if you were going to sight-see, then you could arrive at any time, and begin your itinerary upon arrival.) Say I can find a combination of flights that gets me to the target at the end of day 3 for 390 units, and a combination that gets me there at the end of day 4 for 400. If you count the hostel cost from day 3 to day 4, the first combination costs 410. So, which is preferred? -John P.S. I just realized this may be answered be the test suite, but I'm still at the thinking stage. -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
Bengt Richter wrote: Thanks for the nudge. Actually, I know about generator expressions, but at some point I must have misinterpreted some bug in my code to mean that join in particular didn't like generator expression arguments, and wanted lists. I suspect this is bug 905389 [1]: def gen(): ... yield 1 ... raise TypeError('from gen()') ... ''.join([x for x in gen()]) Traceback (most recent call last): File interactive input, line 1, in ? File interactive input, line 3, in gen TypeError: from gen() ''.join(x for x in gen()) Traceback (most recent call last): File interactive input, line 1, in ? TypeError: sequence expected, generator found I run into this every month or so, and have to remind myself that it means that my generator is raising a TypeError, not that join doesn't accept generator expressions... STeVe [1] http://www.python.org/sf/905389 -- http://mail.python.org/mailman/listinfo/python-list
What is your favorite Python web framework?
I am doing some research for a Python framework to build web applications. I have discarted Zope because from what I've read, the learning curve is too steep, and it takes more time to build applications in general with Zope. I have kept the following: - PyWork - http://pywork.sourceforge.net (Not sure if it's mature) - Django - http://www.djangoproject.com (Looks interesting) - CherryPy - http://www.cherrypy.org (Unsure) I have also found a more comprehensive list here: http://wiki.python.org/moin/WebProgramming But I'd like to know your opinion on what you think is best. The Python framework I'll use will be to build an e-commerce application looking like Amazon.com I favor speed of development, intensive OO development, performance under heavy load, short learning curve, good documentation and community. -- Thanks, Admin. Want to buy me a book? http://tinyurl.com/78xzb :) -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
Admin enlightened us with: But I'd like to know your opinion on what you think is best. The Python framework I'll use will be to build an e-commerce application looking like Amazon.com I'm greatly in favour of Cheetah. Also see http://www.unrealtower.org/mycheetah. I need to put up way more documentation examples, but the basics are there. Let me know what you think! Sybren -- The problem with the world is stupidity. Not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself? Frank Zappa -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
On Sun, 17 Jul 2005 19:15:49 -0300, Sybren Stuvel [EMAIL PROTECTED] wrote: http://www.unrealtower.org/mycheetah Error 404 while looking up your page AND when looking for a suitable 404 page. Sorry! No such file /var/www/www.unrealtower.org/compiled/error404.py I can't express myself on Cheetah, sorry!! -- Thanks, Admin. Want to buy me a book? http://tinyurl.com/78xzb :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Programming Contest
John Hazen wrote: * Brian Quinlan [EMAIL PROTECTED] [2005-07-15 02:08]: You can find the first problem here: http://www.sweetapp.com/pycontest/contest1 I have one question about the problem. Is the cost we are to minimize the cost of arriving in the target city at all, or the cost of arriving at the target city at the end of the final day of the schedule? (If you were traveling to a conference, for example, you'd have a specific arrival time, and a cost to stay in the destination city until that time. But, if you were going to sight-see, then you could arrive at any time, and begin your itinerary upon arrival.) Say I can find a combination of flights that gets me to the target at the end of day 3 for 390 units, and a combination that gets me there at the end of day 4 for 400. If you count the hostel cost from day 3 to day 4, the first combination costs 410. So, which is preferred? -John P.S. I just realized this may be answered be the test suite, but I'm still at the thinking stage. What we really need is a problem *specification* contest. -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
I really like Karrigell ( http://karrigell.sourceforge.net ). It is, IMHO, the most pythonic framework because all you need to know is the python language. You don't need to learn any template or special language, you only use plain and regular python. It also gives you a lot of freedom when choosing a programming style: you can code python inside html (just like in PHP or ASP) or you can code html within python. It also lets you map databases to objects and you can use the included database Gadfly or any other that has a python api. The downside: it currectly works with its built-in server, and although you can use it alongside Apache or Xitami, there's still no way to do it with mod_python, and as far as I know, there's no hosting providers with Karrigell instaled. It is being used mainly by people who run their websites from their own computers. -- http://mail.python.org/mailman/listinfo/python-list
Re: Ordering Products
Kay Schluehr kay.schluehr at gmx.net writes: Now lets drop the assumption that a and b commute. More general: let be M a set of expressions and X a subset of M where each element of X commutes with each element of M: how can a product with factors in M be evaluated/simplified under the condition of additional information X? It would be interesting to examine some sorting algorithms on factor lists with constrained item transpositions. Any suggestions? I don't think that sorting is the answer here. Firts of all IMHO you have to add an additional constraint - associativity of the operation in question So the problem could be reduced to making the constant parts be more associative than the non-constant parts. which you should be able to do with a parser. The BNF grammar could look like this: expr ::= v_expr * v_expr | v_expr v_expr ::= variable | c_expr c_expr ::= l_expr * literal | l_expr l_expr ::= literal | ( expr ) The trick is to create a stronger-binding multiplication operator on constants than on mixed expressions. This grammar is ambigue of course - so a LL(k) or maybe even LALR won't work. But earley's method implemented in spark should do the trick. If I find the time, I'll write an short implementation tomorrow. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
[George Sakkis] It's only obvious in the sense that _after_ you see this idiom, you can go back to the docs and realize it's not doing something special; OTOH if you haven't seen it, it's not at all the obvious solution to how do I get the first 256 characters. So IMO it should be mentioned, given that string.translate often operates on the identity table. I think a single sentence is adequate for the reference docs. For Py2.5, I've accepted a feature request to allow string.translate's first argument to be None and then run as if an identity string had been provided. Raymond Hettinger -- http://mail.python.org/mailman/listinfo/python-list
stdin/stdout fileno() always returning -1 from windows service
I have found that sys.stdin.fileno() and sys.stdout.fileno() always return -1 when executed from within a win32 service written using the win32 extensions for Python. Anyone have experience with this or know why? -- http://mail.python.org/mailman/listinfo/python-list
Re: Efficiently Split A List of Tuples
Variant of Paul's example: a = ((1,2), (3, 4), (5, 6), (7, 8), (9, 10)) zip(*a) or [list(t) for t in zip(*a)] if you need lists instead of tuples. [Peter Hansen] (I believe this is something Guido considers an abuse of *args, but I just consider it an elegant use of zip() considering how the language defines *args. YMMV] It is somewhat elegant in terms of expressiveness; however, it is also a bit disconcerting in light of the underlying implementation. All of the tuples are loaded one-by-one onto the argument stack. For a few elements, this is no big deal. For large datasets, it is a less than ideal way of transposing data. Guido's reaction makes sense when you consider that most programmers would cringe at a function definition with thousands of parameters. There is a sense that this doesn't scale-up very well (with each Python implementation having its own limits on how far you can push this idiom). Raymond -- http://mail.python.org/mailman/listinfo/python-list
Re: What is your favorite Python web framework?
http://cheetahtemplate.org/ Admin wrote: On Sun, 17 Jul 2005 19:15:49 -0300, Sybren Stuvel [EMAIL PROTECTED] wrote: http://www.unrealtower.org/mycheetah Error 404 while looking up your page AND when looking for a suitable 404 page. Sorry! No such file /var/www/www.unrealtower.org/compiled/error404.py I can't express myself on Cheetah, sorry!! -- http://mail.python.org/mailman/listinfo/python-list
Re: Efficiently Split A List of Tuples
[Richard] I know I can use a 'for' loop and create two new lists using 'newList1.append(x)', etc. Is there an efficient way to create these two new lists without using a slow for loop? If trying to optimize before writing and timing code, then at least validate your assumptions. In Python, for-loops are blazingly fast. They are almost never the bottleneck. Python is not Matlab -- vectorizing for-loops only pays-off when a high-speed functional happens to exactly match you needs (in this case, zip() happens to be a good fit). Even when a functional offers a speed-up, much of the gain is likely due to implementation specific optimizations which allocate result lists all at once rather than building them one at time. Also, for all but the most simple inner-loop operations, the for-loop overhead almost always dominated by the time to execute the operation itself. Executive summary: Python's for-loops are both elegant and fast. It is a mistake to habitually avoid them. Raymond -- http://mail.python.org/mailman/listinfo/python-list
Re: Parsing html :: output to comma delimited
Thanks for the replies, I'll post here when/if I get it finally working. So, now I know how to extract the links for the big page, and extract the text from the individual page. Really what I need to find out is how run the script on each individual page automatically, and get the output in comma delimited format. Thanks for solving the two problems though :) -Sam -- http://mail.python.org/mailman/listinfo/python-list
list implementation
I believe the type list is implemented as an array of pointers. Thus, random access is an O(1) operation while insertion/deletion is an O(n) operation. That said, I have the following questions: 1. Am I correct in saying the above? 2. Implementing list as an array is part of language specification or implementation-dependent? 3. What if I actually need a doubly-linked list for constant-time insertion/deletion? Is there a built-in type or a standard class? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
list implementation
I believe the type list is implemented as an array of pointers. Thus, random access is an O(1) operation while insertion/deletion is an O(n) operation. That said, I have the following questions: 1. Am I correct in saying the above? 2. Implementing list as an array is part of language specification or implementation-dependent? 3. What if I actually need a doubly-linked list for constant-time insertion/deletion? Is there a built-in type or a standard class? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: list implementation
sj [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I believe the type list is implemented as an array of pointers. A Python list is sematically/behaviorally defined as a mutable extensible sequence of references to Python objects. For the CPython reference implementation, the references are arrays of C pointers. Since, on balance, this works well, I presume the other four active computer language implementations do something equivalent. (How we humans execute Python code is a different question!) Thus, random access is an O(1) operation Yes while insertion/deletion is an O(n) operation. At the front, yes. (But modern CPUs with a one-instruction block mem move make the hidden multiplier relatively small.) At the end of the list, no; it is O(1). Making front insertion/deletion (but not in the middle) also O(1) has been considered but so far rejected. (For apps that need the symmetry, there is collections.deque.) 2. Implementing list as an array is part of language specification or implementation-dependent? While I believe I have answered this, I recommend reading the relevant parts of the language and library manuals (see chapter 2 of the latter). 3. What if I actually need a doubly-linked list for constant-time insertion/deletion? Is there a built-in type or a standard class? I believe it is roll-your-own to your specific needs. Of course, scanning thru such a list is still O(n). Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Who uses input()? [was Re: question on input]
On 15/07/05, Terry Hancock [EMAIL PROTECTED] wrote: On Thursday 14 July 2005 07:00 am, Michael Hoffman wrote: Devan L wrote: Use raw_input instead. It returns a string of whatever was typed. Input expects a valid python expression. Who actually uses this? It's equivalent to eval(raw_input(prompt)) but causes a lot of newbie confusion. Python-dev archives revealed that someone tried to get this deprecated but Guido disagreed. I don't think it should disappear, but it *does* seem more sensible for raw_input to be called input (or readstring or some such thing) and input to vanish into greater obscurity as eval_input or something. Unfortunately, that would break code if anything relied on input, so I guess that would be a Py3K idea, and maybe the whole I/O concept will be rethought then (if the print statement is going to go away, anyway). I don't see as break input() using code - not until py3k as a logical cause/effect. No one should be using input() anyway, the only place it's at-all appropriate is in a python tutorial, with the 'guess the number' game. -- Stephen Thorne Development Engineer -- http://mail.python.org/mailman/listinfo/python-list
Re: Ordering Products
Diez B.Roggisch wrote: Kay Schluehr kay.schluehr at gmx.net writes: Now lets drop the assumption that a and b commute. More general: let be M a set of expressions and X a subset of M where each element of X commutes with each element of M: how can a product with factors in M be evaluated/simplified under the condition of additional information X? It would be interesting to examine some sorting algorithms on factor lists with constrained item transpositions. Any suggestions? I don't think that sorting is the answer here. Firts of all IMHO you have to add an additional constraint - associativity of the operation in question So the problem could be reduced to making the constant parts be more associative than the non-constant parts. which you should be able to do with a parser. Hi Diez, I have to admit that I don't understand what you mean with the 'constant parts' of an expression? The associativity of __mul__ is trivially fullfilled for the dummy class M if an additional __eq__ method is defined by comparing factor lists because those lists are always flat: def __eq__(self, other): if isinstance(other,M): return self.factors == other.factors return False The sorting ( or better 'grouping' which can be represented by sorting in a special way ) of factors in question is really a matter of (non-)commutativity. For more advanced expressions also group properties are important: If a,b are in a center of a group G ( i.e. they commute with any element of G ) and G supplies an __add__ ( besides a __mul__ and is therefore a ring ) also a+b is in the center of G and (a+b)*c = c*(a+b) holds for any c in G. It would be nice ( and much more efficient ) not to force expansion of the product assuming distributivity of __add__ and __mul__ and factorization after the transposition of the single factors but recognizing immediately that a+b is in the center of G because the center is a subgroup of G. Regards, Kay -- http://mail.python.org/mailman/listinfo/python-list
Re: Who uses input()? [was Re: question on input]
I use input() all the time. I know many people say it ain't safe, but whose going to use it to crash their own comp? Only an insane person would, or a criminal trying to cover his/her tracks. Sorry if I waded into the debate, but this debate originated from one of my posts. Nathan Pinno - Original Message - From: Stephen Thorne [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: python-list@python.org Sent: Sunday, July 17, 2005 11:12 PM Subject: Re: Who uses input()? [was Re: question on input] On 15/07/05, Terry Hancock [EMAIL PROTECTED] wrote: On Thursday 14 July 2005 07:00 am, Michael Hoffman wrote: Devan L wrote: Use raw_input instead. It returns a string of whatever was typed. Input expects a valid python expression. Who actually uses this? It's equivalent to eval(raw_input(prompt)) but causes a lot of newbie confusion. Python-dev archives revealed that someone tried to get this deprecated but Guido disagreed. I don't think it should disappear, but it *does* seem more sensible for raw_input to be called input (or readstring or some such thing) and input to vanish into greater obscurity as eval_input or something. Unfortunately, that would break code if anything relied on input, so I guess that would be a Py3K idea, and maybe the whole I/O concept will be rethought then (if the print statement is going to go away, anyway). I don't see as break input() using code - not until py3k as a logical cause/effect. No one should be using input() anyway, the only place it's at-all appropriate is in a python tutorial, with the 'guess the number' game. -- Stephen Thorne Development Engineer -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Ordering Products
Ron Adam wrote: Kay Schluehr wrote: Here might be an interesting puzzle for people who like sorting algorithms ( and no I'm not a student anymore and the problem is not a students 'homework' but a particular question associated with a computer algebra system in Python I'm currently developing in my sparetime ). folded x = 7*a*b*a*9 x.factors.sort() x a*a*b*7*9 - (a**2)*b*63 Now lets drop the assumption that a and b commute. More general: let be M a set of expressions and X a subset of M where each element of X commutes with each element of M: how can a product with factors in M be evaluated/simplified under the condition of additional information X? It would be interesting to examine some sorting algorithms on factor lists with constrained item transpositions. Any suggestions? Regards, Kay Looks interesting Kay. I think so too :) And grouping by sorting may be interesting also for people who are not dealing with algebraic structures. I think while the built in sort works as a convenience, you will need to write your own more specialized methods, both an ordering (parser-sort), and simplify method, and call them alternately until no further changes are made. (You might be able to combine them in the sort process as an optimization.) A constrained sort would be a combination of splitting (parsing) the list into sortable sub lists and sorting each sub list, possibly in a different manner, then reassembling it back. And doing that possibly recursively till no further improvements are made or can be made. I think a comparison function which is passed into Pythons builtin sort() should be sufficient to solve the problem. I guess the comparison defines a total order on the set of elements defined by the list to sort. On a more general note, I think a constrained sort algorithm is a good idea and may have more general uses as well. Something I was thinking of is a sort where instead of giving a function, you give it a sort key list. Then you can possibly sort anything in any arbitrary order depending on the key list. sort(alist, [0,1,2,3,4,5,6,7,8,9]) # Sort numbers forward sort(alist, [9,8,7,6,5,4,3,2,1,0]) # Reverse sort sort(alist, [1,3,5,7,9,0,2,4,6,8]) # Odd-Even sort sort(alist, [int,str,float]) # sort types Seems like you want to establish a total order of elements statically. Don't believe that this is necessary. These are just suggestions, I haven't worked out the details. It could probably be done currently with pythons built in sort by writing a custom compare function that takes a key list. Exactly. How fine grained the key list is is also something that would need to be worked out. Could it handle words and whole numbers instead of letters and digits? How does one specify which? What about complex objects? In order to handle complex objects one needs more algebra ;) Since the class M only provides one operation I made the problem as simple as possible ( complex expressions do not exist in M because __mul__ is associative - this is already a reduction rule ). Kay -- http://mail.python.org/mailman/listinfo/python-list
Re: list implementation
[sj] I believe the type list is implemented as an array of pointers. Yes. Thus, random access is an O(1) operation while insertion/deletion is an O(n) operation. Yes. 2. Implementing list as an array is part of language specification or implementation-dependent? Implementation dependent but likely to be an array of pointers. 3. What if I actually need a doubly-linked list for constant-time insertion/deletion? Is there a built-in type or a standard class? Yes. Use collections.deque(). http://docs.python.org/tut/node13.html#SECTION001370 http://docs.python.org/lib/module-collections.html Raymond -- http://mail.python.org/mailman/listinfo/python-list
[ python-Bugs-1239681 ] email.Utils.formatdate documetaion missing
Bugs item #1239681, was opened at 2005-07-17 04:09 Message generated for change (Settings changed) made by montanaro You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1239681group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Closed Resolution: None Priority: 5 Submitted By: Nir Soffer (nirs) Assigned to: Skip Montanaro (montanaro) Summary: email.Utils.formatdate documetaion missing Initial Comment: email.Utils.formatdate documentation does not mention that 'usegmt' keyword argument is new on Python 2.4. reference: http://python.org/doc/2.4.1/lib/module-email.Utils.html http://python.org/doc/2.3.5/lib/module-email.Utils.html I don't know if its the rule, but usually the docs warn about new additions, and its very important when you try to create code that should work on multiple Python versions. Suggested fix replace: Optional usegmt is a flag that when True, outputs a date string with the timezone as an ascii string GMT, rather than a numeric -. This is needed for some protocols (such as HTTP). This only applies when localtime is False with: Optional usegmt is a flag that when True, outputs a date string with the timezone as an ascii string GMT, rather than a numeric -. This is needed for some protocols (such as HTTP). This only applies when localtime is False. New in Python 2.4. -- Comment By: Skip Montanaro (montanaro) Date: 2005-07-17 06:50 Message: Logged In: YES user_id=44345 Fixed in 2.4 and CVS docs. Thanks. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1239681group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Feature Requests-414059 ] Floating point second in date/time tuple
Feature Requests item #414059, was opened at 2001-04-05 19:33 Message generated for change (Settings changed) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=414059group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None Status: Closed Resolution: Rejected Priority: 3 Submitted By: Tim Cera (timcera) Assigned to: Nobody/Anonymous (nobody) Summary: Floating point second in date/time tuple Initial Comment: Would like to have this: gt;gt;gt; time.localtime(1057035600.6) (2003, 7, 1, 1, 0.6, 0, 1, 182, 1) Instead of: gt;gt;gt; time.localtime(1057035600.6) (2003, 7, 1, 1, 0, 0, 1, 182, 1) At a minimum the fractional seconds should be rounded instead of truncated. thanks tim cera -- Comment By: Raymond Hettinger (rhettinger) Date: 2003-08-09 10:06 Message: Logged In: YES user_id=80475 Agree with Brett. Closing this one. -- Comment By: Brett Cannon (bcannon) Date: 2003-05-13 00:55 Message: Logged In: YES user_id=357491 The problem is that the C library's localtime is used to do the conversion and that takes in a time_t argument. On almost all platforms this is a long int. Forcing the number to an integer prevent any unexpected warning about casting if the platform does support floats for some odd reason. The reason the argument is truncated is because the argument to PyArg_ParseTuple is 'd', which is integer. Python basically does what C would do which is truncate. You could round it up by taking the number as a Python object, calling Python's round function, and then extract the integer after the rounding. Trouble is that now your value accounts for time that you didn't even have. The plus side to truncating is your are not adding on time that did not occur; you are just losing some extra time you had. =). If you want to create a patch to rectify the situation you might get people to support the idea, but I don't view this as critical, especially when you can call round yourself before passing the value to localtime. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=414059group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Feature Requests-445484 ] pickle lacks float('inf')
Feature Requests item #445484, was opened at 2001-07-28 17:21 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=445484group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Closed Resolution: Fixed Priority: 4 Submitted By: Anthony Doggett (anthonydoggett) Assigned to: Nobody/Anonymous (nobody) Summary: pickle lacks float('inf') Initial Comment: Support for float('inf') still appears to be missing in Python 2.1.1 (#1, Jul 28 2001, 14:15:01) [GCC egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)] on linux2 gt;gt;gt; cPickle.dumps(float('inf'), 1) Traceback (most recent call last): File quot;lt;stdingt;quot;, line 1, in ? SystemError: frexp() result out of range gt;gt;gt; pickle.dumps(float('inf'), 1) Traceback (most recent call last): File quot;lt;stdingt;quot;, line 1, in ? File quot;/var/ajd111/python/lib/python2.1/pickle.pyquot;, line 943, in dumps Pickler(file, bin).dump(object) File quot;/var/ajd111/python/lib/python2.1/pickle.pyquot;, line 109, in dump self.save(object) File quot;/var/ajd111/python/lib/python2.1/pickle.pyquot;, line 211, in save f(self, object) File quot;/var/ajd111/python/lib/python2.1/pickle.pyquot;, line 273, in save_float self.write(BINFLOAT + pack('gt;d', object)) SystemError: frexp() result out of range Both structmodule.c and cPickle.c require changes. Surely something like if (x == HUGE_VAL) {/* Inf */ e = 1024; f = 0.0; } else { f = frexp(x, amp;e); ... and if (e == 1024) x = HUGE_VAL; /* Inf */ else { is all that is required for all IEEE754 machines? (structmodule.c requires similar changes for Float also) -- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-07-17 15:11 Message: Logged In: YES user_id=1188172 This is in CVS for 2.5. -- Comment By: Tim Peters (tim_one) Date: 2003-05-13 03:12 Message: Logged In: YES user_id=31435 This appears to be outside the scope of PEP 754 (as defined by the PEP's author -- he's just aiming at symbolic constants and inquiry functions). -- Comment By: Brett Cannon (bcannon) Date: 2003-05-13 02:46 Message: Logged In: YES user_id=357491 PEP 754 should make sure to deal with this. -- Comment By: Tim Peters (tim_one) Date: 2001-09-05 22:16 Message: Logged In: YES user_id=31435 Changed to Feature Request, and added to new quot;Non- accidental 754 supportquot; section of PEP 42. -- Comment By: Guido van Rossum (gvanrossum) Date: 2001-09-05 20:21 Message: Logged In: YES user_id=6380 Is there a point in keeping this bug report open indefinitely? A quot;won't fixquot; would make just as much sense. Maybe add Inf support to PEP 42. -- Comment By: Tim Peters (tim_one) Date: 2001-08-02 00:41 Message: Logged In: YES user_id=31435 Note that Python has no intentional support for Infs and NaNs anywhere; even that float('inf') doesn't blow up when you do it is a platform accident (it blows up (quot;invalid literalquot;) on my box). Given that, in the absence of a comprehensive plan for supporting this stuff across the board, and worker bees to implement it, I downgraded the priority. A good plan would refactor the code so that dealing with the platform double and float formats occurs in only one place. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=445484group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Feature Requests-449227 ] rlcompleter add quot; (quot; to callables feature
Feature Requests item #449227, was opened at 2001-08-08 20:04 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=449227group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Roman Suzi (rnd0110) Assigned to: Nobody/Anonymous (nobody) Summary: rlcompleter add quot;(quot; to callables feature Initial Comment: I use rlcompleter extensively in interactive Python mode. I think it could be cool if callable objects were added quot;(quot; when completed. This way it will be much faster to program, without looking-up __doc__. For example: gt;gt;gt; f.fillt;TABgt; will give: gt;gt;gt; f.fileno(_ (quot;_quot; is to mark cursor position) and: gt;gt;gt; f.solt;TABgt; will (as before) give: gt;gt;gt; f.softspace _ -- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-07-17 15:15 Message: Logged In: YES user_id=1188172 Any comments on this one? Sounds reasonable to me. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=449227group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1239186 ] Install Error: cannot compute sizeof (int), 77
Bugs item #1239186, was opened at 2005-07-15 18:00 Message generated for change (Comment added) made by rgazzale You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1239186group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Installation Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Bob Gazzale (rgazzale) Assigned to: Nobody/Anonymous (nobody) Summary: Install Error: cannot compute sizeof (int), 77 Initial Comment: Computer: Mac OS: Tiger 10.4.2 When attempting to install Python 2.4, I get the following error message in the configure stage: checking size of int... configure: error: cannot compute sizeof (int), 77 config.log is attached. Many thanks, Bob -- Comment By: Bob Gazzale (rgazzale) Date: 2005-07-17 09:48 Message: Logged In: YES user_id=1313508 I am using the gcc I downloaded from Gaurav Khanna's HPC site. Thanks for the lead. I'll try going back to a non-experimental version of gcc. Bob -- Comment By: Brett Cannon (bcannon) Date: 2005-07-15 18:23 Message: Logged In: YES user_id=357491 Are you using the standard version of gcc that comes with Tiger? I noticed in the log it says ``gcc (GCC) 4.1.0 20050517 (experimental)`` and I thought Tiger had gcc 4.0 (I can't check right now since I am at work), let alone came with a non-experimental version. Regardless, I don't see how it could be the configure files fault since Python does not have any control over the C compiler being able to determine the size of int. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1239186group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Feature Requests-567972 ] Missing 4 socket object properties
Feature Requests item #567972, was opened at 2002-06-12 13:56 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=567972group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Submitted By: Graham Horler (grahamh) Assigned to: Martin v. Löwis (loewis) Summary: Missing 4 socket object properties Initial Comment: The C socketmodule has a struct PySocketSockObject, with family, type and proto members. These would be terribly helpful to have access to in Python, when implementing some generic socket helper functions. The quot;blockingquot; flag could also be made available, but would require some extra coding. (I'm using Python 2.1.3 under Linux 2.4.16, so I cannot extend the socket class itself ((as in py2.2)), and don't want to slow down sockets with a complete wrapper, as I use them heavily.) Thanks, Graham. -- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-07-17 15:49 Message: Logged In: YES user_id=1188172 Attaching a patch which implements the three members of _socket.socket. Please review. -- Comment By: Martin v. Löwis (loewis) Date: 2002-06-15 15:21 Message: Logged In: YES user_id=21627 Sounds good. Would you like to produce a patch implementing this feature? -- Comment By: Graham Horler (grahamh) Date: 2002-06-12 14:00 Message: Logged In: YES user_id=543663 Oh yes, the repr of a socket object includes the missing info, so to get hold of the family, I go: int(repr(sock).split(' ')[3].split('=')[1][:-1]) Similar for type and protocol, not nice! -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=567972group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Feature Requests-778763 ] Optional type enforcement
Feature Requests item #778763, was opened at 2003-07-28 08:18 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=778763group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: None Status: Closed Resolution: Postponed Priority: 5 Submitted By: Matt Perry (occupant4) Assigned to: Nobody/Anonymous (nobody) Summary: Optional type enforcement Initial Comment: One of the things that makes Python easy to code in is the fact that you don't have to explicitly declare the types of variables, or associate a specific type with a variable. However, this can potentially lead to somewhat confusing and hard-to-maintain code, not to mention make it easier to introduce bugs. An idea struck me that it might be possible to combine the power and safety of a strictly type-checked language with the speed and ease of coding of Python. Normal variables as they stand now would be unaffected by this feature, and retain their polymorphic type capabilities. Allow the programmer to optionally declare the type of a variable somehow, be it with the C-like syntax quot;int xquot;, or Pascal's (I think?) quot;x: intquot;, or a new syntactic representation. Python could then issue a TypeError if the program attempts to assign a non-int to x. Obviously this feature could apply to any data type, such as string, list, or perhaps user-defined classes. Class member variables can be declared as now in the class definition body, with the same syntax to specify a type, ie: class Test: int x = 5 string name = quot;testquot; untyped = None In addition, adding a type specifier to a function's parameters could serve another means of distinguishing it from other functions, which could allow function overloading, ie: def double(int x): return 2*x def double(string x): return x + ' ' + x Advantages: - clarifies the author's intention in writing code, and could help prevent confusion as to what type a variable/parameter is. - helps prevent bugs due to type mistakes - doesn't interfere with existing code or coding style, as dynamically typed variables are still allowed - could allow function overloading if it was wanted Disadvantages: - implementing a type checker could be difficult? - potentially pollutes namespace with extra keywords like 'string' or 'list'. may need to choose different keywords. -- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-07-17 16:12 Message: Logged In: YES user_id=1188172 This isn't going to be in Python 2.x, but presumably in Python 3k, so I'm closing it for now. (A change in 2.x would at least require a PEP) -- Comment By: Armin Rigo (arigo) Date: 2004-05-21 18:25 Message: Logged In: YES user_id=4771 This idea has always been considered but there are very deep issues with it. You should give a look to Pyrex, whose language a more static and type-checked version of Python. It produces C extension modules for the regular Python interpreter, so it can be mixed with regular Python code easily. google:python+pyrex -- Comment By: Raymond Hettinger (rhettinger) Date: 2003-08-05 13:52 Message: Logged In: YES user_id=80475 To make the most of polymorphism, interface checking would be preferable to enforcing specific types. For example, it is better to check that f is a filelike type rather than requiring that is actually be a file -- that way, StringIO objects can be substituted without breaking code. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=355470aid=778763group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1223238 ] race in os.makedirs()
Bugs item #1223238, was opened at 2005-06-18 18:37 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1223238group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Submitted By: Mattias Engdegård (yorick) Assigned to: Nobody/Anonymous (nobody) Summary: race in os.makedirs() Initial Comment: os.makedirs() can fail if one of its components is created while it is running (perhaps by another process). This is because it checks for each directory if it exists before creating it. This is bad programming style. A correct implementation would just call mkdir() on each directory (starting with the rightmost, probably) and ignoring any EEXIST error. This would not only fix the bug, it would also be faster (fewer syscalls). The patch is simple, but there is a wart in the design: os.makedirs() throws an error if the (rightmost) directory already exists, although by calling this function the user has clearly indicated that she wants the directories to be created if they don't exist and have no complaints otherwise. This leads to code like: try: os.makedirs(path) except OSError: pass which is doubly bad because it hides the race condition! So, before I submit a patch, should we: a) just fix this bug but keep the old design b) fix this bug, and don't throw an error if the dir exists or maybe do a) for the next 2.4.x bugfix release and b) in 2.5? -- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-07-17 21:56 Message: Logged In: YES user_id=1188172 See patch #1239890. -- Comment By: Mattias Engdegård (yorick) Date: 2005-06-25 23:11 Message: Logged In: YES user_id=432579 I'm fine with fixing the design for 2.5 and ignoring the bug for 2.4, since programs susceptible to the bug must use some kind of work-around in 2.4.x (x 2) anyway. What I am using right now is: def makedirs(name, mode=0777): try: os.mkdir(name, mode) return except OSError, err: if err.errno == errno.EEXIST: return if err.errno != errno.ENOENT: raise makedirs(os.path.dirname(name), mode) makedirs(name, mode) This is compact and elegant, but relies on mkdir producing the correct errno values, which should be true for all platforms I'm aware of. It could also theoretically loop infinitely in bizarre cases but I don't see how that ever could happen. -- Comment By: Neil Schemenauer (nascheme) Date: 2005-06-18 19:43 Message: Logged In: YES user_id=35752 I vote to fix the design for 2.5. Backporting the minimal fix to 2.4 would be optional, IMO. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1223238group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1061920 ] k specifier in PyArg_ParseTuple incomplete documentated
Bugs item #1061920, was opened at 2004-11-07 15:28 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1061920group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Documentation Group: Python 2.3 Status: Closed Resolution: Fixed Priority: 5 Submitted By: Gustavo J. A. M. Carneiro (gustavo) Assigned to: Reinhold Birkenfeld (birkenfeld) Summary: k specifier in PyArg_ParseTuple incomplete documentated Initial Comment: Documentation for python 2.3 says: k (integer) [unsigned long] Convert a Python integer to a C unsigned long without overflow checking. New in version 2.3. However I was told -- and tested to be true -- that k also accepts python long as argument. This should be mentioned in the documentation, otherwise programmers will assume k only accepts values in the range 0-2^31, thus not allowing the full 'unsigned long' range. -- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-07-17 22:05 Message: Logged In: YES user_id=1188172 Fixed as Doc/api/utilities.tex r1.22, r1.20.2.2. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1061920group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1014761 ] Missing urllib.urlretrieve docs
Bugs item #1014761, was opened at 2004-08-24 00:05 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1014761group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Documentation Group: None Status: Closed Resolution: Invalid Priority: 5 Submitted By: David Abrahams (david_abrahams) Assigned to: Nobody/Anonymous (nobody) Summary: Missing urllib.urlretrieve docs Initial Comment: urllib.urlretrieve docs give no description for the reporthook argument -- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-07-17 22:31 Message: Logged In: YES user_id=1188172 Actually, they do, in the second paragraph of the urlretrieve docs. Closing as Invalid. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1014761group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1099363 ] refman doesn't know about universal newlines
Bugs item #1099363, was opened at 2005-01-10 11:33 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1099363group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Documentation Group: None Status: Closed Resolution: Out of Date Priority: 5 Submitted By: Jack Jansen (jackjansen) Assigned to: Nobody/Anonymous (nobody) Summary: refman doesn't know about universal newlines Initial Comment: The reference manual (in ref/ref2.tex) still talks about the various different end-of-line conventions, but as Python reads source code with universal newlines this is no longer relevant. -- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-07-17 22:35 Message: Logged In: YES user_id=1188172 This is already fixed since revision 1.57 of ref2.tex. Thanks for the report, though. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1099363group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-912943 ] 7.5.6 Thread Objects is too vague
Bugs item #912943, was opened at 2004-03-09 20:16 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=912943group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Documentation Group: None Status: Closed Resolution: Fixed Priority: 5 Submitted By: Roy Smith (roysmith) Assigned to: Nobody/Anonymous (nobody) Summary: 7.5.6 Thread Objects is too vague Initial Comment: Some items which could be improved Once the thread's activity is started, the thread is considered 'alive' and 'active' (these concepts are almost, but not quite exactly, the same; their definition is intentionally somewhat vague). This is a bit silly. Either these attributes are intended to be exposed to users or they're not. If they are, they should be well defined. If not, they shouldn't be mentioned at all. If the subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread. This is misleading. You need to call Thread.__init__ (self), i.e. pass along the self argument. At least I think you do :-) join([timeout]) ... When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). What happens if you pass None? Does it wait forever? Is this any different from not passing any argument at all? What happens if a timeout occurs? Is there any way to differentiate between a timeout and a normal return? A thread can be join()ed many times. Presumably only if all but the last call timed out? Or maybe not? If you get a normal return (i.e. not a timeout) from join(), and then call join() again, what happens? Does it just return immediately with no error? -- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-07-17 23:01 Message: Logged In: YES user_id=1188172 The second item is no bug. Methods in the docs are always written with a trailing (). I have addressed the join() issues in Doc/lib/libthreading.tex r1.22, r1.20.4.2. Closing as the remaining issue is covered by the patch mentioned by alanvgreen. -- Comment By: Alan Green (alanvgreen) Date: 2005-01-23 06:46 Message: Logged In: YES user_id=1174944 Submitted Patch 1107656 which addresses the 'alive' and 'active' issue. It does this by deprecating the isAlive() method and adding an isActive method instead. The patch also updates the documentation to talk about threads being 'active' rather than 'alive and active'. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=912943group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1223238 ] race in os.makedirs()
Bugs item #1223238, was opened at 2005-06-18 19:37 Message generated for change (Comment added) made by nirs You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1223238group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Submitted By: Mattias Engdegård (yorick) Assigned to: Nobody/Anonymous (nobody) Summary: race in os.makedirs() Initial Comment: os.makedirs() can fail if one of its components is created while it is running (perhaps by another process). This is because it checks for each directory if it exists before creating it. This is bad programming style. A correct implementation would just call mkdir() on each directory (starting with the rightmost, probably) and ignoring any EEXIST error. This would not only fix the bug, it would also be faster (fewer syscalls). The patch is simple, but there is a wart in the design: os.makedirs() throws an error if the (rightmost) directory already exists, although by calling this function the user has clearly indicated that she wants the directories to be created if they don't exist and have no complaints otherwise. This leads to code like: try: os.makedirs(path) except OSError: pass which is doubly bad because it hides the race condition! So, before I submit a patch, should we: a) just fix this bug but keep the old design b) fix this bug, and don't throw an error if the dir exists or maybe do a) for the next 2.4.x bugfix release and b) in 2.5? -- Comment By: Nir Soffer (nirs) Date: 2005-07-18 00:10 Message: Logged In: YES user_id=832344 current 2.4 code does not return an error if the directory exists, the patch must not change that behavior. It will not be a good idea to change that behavior in 2.5 or any version, it can break lot of code. -- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-07-17 22:56 Message: Logged In: YES user_id=1188172 See patch #1239890. -- Comment By: Mattias Engdegård (yorick) Date: 2005-06-26 00:11 Message: Logged In: YES user_id=432579 I'm fine with fixing the design for 2.5 and ignoring the bug for 2.4, since programs susceptible to the bug must use some kind of work-around in 2.4.x (x 2) anyway. What I am using right now is: def makedirs(name, mode=0777): try: os.mkdir(name, mode) return except OSError, err: if err.errno == errno.EEXIST: return if err.errno != errno.ENOENT: raise makedirs(os.path.dirname(name), mode) makedirs(name, mode) This is compact and elegant, but relies on mkdir producing the correct errno values, which should be true for all platforms I'm aware of. It could also theoretically loop infinitely in bizarre cases but I don't see how that ever could happen. -- Comment By: Neil Schemenauer (nascheme) Date: 2005-06-18 20:43 Message: Logged In: YES user_id=35752 I vote to fix the design for 2.5. Backporting the minimal fix to 2.4 would be optional, IMO. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1223238group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-872769 ] os.access() documentation should stress race conditions
Bugs item #872769, was opened at 2004-01-08 02:40 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=872769group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Documentation Group: None Status: Closed Resolution: Fixed Priority: 5 Submitted By: seth arnold (setharnold) Assigned to: Reinhold Birkenfeld (birkenfeld) Summary: os.access() documentation should stress race conditions Initial Comment: Every version of the documentation I've seen associated with the os.access() function neglects to mention that its use is almost always a security vulnerability. For the versions of python that are still maintained, I'd like to see the documentation for this function expanded to include a paragraph very similar to the warning given in my system's access(2) manpage: Using access to check if a user is authorized to e.g., open a file before actually doing so using open(2) creates a security hole, because the user might exploit the short time interval between checking and opening the file to manipulate it. (This paragraph comes from a Debian system; if it is more work to validate the license on this manpage for including this paragraph here, I'd be happy to write some new content under whatever license is required to get a warning included.) Of course, there are web-based documents derived from the module's built-in documentation. It'd be keen if whoever fixes this in the module could poke the website document maintainer and ask them to regenerate the content. Thanks! -- Comment By: Reinhold Birkenfeld (birkenfeld) Date: 2005-07-17 23:10 Message: Logged In: YES user_id=1188172 Thanks for the suggestion. Committed as Doc/lib/libos.tex r1.163, r1.146.2.9. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=872769group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1217591 ] make frameworkinstall fails for non-default location
Bugs item #1217591, was opened at 2005-06-09 16:54 Message generated for change (Comment added) made by jackjansen You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1217591group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Macintosh Group: None Status: Closed Resolution: Wont Fix Priority: 5 Submitted By: Mitch Chapman (mitchchapman) Assigned to: Jack Jansen (jackjansen) Summary: make frameworkinstall fails for non-default location Initial Comment: Mac OS X 10.3.8, Python 2.4.1. Attempts to 'make frameworkinstall' to a non-default prefix and framework location fail: $ ./configure --prefix=someplace --enable-framework=someplace/Frameworks $ make $ make frameworkinstall The last step always attempts to create /usr/local/bin/python, instead of someplace/bin/python. The immediate cause appears to be line 20 of Mac/OSX/Makefile: bindir=/usr/local/bin The problem is easier to spot if the 'make frameworkinstall' step is performed without root permissions: $ ./configure --prefix=${HOME}/tmp/py241 --enable- framework=${HOME}/tmp/py241/Frameworks ... $ make ... $ make frameworkinstall ... make -f ./Mac/OSX/Makefile installunixtools DIRMODE=755 FILEMODE=644 srcdir=. builddir=. DESTDIR= prefix=/Users/myself/tmp/py241/ Frameworks/Python.framework/Versions/2.4 /usr/bin/install -c -d /usr/local/bin install: chmod 755 /usr/local/bin: Operation not permitted ln -fsn /Users/myself/tmp/py241/Frameworks/Python.framework/ Versions/2.4/bin/python /usr/local/bin/python2.4 ln: /usr/local/bin/python2.4: Permission denied make[1]: *** [installunixtools] Error 1 make: *** [frameworkinstallunixtools] Error 2 -- Comment By: Jack Jansen (jackjansen) Date: 2005-07-17 23:57 Message: Logged In: YES user_id=45365 The bad news is that this is difficult to fix: the whole frameworkinstall sequence is a bit of a hack, and it works by overriding prefix to point into the bowels of the framework and then doing the equivalent of a make install. The good news is that if I understand correctly what you're trying to do, building to a staging area so you can package things for distribution later, there's another way to do this that does work: use the DESTROOT environment variable. If you do DESTROOT=/tmp/py241 configure -- enable-frameworks you'll get a tree ready for installation in /tmp/py241. But that assumes you can live with /tmp/py241/usr/local/bin. If your needs are different reopen the bug and explain your use case and I'll think harder about a solution:-) -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1217591group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1238681 ] freed pointer is used in longobject.c:long_pow()
Bugs item #1238681, was opened at 2005-07-15 01:06 Message generated for change (Comment added) made by tim_one You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1238681group_id=5470 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: Python 2.4 Status: Closed Resolution: Fixed Priority: 7 Submitted By: Luke (luked) Assigned to: Tim Peters (tim_one) Summary: freed pointer is used in longobject.c:long_pow() Initial Comment: See in the following code snippet (from the end of the long_pow function in longobject.c) that b is used after it has been freed: Done: Py_XDECREF(a); Py_XDECREF(b); Py_XDECREF(c); Py_XDECREF(temp); if (b-ob_size FIVEARY_CUTOFF) { for (i = 0; i 32; ++i) Py_XDECREF(table[i]); } return (PyObject *)z; } The error exists in 2.4.1 and on CVS trunk. -- Comment By: Tim Peters (tim_one) Date: 2005-07-17 19:47 Message: Logged In: YES user_id=31435 Eww -- gross. Thanks for the report! Repaired (along with a another long_pow() coding error) in: Misc/NEWS 1.1319 Objects/longobject.c 1.169 -- Comment By: Raymond Hettinger (rhettinger) Date: 2005-07-15 01:26 Message: Logged In: YES user_id=80475 Tim, I believe this one belongs to you (checkin 1.163 on 8/30/2004). -- You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=105470aid=1238681group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com