Re: Fitting polynomial curve
On 3/17/2011 1:42 AM, Astan Chee wrote: Hi, I have 2 points in 3D space and a bunch of points in-between them. I'm trying to fit a polynomial curve on it. Currently I'm looking through numpy but I don't think the function exists to fit a function like this: y = ax**4 + bx**3 + cx**2 + dx + e (I'm not sure what thats called but one degree up from a cubic curve) quartic Also, I'm sure it'll take alot of time to brute force it like this but I'm sure I'm missing something for this. Look at scipy. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Memory Usage of Strings
Thanks Dan for the detailed reply. I suspect it is related to FreeBSD malloc/free as you suggested. Here is the output of running your script: [16-bsd01 ~/work]$ python strm.py --first USERPID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND amdev 6899 3.0 6.9 111944 107560 p0 S+9:57PM 0:01.20 python strm.py --first (python2.5) amdev 6900 0.0 0.1 3508 1424 p0 S+9:57PM 0:00.02 sh -c ps aux | egrep '\\6899\\|^USER\\' amdev 6902 0.0 0.1 3380 1188 p0 S+9:57PM 0:00.01 egrep \\6899\\|^USER\\ [16-bsd01 ~/work]$ python strm.py --second USERPID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND amdev 6903 0.0 10.5 166216 163992 p0 S+9:57PM 0:00.92 python strm.py --second (python2.5) amdev 6904 0.0 0.1 3508 1424 p0 S+9:57PM 0:00.02 sh -c ps aux | egrep '\\6903\\|^USER\\' amdev 6906 0.0 0.1 3508 1424 p0 R+9:57PM 0:00.00 egrep \\6903\\|^USER\\ (sh) Regards, Amit On Thu, Mar 17, 2011 at 3:21 AM, Dan Stromberg drsali...@gmail.com wrote: On Wed, Mar 16, 2011 at 8:38 AM, Amit Dev amit...@gmail.com wrote: I'm observing a strange memory usage pattern with strings. Consider the following session. Idea is to create a list which holds some strings so that cumulative characters in the list is 100MB. l = [] for i in xrange(10): ... l.append(str(i) * (1000/len(str(i This uses around 100MB of memory as expected and 'del l' will clear that. for i in xrange(2): ... l.append(str(i) * (5000/len(str(i This is using 165MB of memory. I really don't understand where the additional memory usage is coming from. If I reduce the string size, it remains high till it reaches around 1000. In that case it is back to 100MB usage. Python 2.6.4 on FreeBSD. Regards, Amit -- http://mail.python.org/mailman/listinfo/python-list On Python 2.6.6 on Ubuntu 10.10: $ cat pmu #!/usr/bin/python import os import sys list_ = [] if sys.argv[1] == '--first': for i in xrange(10): list_.append(str(i) * (1000/len(str(i elif sys.argv[1] == '--second': for i in xrange(2): list_.append(str(i) * (5000/len(str(i else: sys.stderr.write('%s: Illegal sys.argv[1]\n' % sys.argv[0]) sys.exit(1) os.system(ps aux | egrep '\%d\|^USER\' % os.getpid()) dstromberg-laptop-dstromberg:~/src/python-mem-use i686-pc-linux-gnu 10916 - above cmd done 2011 Wed Mar 16 02:38 PM $ make ./pmu --first USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND 1000 11063 0.0 3.4 110212 104436 pts/5 S+ 14:38 0:00 /usr/bin/python ./pmu --first 1000 11064 0.0 0.0 1896 512 pts/5 S+ 14:38 0:00 sh -c ps aux | egrep '\11063\|^USER\' 1000 11066 0.0 0.0 4012 740 pts/5 S+ 14:38 0:00 egrep \11063\|^USER\ ./pmu --second USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND 1000 11067 13.0 3.3 107540 101536 pts/5 S+ 14:38 0:00 /usr/bin/python ./pmu --second 1000 11068 0.0 0.0 1896 508 pts/5 S+ 14:38 0:00 sh -c ps aux | egrep '\11067\|^USER\' 1000 11070 0.0 0.0 4012 740 pts/5 S+ 14:38 0:00 egrep \11067\|^USER\ dstromberg-laptop-dstromberg:~/src/python-mem-use i686-pc-linux-gnu 10916 - above cmd done 2011 Wed Mar 16 02:38 PM So on Python 2.6.6 + Ubuntu 10.10, the second is actually a little smaller than the first. Some issues you might ponder: 1) Does FreeBSD's malloc/free know how to free unused memory pages in the middle of the heap (using mmap games), or does it only sbrk() down when the end of the heap becomes unused, or does it never sbrk() back down at all? I've heard various *ix's fall into one of these 3 groups in releasing unused pages. 2) It mijght be just an issue of how frequently the interpreter garbage collects; you could try adjusting this; check out the gc module. Note that it's often faster not to collect at every conceivable opportunity, but this tends to add up the bytes pretty quickly in some scripts - for a while, until the next collection. So your memory use pattern will often end up looking like a bit of a sawtooth function. 3) If you need strict memory use guarantees, you might be better off with a language that's closer to the metal, like C - something that isn't garbage collected is one parameter to consider. If you already have something in CPython, then Cython might help; Cython allows you to use C datastructures from a dialect of Python. -- http://mail.python.org/mailman/listinfo/python-list
Re: creating RAW sockets
On Wed, Mar 16, 2011 at 10:36 PM, moijes12 moije...@gmail.com wrote: Hi I am unable to create RAW sockets using python. Traceback (most recent call last): File getsockopt_handler.py, line 6, in ? send = socket(AF_INET,SOCK_RAW,IPPROTO_IP) socket.error: (94, 'Socket type not supported') I've tried changing the type from IPPROTO_IP to IPPROTO_RAW but the I get the below error Traceback (most recent call last): File getsockopt_handler.py, line 7, in ? send.bind((gethostbyname(gethostname()),5)) socket.error: (99, 'Cannot assign requested address') I am running this on python 2.2 .Do I need to change any system settings or do I need to use a newer python version. What operating system are you using? Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list
Re: creating RAW sockets
On Wed, 16 Mar 2011 22:36:07 -0700, moijes12 wrote: Traceback (most recent call last): File getsockopt_handler.py, line 7, in ? send.bind((gethostbyname(gethostname()),5)) socket.error: (99, 'Cannot assign requested address') Specifying a port number isn't meaningful for a raw socket. At the kernel level, the sin_port field in a sockaddr_in structure is used for the IP protocol (e.g. 6 for TCP), if it's used at all. -- http://mail.python.org/mailman/listinfo/python-list
Re: creating RAW sockets
On Mar 17, 11:14 am, Nobody nob...@nowhere.com wrote: On Wed, 16 Mar 2011 22:36:07 -0700, moijes12 wrote: Traceback (most recent call last): File getsockopt_handler.py, line 7, in ? send.bind((gethostbyname(gethostname()),5)) socket.error: (99, 'Cannot assign requested address') Specifying a port number isn't meaningful for a raw socket. At the kernel level, the sin_port field in a sockaddr_in structure is used for the IP protocol (e.g. 6 for TCP), if it's used at all. @ Chris : I am using windows xp sp2. @ Nobody : My main aim here is decode the IP header. I tried the below code and it seems to work.I have shifted to python 2.5 (though I think it was more of a code problem).My main problem is to decode the IP header s = socket(AF_INET,SOCK_RAW,IPPROTO_IP) r = socket(AF_INET,SOCK_RAW,IPPROTO_IP) r.bind(('',0)) s.connect(('localhost',0)) for i in range(10) : s.send(str(i)) data = r.recvfrom(256) hdr = r.getsockopt(SOL_IP, IP_OPTIONS, 20) print binascii.hexlify(hdr) r.close() s.close() Here it prints nothing.I'll try some more stuff and will post my findings in about 30 minutes. thanks moijes -- http://mail.python.org/mailman/listinfo/python-list
Re: creating RAW sockets
On Mar 17, 11:28 am, moijes12 moije...@gmail.com wrote: On Mar 17, 11:14 am, Nobody nob...@nowhere.com wrote: On Wed, 16 Mar 2011 22:36:07 -0700, moijes12 wrote: Traceback (most recent call last): File getsockopt_handler.py, line 7, in ? send.bind((gethostbyname(gethostname()),5)) socket.error: (99, 'Cannot assign requested address') Specifying a port number isn't meaningful for a raw socket. At the kernel level, the sin_port field in a sockaddr_in structure is used for the IP protocol (e.g. 6 for TCP), if it's used at all. @ Chris : I am using windows xp sp2. @ Nobody : My main aim here is decode the IP header. I tried the below code and it seems to work.I have shifted to python 2.5 (though I think it was more of a code problem).My main problem is to decode the IP header s = socket(AF_INET,SOCK_RAW,IPPROTO_IP) r = socket(AF_INET,SOCK_RAW,IPPROTO_IP) r.bind(('',0)) s.connect(('localhost',0)) for i in range(10) : s.send(str(i)) data = r.recvfrom(256) hdr = r.getsockopt(SOL_IP, IP_OPTIONS, 20) print binascii.hexlify(hdr) r.close() s.close() Here it prints nothing.I'll try some more stuff and will post my findings in about 30 minutes. thanks moijes Hi I tried the below code on python 3.0.1.This was an available example in the manual and it was successfull in printing all packets import socket # the public network interface HOST = socket.gethostbyname(socket.gethostname()) # create a raw socket and bind it to the public interface s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_IP) s.bind((HOST, 0)) # Include IP headers s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1) # receive all packages s.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON) # receive a package while 1 : print(s.recvfrom(65565)) Now,please can someone guide(as in what should I read and NOT as in give me the code) me in decoding the IP header of packets using python 3.0.1. thanks moijes -- http://mail.python.org/mailman/listinfo/python-list
how to use variable to substitute class's variable?
I have things like: file1: class aaa: def __init__(self): self.variable1='a1' self.variable2='a2' self.varable3='a3' in main proc: import file1 b=file1.aaa() c={'variable1':'value1','variable2':'value2','variable3':'value3'} for key in c: b.key=c[key] Problem is here!!! I hope put value1 to b.variable1, value2 to b.variable2 and value3 to b.variable3. it does not work. How can I do it? By the way, I know dictionary can bind two variable together, like a 2- dimension array. but, if I need group 3 or more variables together, (each group has 3 or more variables)like a 3-dimension(or higher) array, Is there an easy way besides class? Thanks a lot!!! -- http://mail.python.org/mailman/listinfo/python-list
Re: how to use variable to substitute class's variable?
On Thu, Mar 17, 2011 at 3:31 AM, Hans hans...@gmail.com wrote: I have things like: file1: class aaa: def __init__(self): self.variable1='a1' self.variable2='a2' self.varable3='a3' in main proc: import file1 b=file1.aaa() c={'variable1':'value1','variable2':'value2','variable3':'value3'} for key in c: b.key=c[key] Problem is here!!! I hope put value1 to b.variable1, value2 to b.variable2 and value3 to b.variable3. it does not work. How can I do it? b.key gets the key attribute of b, not the attribute that has the same name as the variable called key. Otherwise, you'd have to reference it as b.key normally. If you want to dynamically set the variable, you'll have to use the setattr function setattr(b, key, c[key]) By the way, I know dictionary can bind two variable together, like a 2- dimension array. but, if I need group 3 or more variables together, (each group has 3 or more variables)like a 3-dimension(or higher) array, Is there an easy way besides class? A dictionary does not bind two variables together. A dictionary is a hash map- it maps keys to values. Each key will map to exactly one value. If you want to store a list of associated values, use a tuple. A tuple is an immutable collection of objects (the tuple itself is immutable, not necessarily the objects in it). It can be indexed just like a list. l = [(0,0), (0,1,2,3,4,5,6,7), (0,1,'foo', 5 ,6)] l[0] (0, 0) l[2] (0, 1, 'foo', 5, 6) l[2][1] -- http://mail.python.org/mailman/listinfo/python-list
newbie question (latex Error in plotting)
Hi, After computation of few array, when I am using plot(x,y) command I get following error 'latex' is not recognized as an internal or external command, operable program or batch file. ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (532, 0)) ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (19, 0)) I can view the output as and it is fine. I tried the same in Ipython and spyder, same error message. Any advice. Cheers Sachin Sachin Kumar Sharma Senior Geomodeler -- http://mail.python.org/mailman/listinfo/python-list
Re: os.path.walk() to get full path of all files
file_list = [] for root, _, filenames in os.walk(root_path): for filename in filenames: file_list.append(os.path.join(root, filename)) What does the notation _ stands for ? Is it a sort of /dev/null ? I know that in the terminal it represents the last printed text. Laurent -- http://mail.python.org/mailman/listinfo/python-list
Re: os.path.walk() to get full path of all files
On 17/03/2011 08:58, Laurent Claessens wrote: file_list = [] for root, _, filenames in os.walk(root_path): for filename in filenames: file_list.append(os.path.join(root, filename)) What does the notation _ stands for ? Is it a sort of /dev/null ? I know that in the terminal it represents the last printed text. It's a convention for saying I don't really care about this particular value which is returned from that function. You could, at your whim, use dontcare or x or whatever. TJG -- http://mail.python.org/mailman/listinfo/python-list
Re: os.path.walk() to get full path of all files
Laurent Claessens writes: file_list = [] for root, _, filenames in os.walk(root_path): for filename in filenames: file_list.append(os.path.join(root, filename)) What does the notation _ stands for ? Is it a sort of /dev/null ? x, _, y = 1, hukairs, 3 x, y (1, 3) _ 'hukairs' -- http://mail.python.org/mailman/listinfo/python-list
Re: organizing many python scripts, in a large corporate environment.
On Wednesday, March 16, 2011 9:03:19 PM UTC-4, bukzor wrote: I finally understand. You mean something along the lines of `kde- config`: an executable to help figure out the configuration at runtime. This requires either installation or control of the $PATH environment variable to work well, which makes not so useful to me. There's always the virtualenv option in a POSIX system. Just change the shebang to point to your package's virtual Python installation. That obviously won't work for Windows, which uses system-wide file-type associations. I think the closest to shebang-style control on Windows would require changing the file extension to something like 'py_' and having an admin add the appropriate ftype/assoc to the system, the same as is done for the pyw extension. That would be obscene. If the problem with installation is merely continuing to have central access to the scripts for development, you could deploy with setuptools in development mode: http://packages.python.org/distribute/setuptools.html#development-mode http://packages.python.org/distribute/setuptools.html#develop However, I think over time you may come to regret this as other group's projects become dependent on your code's behavior (including bugs) and a rigid interface. -- http://mail.python.org/mailman/listinfo/python-list
PDF To Postscript
PyPDF (and others) provide a very nice mechanism for creating and manipulating PDF documents. Is there any *Python* module or technique to turn a PDF document into Postscript [to print, for example]? -- http://mail.python.org/mailman/listinfo/python-list
Coding and Decoding in Python
I have a dll that to communicate with I need to send numeric codes. So I created a dictionary. It works in one direction in that I can address the key and get the value. But when the program returns the value I can't get the key. This code is very simple and I could use a list and the index except for the last value. Is there a better way to handle coding and decoding values to strings? QCam_Info = { 'qinfCameraType' : 0,# Camera model (see QCam_qcCameraType) 'qinfSerialNumber': 1,# Deprecated 'qinfHardwareVersion' : 2,# Hardware version 'qinfFirmwareVersion' : 3,# Firmware version 'qinfCcd' : 4,# CCD model (see QCam_qcCcd) 'qinfBitDepth' : 5,# Maximum bit depth 'qinfCooled' : 6,# Returns 1 if cooler is available, 0 if not 'qinfReserved1' : 7,# Reserved 'qinfImageWidth ' : 8,# Width of the ROI (in pixels) 'qinfImageHeight' : 9,# Height of the ROI (in pixels) 'qinfImageSize' : 10, # Size of returned image (in bytes) 'qinfCcdType' : 11, # CDD type (see QCam_qcCcdType) 'qinfCcdWidth' : 12, # CCD maximum width 'qinfCcdHeight' : 13, # CCD maximum height 'qinfFirmwareBuild': 14, # Build number of the firmware 'qinfUniqueId': 15, # Same as uniqueId in QCam_CamListItem 'qinfIsModelB' : 16, # Cameras manufactured after March 1, 2004 return 1, otherwise 0 'qinfIntensifierModel' : 17, # Intensifier tube model (see QCam_qcIntensifierModel) 'qinfExposureRes' : 18, # Exposure time resolution (nanoseconds) 'qinfTriggerDelayRes' : 19, # Trigger delay Resolution (nanoseconds) 'qinfStreamVersion' : 20, # Streaming version 'qinfNormGainSigFigs' : 21, # Normalized Gain Significant Figures resolution 'qinfNormGaindBRes': 22, # Normalized Gain dB resolution (in micro units) 'qinfNormITGainSigFigs': 23, # Normalized Intensifier Gain Significant Figures 'qinfNormITGaindBRes' : 24, # Normalized Intensifier Gain dB resolution (micro units) 'qinfRegulatedCooling' : 25, # 1 if camera has regulated cooling 'qinfRegulatedCoolingLock': 26, # 1 if camera is at regulated temperature, 0 otherwise 'qinfFanControl' : 29, # 1 if camera can control fan speed 'qinfHighSensitivityMode' : 30, # 1 if camera has high sensitivity mode available 'qinfBlackoutMode': 31, # 1 if camera has blackout mode available 'qinfPostProcessImageSize': 32, # Returns the size (in bytes) of the post-processed image 'qinfAsymmetricalBinning' : 33, # 1 if camera has asymmetrical binning (ex: 2x4) 'qinfEMGain' : 34, # 1 if EM gain is supported, 0 if not 'qinfOpenDelay' : 35, # 1 if shutter open delay controls are available, 0 if not 'qinfCloseDelay' : 36, # 1 if shutter close delay controls are available, 0 if not 'qinfColorWheelSupported' : 37, # 1 if color wheel is supported, 0 if not 'qinfReserved2' : 38, 'qinfReserved3' : 39, 'qinfReserved4' : 40, 'qinfReserved5' : 41, 'qinfEasyEmModeSupported' : 42, # 1 if camera supports Easy EM mode 'qinfLockedGainModeSupported' : 43, 'qinf_last' : 44, '_qinf_force32' : 0x } -- http://mail.python.org/mailman/listinfo/python-list
Re: Coding and Decoding in Python
Wanderer wrote: I have a dll that to communicate with I need to send numeric codes. So I created a dictionary. It works in one direction in that I can address the key and get the value. But when the program returns the value I can't get the key. This code is very simple and I could use a list and the index except for the last value. Is there a better way to handle coding and decoding values to strings? QCam_Info = { 'qinfCameraType' : 0,# Camera model (see QCam_qcCameraType) 'qinfSerialNumber': 1,# Deprecated 'qinfHardwareVersion' : 2,# Hardware version 'qinfFirmwareVersion' : 3,# Firmware version 'qinfCcd' : 4,# CCD model (see QCam_qcCcd) [ ... ] '_qinf_force32' : 0x } I handled this problem in a kind of cheap, nasty way with (untested) for k, v in QCam_Info.items(): QCam_Info[v] = k Then the dictionary lookups work both ways. Mel. -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP for module naming conventions
Tim Johnson wrote: I need to be better informed on naming conventions for modules. For instance, I need to create a new module and I want to make sure that the module name will not conflict with any future or current python system module names. COBOL in its golden years had a practice that reserved words were almost never hyphenated -- the few that were could be counted on the fingers of perhaps four hands and were mostly required paragraph names that were always used and hard to forget. It might turn out well to specify that system module names will never contain more than, say, one underscore. That way, nice descriptive application module names like 'analyzer_tool_utils' and such would always be safe to use. Mel. -- http://mail.python.org/mailman/listinfo/python-list
Re: enhanced map function
Steven, Thanks for the info of itertools. It is a great start for me. Overall, I agree with you that it is really the user data needs to be sorted out. However, novice users may need help on certain patterns such as a=[1,[2,3],4], b=[5,[6,7,8],9,10]. We could just draw our line saying that similarly nested inputs could be adjusted even though the members aren't exactly on one-to-one mapping and we won't getting any deeper for complicated cases such as a = [1, 2, [3, 4]]; b = [1, [2, [3,4]], [4,5], 6]. enhanced_map([1, [2,3, [4,5], 6], 7], [8, [7,6, [5,4], 3], 2]) should be the same as map([1, 2, 3, 4, 5, 6, 7], [8, 7, 6, 5, 4, 3, 2]) I don't expect the drop. The original nested structure is very important. What do you expect to happen if the sub-sequences don't match up exactly? E.g. a = [1, 2, [3, 4]]; b = [1, [2, 3], 4] What do you expect to happen if the shorter list is empty? E.g. a = [1, 2, [3, 4], 5]; b = [1, 2, [], 3] There are modes called shortest and longest (and AllCombination/Cross which is more complex). For case a = [1, 2, [3, 4],4]; b = [1, [2, 3], 4,5] shortest: a will be adjusted to [1, [3, 4],4] b will be adjusted to [1, [2, 3],4] longest: a will be adjusted to [1, 2,[3, 4],4,4] b will be adjusted to [1, 1,[2, 3],4,5] As I said previously, the enhance_map function will only handle limited unmatch cases and the line will need to be drawn carefully. Thanks -Patrick. -- http://mail.python.org/mailman/listinfo/python-list
Re: Coding and Decoding in Python
In 2f4a08df-55ea-4a4e-9cc0-24e6b9f81...@f15g2000pro.googlegroups.com Wanderer wande...@dialup4less.com writes: But when the program returns the value I can't get the key. What happens when two keys have the same value? How would you know which key to return? In your sample code all the values are different, but surely that won't always be the case with real data. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, The Gashlycrumb Tinies -- http://mail.python.org/mailman/listinfo/python-list
Re: PDF To Postscript
On Thu, Mar 17, 2011 at 6:55 AM, Adam Tauno Williams awill...@whitemice.org wrote: PyPDF (and others) provide a very nice mechanism for creating and manipulating PDF documents. Is there any *Python* module or technique to turn a PDF document into Postscript [to print, for example]? Considering your post is currently the top Google hit for pdf to postscript python , this seems unlikely. :-( From what I can gather, it seems using the pdftops program from xpdf or poppler (or the lesser, distinct pdf2ps program) is the way people go about handling this. Ghostscript is also apparently a possibility. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Coding and Decoding in Python
On Mar 17, 11:44 am, John Gordon gor...@panix.com wrote: In 2f4a08df-55ea-4a4e-9cc0-24e6b9f81...@f15g2000pro.googlegroups.com Wanderer wande...@dialup4less.com writes: But when the program returns the value I can't get the key. What happens when two keys have the same value? How would you know which key to return? In your sample code all the values are different, but surely that won't always be the case with real data. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, The Gashlycrumb Tinies I guess two keys having the same value is why dictionaries don't return keys for values, but this is a code. Each value has a unique meaning to both sender and receiver. The text part is for making the program understandable and printing understandable error messages. -- http://mail.python.org/mailman/listinfo/python-list
Re: Coding and Decoding in Python
In 7546e476-d10f-46e5-8b20-5d9b42345...@r6g2000vbo.googlegroups.com Wanderer wande...@dialup4less.com writes: I guess two keys having the same value is why dictionaries don't return keys for values, but this is a code. Each value has a unique meaning to both sender and receiver. The text part is for making the program understandable and printing understandable error messages. I see. You're storing integer equivalents for the labels themselves, not the actual data associated with the labels. Then Mel's solution is a good one -- construct a second dict which has the keys and values swapped. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com B is for Basil, assaulted by bears -- Edward Gorey, The Gashlycrumb Tinies -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP for module naming conventions
On Friday, March 11, 2011 4:52:57 PM UTC-5, Tim Johnson wrote: I need to be better informed on naming conventions for modules. For instance, I need to create a new module and I want to make sure that the module name will not conflict with any future or current python system module names. Do you mean package names? Within a package you can use relative imports to avoid conflicts. You could put all of your packages in a metapackage namespace with a unique name -- a company/group name or personal/family name, an uncommon English word, or something from another language. -- http://mail.python.org/mailman/listinfo/python-list
value of pi and 22/7
I tried the following 22/7.0 3.1428571428571428 import math math.pi 3.1415926535897931 Why is the difference is so much ?is pi =22/7 or something ? -- winning regards kracekumar -- http://mail.python.org/mailman/listinfo/python-list
Re: value of pi and 22/7
On Donnerstag 17 März 2011, kracekumar ramaraju wrote: 22/7.0 3.1428571428571428 import math math.pi 3.1415926535897931 Why is the difference is so much ?is pi =22/7 or something ? https://secure.wikimedia.org/wikipedia/en/wiki/Pi -- Wolfgang -- http://mail.python.org/mailman/listinfo/python-list
Re: value of pi and 22/7
On Thu, Mar 17, 2011 at 10:46 AM, kracekumar ramaraju kracethekingma...@gmail.com wrote: I tried the following 22/7.0 3.1428571428571428 import math math.pi 3.1415926535897931 Why is the difference is so much ?is pi =22/7 or something ? Pi is not 22/7. That is just a commonly-used approximation. -- http://mail.python.org/mailman/listinfo/python-list
Re: value of pi and 22/7
On Thu, Mar 17, 2011 at 10:57 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Thu, Mar 17, 2011 at 10:46 AM, kracekumar ramaraju kracethekingma...@gmail.com wrote: I tried the following 22/7.0 3.1428571428571428 import math math.pi 3.1415926535897931 Why is the difference is so much ?is pi =22/7 or something ? Pi is not 22/7. That is just a commonly-used approximation. I should add that math.pi is also not pi, because pi cannot be exactly represented as a floating-point number. It is another approximation that has several more digits of precision than 22/7. -- http://mail.python.org/mailman/listinfo/python-list
Re: PDF To Postscript
On Thu, 2011-03-17 at 08:53 -0700, Chris Rebert wrote: On Thu, Mar 17, 2011 at 6:55 AM, Adam Tauno Williams awill...@whitemice.org wrote: PyPDF (and others) provide a very nice mechanism for creating and manipulating PDF documents. Is there any *Python* module or technique to turn a PDF document into Postscript [to print, for example]? Considering your post is currently the top Google hit for pdf to postscript python , this seems unlikely. :-( True. I've found the ghostscript module which integrates with the GS application via ctypes. It 'works' but currently there is an issue with redirected stdin/stdout [processing streams]. https://bitbucket.org/htgoebel/python-ghostscript From what I can gather, it seems using the pdftops program from xpdf or poppler (or the lesser, distinct pdf2ps program) is the way people go about handling this. Yep, which is a sad and fragile hack. -- http://mail.python.org/mailman/listinfo/python-list
Re: value of pi and 22/7
My favorite approximation is: 355/113 (visualize 113355 split into two 113 355 and then do the division). The first 6 decimal places are the same. 3.141592920353982 = 355/113 vs 3.1415926535897931 Kee Nethery -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP for module naming conventions
I have found this approach problematic if you have packages separately developed and maintained in different directory trees, resulting in more than one PYTHONPATH entry with the same root metapackage name. What happens is that only the first entry in the PYTHONPATH containing the metapackage name is looked in for package/module resolution. Do you have any suggestions for handling this kind of packaging? On Thu, Mar 17, 2011 at 12:17 PM, eryksun () eryk...@gmail.com wrote: On Friday, March 11, 2011 4:52:57 PM UTC-5, Tim Johnson wrote: I need to be better informed on naming conventions for modules. For instance, I need to create a new module and I want to make sure that the module name will not conflict with any future or current python system module names. Do you mean package names? Within a package you can use relative imports to avoid conflicts. You could put all of your packages in a metapackage namespace with a unique name -- a company/group name or personal/family name, an uncommon English word, or something from another language. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: value of pi and 22/7
(pulls out doctorate in Math.) Take a circle and measure its diameter, then circumference (coffee cans and string are helpful). Then pi = Circumference/diameter approximating that is hard. It turns out that even though it *looks* like a nice fraction, the value that results is not (fractions of integers have the charming property that they always repeat, for instance 22/7 = 3.142857 142857 142857 142857 142857... Pi does not. Again this was a very hard question only answered in the 18th century by Lambert, I do believe.) It is the simple fractional look about pi vs. how hard it is to compute that drives most of the confusion about pi. The digits of pi are in effectively random order (each digit occur roughly 10% of the time), and to compute the nth one you need all the digits before it. Once upon a time (and maybe still) sending back and forth long strings of the digits of pi was a great way to test communications, since each side could look up the result in a table and tell if there were systematic errors. There are fun math questions, for instance, is there a run of a million 1's someplace in the decimal expansion of pi? Maybe so, but we just don't know, since we've only computed the first trillion or so digits. Computing pi also requires a lot of logistical organization too and cranking out the first several hundred million digits is still often used to test systems. FWIW my favorite approximation is 355/113. I can always seem to remember that one the best... Jeff - Original Message - From: kracekumar ramaraju kracethekingma...@gmail.com To: python-list@python.org Sent: Thursday, March 17, 2011 11:46:25 AM Subject: value of pi and 22/7 I tried the following 22/7.0 3.1428571428571428 import math math.pi 3.1415926535897931 Why is the difference is so much ?is pi =22/7 or something ? -- winning regards kracekumar -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: value of pi and 22/7
On Thu, Mar 17, 2011 at 11:36 AM, Jeffrey Gaynor jgay...@ncsa.uiuc.edu wrote: There are fun math questions, for instance, is there a run of a million 1's someplace in the decimal expansion of pi? Maybe so, but we just don't know, since we've only computed the first trillion or so digits. Since pi is irrational I would be surprised if there isn't one eventually. Out of my own curiosity, do you know what the longest known string of repeating digits in pi is? -- http://mail.python.org/mailman/listinfo/python-list
Re: value of pi and 22/7
There are a few long strings, but have fun yourself with the pi digit searcher: http://www.angio.net/pi/bigpi.cgi Longest string I heard of was nine 6's in a row, so search for 6 and see what you get. - Original Message - From: Ian Kelly ian.g.ke...@gmail.com To: Jeffrey Gaynor jgay...@ncsa.uiuc.edu Cc: python-list@python.org Sent: Thursday, March 17, 2011 1:49:56 PM Subject: Re: value of pi and 22/7 On Thu, Mar 17, 2011 at 11:36 AM, Jeffrey Gaynor jgay...@ncsa.uiuc.edu wrote: There are fun math questions, for instance, is there a run of a million 1's someplace in the decimal expansion of pi? Maybe so, but we just don't know, since we've only computed the first trillion or so digits. Since pi is irrational I would be surprised if there isn't one eventually. Out of my own curiosity, do you know what the longest known string of repeating digits in pi is? -- http://mail.python.org/mailman/listinfo/python-list
Re: value of pi and 22/7
On 17/03/2011 18:49, Ian Kelly wrote: On Thu, Mar 17, 2011 at 11:36 AM, Jeffrey Gaynorjgay...@ncsa.uiuc.edu wrote: There are fun math questions, for instance, is there a run of a million 1's someplace in the decimal expansion of pi? Maybe so, but we just don't know, since we've only computed the first trillion or so digits. Since pi is irrational I would be surprised if there isn't one eventually. Out of my own curiosity, do you know what the longest known string of repeating digits in pi is? Note that Liouville's constant, the number sum_{j = 1}^\infty 10^{-j!} is easily seen to be irrational (and is also transcendental), but no string of a million 1's, or any digit other than 0 and 1, appears in its decimal expansion. The relevant concept is that of a normal number, which is one whose digits look random: http://en.wikipedia.org/wiki/Normal_number Pi has not been proved to be normal but it is suspected on purely statistical grounds that it is, since almost all real numbers are normal (in the sense that the set of non-normal real numbers has Lebesgue measure 0). -- http://mail.python.org/mailman/listinfo/python-list
Re: value of pi and 22/7
Jeffrey Gaynor wrote: It is the simple fractional look about pi vs. how hard it is to compute that drives most of the confusion about pi. The digits of pi are in effectively random order (each digit occur roughly 10% of the time), ... This is equivalent to stating that pi is normal, something which is widely suspected but has not yet been proven. There are fun math questions, for instance, is there a run of a million 1's someplace in the decimal expansion of pi? The answer is yes, if pi is normal. Every finite sequence of digits will appear with the expected frequency. In all bases. -- Erik Max Francis m...@alcyone.com http://www.alcyone.com/max/ San Jose, CA, USA 37 18 N 121 57 W AIM/Y!M/Skype erikmaxfrancis They love too much that die for love. -- (an English proverb) -- http://mail.python.org/mailman/listinfo/python-list
Re: value of pi and 22/7
My favorite approximation is: 355/113 (visualize 113355 split into two 113 355 and then do the division). The first 6 decimal places are the same. 3.141592920353982 = 355/113 vs 3.1415926535897931 Another, rather funny, approximation of the first 15 digits of pi is to take the length of the words in the following verse: s = How I want a drink alcoholic of course After the heavy lectures involving complex functions print [len(w) for w in s.split()] will produce: [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9] Laszlo -- http://mail.python.org/mailman/listinfo/python-list
Re: ttk styles
No responses? Nobody with knowledge of modifying styles etc? On Mar 14, 2:08 pm, Peter peter.milli...@gmail.com wrote: Hi I'm struggling to get a good understanding of styles as used in ttk. I have read the tutorial section on using styles but haven't been able to solve this problem. I am attempting to create a Checkbutton with the indicatoron=false option. Using ttk the documentation is clear that you have to create a custom style to achieve this behaviour. But the only example I have been able to find on the Internet searches is written in Tcl i.e. here is what I have found (quoted directly): Here’s how you set it up: To achieve the effect of -indicatoron false, create a new layout that doesn’t have an indicator: style layout Toolbar.TCheckbutton { Toolbutton.border -children { Toolbutton.padding -children { Toolbutton.label } } } Then use style map and style default to control the border appearance: style default Toolbar.TCheckbutton \ -relief flat style map Toolbar.TCheckbutton -relief { disabled flat selected sunken pressed sunken active raised Hopefully somebody else in this group has done this and can post their solution? Thanks Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: ttk styles
Peter, Sorry I can't be of much help, but I share the same interest as you. There may be some teaser info here although I can't claim to understand the technique. http://www.java2s.com/Open-Source/Python/3.1.2-Python/Demo/Demo/tkinter/ttk/notebook_closebtn.py.htm If you have any links/documentation to share, I would love to see what you've found so far. Malcolm -- http://mail.python.org/mailman/listinfo/python-list
Re: reimport module every n seconds
In article 753e9884-60eb-43cf-a647-12b29ed28...@y31g2000prd.googlegroups.com, Santiago Caracol santiago.cara...@gmail.com wrote: Don't do that. =A0;-) =A0I suggest using exec instead. =A0However, I wo= uld be surprised if import worked faster than, say, JSON (more precisely, I doubt that it's enough faster to warrnat this kludge). I'm with Aahz. =A0Don't do that. I don't know what you're doing, but I suspect an even better solution would be to have your program run a reconfigure thread which listens on a UDP socket and reads a JSON object from it. =A0Or, at the very least= , which listens for a signal which kicks it to re-read some JSON from a disk file. =A0This will be more responsive when the data changes quickly and more efficient when it changes slowly. =A0As opposed to just polling for changes every 10 seconds. Somehow I guessed that I would be told not to do it. But it's my fault. I should have been more explicit. The data is not just data. It is a large set of Django objects I call ContentClassifiers that have each certain methods that calculate from user input very large regular expressions. They they have a method classify that is applied to messages and uses the very large regular expressions. To classify a message I simply apply the classify method of all ContentClassifiers. There are very many Contentclassifiers. I compile the ContentClassifiers, which are Django objects, to pure Python objects in order to not have to fetch them from the database each time I need them and in order to be able to compile the large regular expressions offline. In Django, I generated and compiled each regular expressions of each ContentClassifier each time I needed it to classify a message. I didn't find a good way to calculate and compile the regular expressions once and store them. I already tested the automatically generated module: Before, classifying a message took about 10 seconds, now it takes miliseconds. My only problem is reloading the module: At the time being, I simply restart the web server manually from time to time in order to load the freshly compiled module. Why not just create a second process and send the messages there? Then restart the second process each time you need to reload. That can be easily automated. -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ Beware of companies that claim to be like a family. They might not be lying. --Jill Lundquist -- http://mail.python.org/mailman/listinfo/python-list
Re: ttk styles
Thanks for the link Malcolm, I'll have a look at it. What is particularly interesting (at first glance), is that the author has mixed Tkinter with ttk as it suited i.e. look at this line: f1 = tkinter.Frame(nb, background=red) If ttk was being used purely (from tkinter import *; from ttk import *) then the background keyword is nolonger available/recognised and the code would have to use ttk styles to change the colour - I find it somewhat disappointing that the author felt this approach was necessary as it tends to dilute the example by not keeping everything purely ttk - modifying the style to change the background of the Frame statements would have made it an even better example! I will repost the answer if I can work it out using this example code - thanks again! :-) Peter On Mar 18, 9:14 am, pyt...@bdurham.com wrote: Peter, Sorry I can't be of much help, but I share the same interest as you. There may be some teaser info here although I can't claim to understand the technique.http://www.java2s.com/Open-Source/Python/3.1.2-Python/Demo/Demo/tkint... If you have any links/documentation to share, I would love to see what you've found so far. Malcolm -- http://mail.python.org/mailman/listinfo/python-list
Re: ttk styles
Peter wrote: Thanks for the link Malcolm, I'll have a look at it. What is particularly interesting (at first glance), is that the author has mixed Tkinter with ttk as it suited i.e. look at this line: f1 = tkinter.Frame(nb, background=red) If ttk was being used purely (from tkinter import *; from ttk import *) then the background keyword is nolonger available/recognised and the code would have to use ttk styles to change the colour - I find it somewhat disappointing that the author felt this approach was necessary as it tends to dilute the example by not keeping everything purely ttk - modifying the style to change the background of the Frame statements would have made it an even better example! I will repost the answer if I can work it out using this example code - thanks again! :-) Another place to look for inspiration is http://tkdocs.com/ One thing to keep in mind is that not all widgets in tkinter have been migrated to ttk (although Frame was). ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list
Python 3.2 Debug build
Hi all, I'm trying to build the debug version of Python 3.2. I downloaded the py3k folder from the python SVN. Then I opened the pcbuild.sln and tried to build the python project. However the build failed when I got an error from the project pythoncore which I think python depends on? The error is: Cannot open source file: 'C:\Program Files\py3k\PCbuild\Win32-temp-Debug\pythoncore\\getbuildinfo2.c': No such file or directory. The log also mentioned the following couple lines before: 5C:\Program Files\TortoiseSVN\bin\subwcrev.exe .. ..\Modules\getbuildinfo.c C:\Program Files\py3k\PCbuild\Win32-temp-Debug\pythoncore\\getbuildinfo2.c 5'C:\Program' is not recognized as an internal or external command, I did get the debug build of python 2.7.1 and 3.1.3 to work successfully so I'm not quite sure if I'm supposed to do anything different for Python 3.2. Can anyone guide me on this? Thank you. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 3.2 Debug build
On 3/17/2011 6:54 PM, Willis Cheung wrote: Hi all, I'm trying to build the debug version of Python 3.2. I downloaded the py3k folder from the python SVN. Just so you know, Python SVN is now a read-only historical arifact. Development now happens in the hg repository. If you build x.y docs, you might as well get the latest even you want to build from a frozen x.y.z code branch. Unfortunately, I have no idea about your specific problem. I presume someone has done a 3.2 debug build on windows, but do not know for sure. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Coding and Decoding in Python
On Thu, 17 Mar 2011 08:07:28 -0700, Wanderer wrote: I have a dll that to communicate with I need to send numeric codes. So I created a dictionary. It works in one direction in that I can address the key and get the value. But when the program returns the value I can't get the key. If you only have a few keys: def find_key(value, d): Return the key in dictionary d that has the given value. If there are multiple keys with the same value, return an arbitrarily chosen one. for k, v in d.items(): if v == value: return k raise KeyError('no such value found') If you have many keys/values, then simply create a reverse dictionary: Rev_QCam_Info = {} for key, value in QCam_Info.items(): Rev_QCam_Info[value] = key and then search that. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: ttk styles
In article e0ad8fb5-3147-4ec5-ae9c-def507a75...@i35g2000prd.googlegroups.com, Peter peter.milli...@gmail.com wrote: No responses? Nobody with knowledge of modifying styles etc? You might also want to ask on the tkinter mailing list: http://mail.python.org/pipermail/tkinter-discuss/ -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list
Announce: WHIFF 1.1 Release
WHIFF 1.1 RELEASED WHIFF [WSGI HTTP Integrated Filesystem Frames] is a collection of support services for Python/WSGI Web applications which allows applications to be composed by dropping dynamic pages into container directories. This mode of development will be familiar to developers who have created PHP applications, vanilla CGI scripts, Apache/modpy Publisher applications, JSP pages, or static web content. WHIFF 1.1 improves support for Google App Engine applications and fixes a number of bugs/misfeatures regarding string quoting and encoding. PROJECT PAGE: http://whiff.sourceforge.net/ DOCUMENTATION: http://whiffdoc.appspot.com DOWNLOAD: https://sourceforge.net/projects/whiff/ REPOSITORY: http://code.google.com/p/whiff/source/checkout Please read about the features, tutorials, and demos: Test drive http://whiffdoc.appspot.com/docs/W1100_0500.TestDrive Mako template support http://whiffdoc.appspot.com/docs/W1100_1075.MakoGrading Drop down menus middlewares http://whiffdoc.appspot.com/docs/W1100_1300.menus AJAX callback support http://whiffdoc.appspot.com/docs/W1100_1400.calc Jquery helpers http://whiffdoc.appspot.com/docs/W1100_1450.jQueryUI Integration support for repoze.who authentication http://whiffdoc.appspot.com/docs/W1100_1500.who Open Flash Charts http://whiffdoc.appspot.com/docs/W1100_1600.openFlashCharts Internationalization support http://whiffdoc.appspot.com/docs/W1100_1700.international Tree views with AJAX callbacks http://whiffdoc.appspot.com/docs/W1100_2200.TreeView Google App Engine compatibility http://whiffdoc.appspot.com/docs/W1100_2300.GAEDeploy And much more. Please try it out and let me know what you think. Also, thanks to all for suggestions and other feedback. -- Aaron Watters === This one goes to eleven. -- http://mail.python.org/mailman/listinfo/python-list
Abend with cls.__repr__ = cls.__str__ on Windows.
This gives a particularly nasty abend in Windows - Python.exe has stopped working, rather than a regular exception stack error. I've fixed it, after I figured out the cause, which took a while, but maybe someone will benefit from this. Python 2.6.5 on Windows 7. class Foo(object): pass #def __str__(self): #if you have this defined, no abend #return a Foo Foo.__repr__ = Foo.__str__ # this will cause an abend. #Foo.__str__ = Foo.__repr__ #do this instead, no abend foo = Foo() print str(foo) I suspect that object.__str__ is really object.__repr__ by default, as they both print out the same string, so that this doesn't make any sense. What was I trying to achieve? Leveraging __str__ to debug instances in lists and containers. In that case, __repr__ is called and I usually do: class Foo(object): def __str__(self): return a foo def __repr__(self): #was trying to avoid this. return str(self) -- http://mail.python.org/mailman/listinfo/python-list
Re: enhanced map function
On Thu, 17 Mar 2011 08:31:28 -0700, Patrick wrote: Steven, Thanks for the info of itertools. It is a great start for me. Overall, I agree with you that it is really the user data needs to be sorted out. However, novice users may need help on certain patterns such as a=[1,[2,3],4], b=[5,[6,7,8],9,10]. You have misunderstood me. I'm not saying that you should force the users to clean up the data (although of course you could do that), but that you should do so before handing it to map. Rather than putting all the smarts into enhanced_map, and having it understand what to do with mismatched nested lists, deep nesting, integers where you would expect a list, etc., you should write another function that takes the user's data and adjusts it to some known, consistent format, and then pass that on to map. Don't have one function try to do too much. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: how to use variable to substitute class's variable?
On Mar 17, 12:47 am, Benjamin Kaplan benjamin.kap...@case.edu wrote: On Thu, Mar 17, 2011 at 3:31 AM, Hans hans...@gmail.com wrote: I have things like: file1: class aaa: def __init__(self): self.variable1='a1' self.variable2='a2' self.varable3='a3' in main proc: import file1 b=file1.aaa() c={'variable1':'value1','variable2':'value2','variable3':'value3'} for key in c: b.key=c[key] Problem is here!!! I hope put value1 to b.variable1, value2 to b.variable2 and value3 to b.variable3. it does not work. How can I do it? b.key gets the key attribute of b, not the attribute that has the same name as the variable called key. Otherwise, you'd have to reference it as b.key normally. If you want to dynamically set the variable, you'll have to use the setattr function setattr(b, key, c[key]) By the way, I know dictionary can bind two variable together, like a 2- dimension array. but, if I need group 3 or more variables together, (each group has 3 or more variables)like a 3-dimension(or higher) array, Is there an easy way besides class? A dictionary does not bind two variables together. A dictionary is a hash map- it maps keys to values. Each key will map to exactly one value. If you want to store a list of associated values, use a tuple. A tuple is an immutable collection of objects (the tuple itself is immutable, not necessarily the objects in it). It can be indexed just like a list. l = [(0,0), (0,1,2,3,4,5,6,7), (0,1,'foo', 5 ,6)] l[0] (0, 0) l[2] (0, 1, 'foo', 5, 6) l[2][1]- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text - Thank you VERY MUCH! it works. -- http://mail.python.org/mailman/listinfo/python-list
Re: Fitting polynomial curve
On Thu, Mar 17, 2011 at 5:09 PM, Terry Reedy tjre...@udel.edu wrote: Look at scipy. -- Thanks for the info. I realized I made some mistakes. Anyway, what I'm trying to do is in maya (python), fit selected vertices on a curve. Here is what I have so far: import maya.cmds as cmds import numpy def run_main(): verts = cmds.ls(sl=True,fl=True) if len(verts) = 2: degree = 5 x = [] y = [] for vert in verts: vert_x,vert_y,vert_z = cmds.pointPosition(vert,w=True) x.append(vert_x) y.append(vert_z) print x , x print y , y x_numpy = numpy.array(x) y_numpy = numpy.array(y) funct = numpy.polyfit(x_numpy,y_numpy,degree) print funct #p : ndarray, shape (M,) or (M, K) #Polynomial coefficients, highest power first. If y was 2-D, the coefficients for k-th data set are in p[:,k]. #make an outline curve curvs = [] for i in range(len(verts)): vert_x,vert_y,vert_z = cmds.pointPosition(verts[i],w=True) pos_x = 0 pos_y = 0 for j in range(degree): pos_x += (funct[j] *(vert_x**(degree-j))) pos_y += (funct[j] *(vert_y**(degree-j))) centerPos = (pos_x,pos_y,vert_z) curvs.append(centerPos) if curvs: print cirv , curvs crv = cmds.curve(p=curvs) cmds.select(cl=True) for v in verts: cmds.select(v,tgl=True) else: print please select more than 2 verts But this only works for 2D (x,z-axis). Is it possible to make it work at 3 by combining them or doing (x,y) and (x,z) and somehow colate (average?) the results? Is there a formula for combining the results? Thanks again for any help or suggestions -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 3.2 Debug build
Looks like something tripped over whitespaces in path names for svn tools. Try checking out a working copy from the hg repository? ~/santa On Thu, Mar 17, 2011 at 3:54 PM, Willis Cheung wche...@pdftron.com wrote: Hi all, I'm trying to build the debug version of Python 3.2. I downloaded the py3k folder from the python SVN. Then I opened the pcbuild.sln and tried to build the python project. However the build failed when I got an error from the project pythoncore which I think python depends on? The error is: Cannot open source file: 'C:\Program Files\py3k\PCbuild\Win32-temp-Debug\pythoncore\\getbuildinfo2.c': No such file or directory. The log also mentioned the following couple lines before: 5C:\Program Files\TortoiseSVN\bin\subwcrev.exe .. ..\Modules\getbuildinfo.c C:\Program Files\py3k\PCbuild\Win32-temp-Debug\pythoncore\\getbuildinfo2.c 5'C:\Program' is not recognized as an internal or external command, I did get the debug build of python 2.7.1 and 3.1.3 to work successfully so I'm not quite sure if I'm supposed to do anything different for Python 3.2. Can anyone guide me on this? Thank you. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: PostgreSQL vs MySQL
In article 87bp1a3g59@benfinney.id.au, Ben Finney ben+pyt...@benfinney.id.au wrote: a...@pythoncraft.com (Aahz) writes: (I always recommend people to use PostgreSQL, though; which is superior in almost every way, especially the C client library and the wire protocol.) Can you point at a reference for the latter? I have been trying to convince my company that PG is better than MySQL. These may be helpful: URL:http://wiki.postgresql.org/wiki/Why_PostgreSQL_Instead_of_MySQL_2009 URL:http://www.wikivs.com/wiki/MySQL_vs_PostgreSQL Thanks! I've forwarded this. However, it doesn't address the assertion about the client library and wire protocol. -- Aahz (a...@pythoncraft.com) * http://www.pythoncraft.com/ Beware of companies that claim to be like a family. They might not be lying. --Jill Lundquist -- http://mail.python.org/mailman/listinfo/python-list
Re: Fitting polynomial curve
On Thu, Mar 17, 2011 at 5:44 PM, Astan Chee astan.c...@gmail.com wrote: On Thu, Mar 17, 2011 at 5:09 PM, Terry Reedy tjre...@udel.edu wrote: Look at scipy. Thanks for the info. I realized I made some mistakes. Anyway, what I'm trying to do is in maya (python), fit selected vertices on a curve. Here is what I have so far: ... But this only works for 2D (x,z-axis). Is it possible to make it work at 3 by combining them or doing (x,y) and (x,z) and somehow colate (average?) the results? Is there a formula for combining the results? Thanks again for any help or suggestions Maybe this? http://code.google.com/p/pythonequations/downloads/list Or google for three dimensional curve fitting. -- http://mail.python.org/mailman/listinfo/python-list
Re: creating RAW sockets
On Wed, 16 Mar 2011 23:50:03 -0700, moijes12 wrote: Now,please can someone guide(as in what should I read and NOT as in give me the code) me in decoding the IP header of packets using python 3.0.1. The struct module is the usual approach for decoding binary data structures. Fields which aren't whole bytes/words will need to be extracted manually using and . In case you don't already have it, the layout of an IPv4 header can be found at: http://en.wikipedia.org/wiki/IPv4#Header Remember that TCP/IP uses big-endian format. -- http://mail.python.org/mailman/listinfo/python-list
Re: Abend with cls.__repr__ = cls.__str__ on Windows.
On 3/17/2011 8:24 PM, J Peyret wrote: This gives a particularly nasty abend in Windows - Python.exe has stopped working, rather than a regular exception stack error. I've fixed it, after I figured out the cause, which took a while, but maybe someone will benefit from this. Python 2.6.5 on Windows 7. class Foo(object): pass Foo.__repr__ = Foo.__str__ # this will cause an abend. 2.7.1 and 3.2.0 on winxp, no problem, interactive intepreter or IDLE shell. Upgrade? -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Abend with cls.__repr__ = cls.__str__ on Windows.
On Thu, 17 Mar 2011 17:24:36 -0700, J Peyret wrote: This gives a particularly nasty abend in Windows - Python.exe has stopped working, rather than a regular exception stack error. I've fixed it, after I figured out the cause, which took a while, but maybe someone will benefit from this. Python 2.6.5 on Windows 7. I get the same behaviour on Python 2.6, 2.7 and 3.1 under Linux: the Python process hangs until killed manually. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Abend with cls.__repr__ = cls.__str__ on Windows.
On 3/17/2011 10:00 PM, Terry Reedy wrote: On 3/17/2011 8:24 PM, J Peyret wrote: This gives a particularly nasty abend in Windows - Python.exe has stopped working, rather than a regular exception stack error. I've fixed it, after I figured out the cause, which took a while, but maybe someone will benefit from this. Python 2.6.5 on Windows 7. class Foo(object): pass Foo.__repr__ = Foo.__str__ # this will cause an abend. 2.7.1 and 3.2.0 on winxp, no problem, interactive intepreter or IDLE shell. Upgrade? To be clear, the above, with added indent, but with extra fluff (fixes) removed, is exactly what I ran. If you got error with anything else, please say so. Described behavior for legal code is a bug. However, unless a security issue, it would not be fixed for 2.6. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Abend with cls.__repr__ = cls.__str__ on Windows.
On Mar 17, 9:37 pm, Terry Reedy tjre...@udel.edu wrote: On 3/17/2011 10:00 PM, Terry Reedy wrote: On 3/17/2011 8:24 PM, J Peyret wrote: This gives a particularly nasty abend in Windows - Python.exe has stopped working, rather than a regular exception stack error. I've fixed it, after I figured out the cause, which took a while, but maybe someone will benefit from this. Python 2.6.5 on Windows 7. class Foo(object): pass Foo.__repr__ = Foo.__str__ # this will cause an abend. 2.7.1 and 3.2.0 on winxp, no problem, interactive intepreter or IDLE shell. Upgrade? To be clear, the above, with added indent, but with extra fluff (fixes) removed, is exactly what I ran. If you got error with anything else, please say so. Described behavior for legal code is a bug. However, unless a security issue, it would not be fixed for 2.6. -- Terry Jan Reedy Nope, that is it. No need to upgrade, nor is there any urgency. I was just surprised to see it fail so brutally, is all. I've only encountered 2 or 3 core Python bugs at that level in about 13 yrs of coding in it, so thought I'd post it, especially as it is so easy to replicate. Txs for your help I actually have another really weird behavior in this program, but haven't figured out yet what causes it so it is hard to tell if it's an error on my part or another system bug. I'll post it if I can isolate a system error. FWIW, what I am doing is using Configparser to assemble a bunch of classes together to provide a reporting/diffing engine for database comparisons. The object compositions are all defined in an .ini file. I've found Python + ini files are a great match for creating truly flexible programs. SQL queries, template strings and regular expression patterns can be stored in the ini file and are easy to modify without touching the core python code. Pass a different ini file = different behavior. Xml is overkill for this and plays really badly with relational , operators. This is the next step for me, defining mostly separate classes and assembling and initializing them based on ini file configuration info. -- http://mail.python.org/mailman/listinfo/python-list
Re: creating RAW sockets
On Mar 18, 6:20 am, Nobody nob...@nowhere.com wrote: On Wed, 16 Mar 2011 23:50:03 -0700, moijes12 wrote: Now,please can someone guide(as in what should I read and NOT as in give me the code) me in decoding the IP header of packets using python 3.0.1. The struct module is the usual approach for decoding binary data structures. Fields which aren't whole bytes/words will need to be extracted manually using and . In case you don't already have it, the layout of an IPv4 header can be found at: http://en.wikipedia.org/wiki/IPv4#Header Remember that TCP/IP uses big-endian format. thanks guys Moijes -- http://mail.python.org/mailman/listinfo/python-list
Re: PostgreSQL vs MySQL (was Re: How to handle sockets - easily?)
On Mar 16, 10:19 am, a...@pythoncraft.com (Aahz) wrote: In article fdjt28-flo@wilbur.25thandclement.com, always recommend people to use PostgreSQL, though; which is superior in almost every way, especially the C client library and the wire protocol.) Can you point at a reference for the latter? I have been trying to convince my company that PG is better than MySQL. -- Well, my $.02 worth is that, about 3 yrs ago, on 5.0x-5.1x, I was truly appalled by the sheer level of stupidity displayed by MySQL's handling of a moderately complex UPDATE SQL query with a correlated subquery. (Let's say this was a 7 out of 10 complexity, with your standard selects being 1-3 max and a nightmare update query with all sorts of correlated subqueries would be a 9. I am first of all a database programmer, so queries are my world). Not only did MySQL mangle the query because it didn't understand what I was asking, it thrashed the data during the update and committed it. And, when I reviewed the query once again, I found I had mismatched parentheses, so it wasn't even syntaxically correct. Truly scary. DB2 + SQLBase punted for years on correlated subqueries Ex: update ORDERS where x=y and exists (select 1 from ORDERS where some condition). The DB2 engine doesn't know how to handle them, so it tells you to get lost. MySQL is not smart enough to recognize it's over its head and instead makes a best effort. To me it looks like a database that will get you 80% there and steadfastly refuse the last 20%, assuming you need really clever queries. PG was much cleaner in behavior, though a pain to install, especially on Windows. -- http://mail.python.org/mailman/listinfo/python-list
[issue11459] Python select.select does not correctly report read readyness
Gregory P. Smith g...@krypto.org added the comment: yeah i figured importing io from os at the top level might be a problem. it is not important for the default to be that exact value, even something safely on the small side like 512 will work. but we could just have the default be set in the code by doing the 'import io' at os.popen() runtime. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11459 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11567] http.server error message format
Gennadiy Zlobin gennad.zlo...@gmail.com added the comment: Hi guys, this is my first patch for the Python interpreter. Hope it is ok, but if it is not, be sure to comment and I'll fix it ASAP -- keywords: +patch Added file: http://bugs.python.org/file21262/11567.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11567 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11442] list_directory() in SimpleHTTPServer.py should add charset=... to Content-type header
Roundup Robot devnull@devnull added the comment: New changeset e9724d7abbc2 by Senthil Kumaran in branch '2.5': Fix issue11442 - Add a charset parameter to the Content-type to avoid XSS attacks. http://hg.python.org/cpython/rev/e9724d7abbc2 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11442 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11581] buildbot error when pushing to 2.5 branch?
New submission from Senthil Kumaran orsent...@gmail.com: When pushed a change to 2.5 branch, I got an error, which I think has to do with buildbot not available for 2.5 codeline. It asked me to notify the tracker and here it is. remote: state = method(*args, **kw) remote: File /data/buildbot/master/master.cfg, line 87, in perspective_addChange remote: changedict['category'] = branch_to_category[changedict['branch']] remote: exceptions.KeyError: '2.5' remote: ] remote: sent email to roundup at rep...@bugs.python.org -- files: bb-error.txt messages: 131229 nosy: orsenthil, python-dev priority: normal severity: normal status: open title: buildbot error when pushing to 2.5 branch? Added file: http://bugs.python.org/file21263/bb-error.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11581 ___pushing to ssh://h...@hg.python.org/cpython searching for changes remote: adding changesets remote: adding manifests remote: adding file changes remote: added 4 changesets with 2 changes to 1 files remote: change(s) NOT sent, something went wrong: remote: [Failure instance: Traceback from remote host -- Traceback (most recent call last): remote: File /usr/lib/python2.6/dist-packages/twisted/spread/banana.py, line 153, in gotItem remote: self.callExpressionReceived(item) remote: File /usr/lib/python2.6/dist-packages/twisted/spread/banana.py, line 116, in callExpressionReceived remote: self.expressionReceived(obj) remote: File /usr/lib/python2.6/dist-packages/twisted/spread/pb.py, line 514, in expressionReceived remote: method(*sexp[1:]) remote: File /usr/lib/python2.6/dist-packages/twisted/spread/pb.py, line 826, in proto_message remote: self._recvMessage(self.localObjectForID, requestID, objectID, message, answerRequired, netArgs, netKw) remote: --- exception caught here --- remote: File /usr/lib/python2.6/dist-packages/twisted/spread/pb.py, line 840, in _recvMessage remote: netResult = object.remoteMessageReceived(self, message, netArgs, netKw) remote: File /usr/lib/python2.6/dist-packages/twisted/spread/pb.py, line 225, in perspectiveMessageReceived remote: state = method(*args, **kw) remote: File /data/buildbot/master/master.cfg, line 87, in perspective_addChange remote: changedict['category'] = branch_to_category[changedict['branch']] remote: exceptions.KeyError: '2.5' remote: ] remote: sent email to roundup at rep...@bugs.python.org remote: notified python-check...@python.org of incoming changeset e9724d7abbc2 remote: notified python-check...@python.org of incoming changeset 8cdb95cf096e remote: notified python-check...@python.org of incoming changeset 6cd7de9deb1a remote: notified python-check...@python.org of incoming changeset 1148131b1099 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11582] Boilerplate code replaced in Python/ceval.c
New submission from knickerkicker knicker.kic...@gmail.com: Replaced boilerplate implementations of several BINARY_* and INPLACE_* opcodes with two macros. The result shaves off 154 lines from Python/ceval.c. -- components: Interpreter Core files: 20110317_ceval.patch keywords: patch messages: 131230 nosy: knicker.kicker priority: normal severity: normal status: open title: Boilerplate code replaced in Python/ceval.c versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file21264/20110317_ceval.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11582 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11442] list_directory() in SimpleHTTPServer.py should add charset=... to Content-type header
Senthil Kumaran orsent...@gmail.com added the comment: Fixed in all the relevant code lines. -- assignee: - orsenthil priority: release blocker - resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11442 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11088] IDLE on OS X with Cocoa Tk 8.5 can hang waiting on input / raw_input
Ned Deily n...@acm.org added the comment: I don't have any better suggestions at the moment so let's go with it. Perhaps we'll get more insight to the root cause later. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11088 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11055] OS X IDLE 3.2 Save As menu accelerator opens two Save windows
Ned Deily n...@acm.org added the comment: The actual unwanted event is being generated as a result of the menu add command accelerator. You can see that by playing with Wish. set w .menu catch {destroy $w} toplevel $w wm title $w Menu Shift menu $w.menu -tearoff 0 set m $w.menu.basic $w.menu add cascade -label Basic -menu $m -underline 0 menu $m -tearoff 0 $m add command -label Test \ -command puts command -accelerator Command-Shift-A bind $w Command-Shift-A puts bind $w configure -menu $w.menu It appears that there is a bug in the Cocoa Tk right now where accelerators with Shift (at least) in them are not being properly ignored by Tk. In the Carbon Tk and the X11 Tk, I believe the only effect of the accelerator definitions on the add command is to be used to create the shortcut characters displayed in the menu entry. However, apparently a side effect of using the Cocoa APIs is that the menu definitions now cause notifications back into Tk which are not supposed to be translated into Tcl/Tk events back to the app. For some reason, the shift ones are not being ignored. https://github.com/das/tcltk/blob/master/tk/macosx/tkMacOSXMenu.c Also, it seems that with all three of the Tk implementations (Carbon, X11, and Cocoa), using a capital letter for the menu accelerator implies Shift. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11055 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4114] struct returns incorrect 4 byte float
Mark Dickinson dicki...@gmail.com added the comment: I don't think this needs to be documented beyond the limitations of floating-point that are already documented in the tutorial. It's the obvious behaviour: double to float (when packing) converts to the nearest float; the float to double conversion is exact. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4114] struct returns incorrect 4 byte float
Mark Dickinson dicki...@gmail.com added the comment: [Robert] I have to disagree. It seems entirely reasonable to expect that unpack should return the same value passed to pack. Robert: notice that a *Python* float (a *64-bit* C double internally) is here being stored as a *32-bit* float, losing precision. So no, it's not at all reasonable to expect that unpack should return the same value passed to pack---it's mathematically impossible for it to do so. There are (around) 2**64 distinct Python floats, and only 2**32 ways to pack them using 'f'. When packing / unpacking using 'd', it *is* reasonable to expect the value to be recovered exactly, and as far as I know that's always what happens (barring peculiarities like NaN payloads not being reproduced exactly). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4114 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11567] http.server error message format
Roundup Robot devnull@devnull added the comment: New changeset db4967095f10 by Senthil Kumaran in branch '3.2': Fix issue11567: http.server DEFAULT_ERROR_MESSAGE format. Patch by Gennadiy Zlobin. http://hg.python.org/cpython/rev/db4967095f10 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11567 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11567] http.server error message format
Senthil Kumaran orsent...@gmail.com added the comment: Fixed in 3.3 and 3.2. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11567 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11583] os.path.isdir() is slow on windows
New submission from Eli Bendersky eli...@gmail.com: Report here: http://stackoverflow.com/questions/5316928/python-os-path-isdir-is-slow-on-windows It could be a problem with Windows itself, but I'm opening this to keep track of the issue, just to be on the safe side. -- components: Library (Lib) messages: 131238 nosy: brian.curtin, eli.bendersky, tim.golden priority: normal severity: normal status: open title: os.path.isdir() is slow on windows type: performance versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11557] Increase coverage in logging module
Changes by Gennadiy Zlobin gennad.zlo...@gmail.com: -- nosy: +gennad ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11557 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue4492] httplib code thinks it closes connection, but does not
Changes by Gennadiy Zlobin gennad.zlo...@gmail.com: -- nosy: +gennad ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4492 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11583] os.path.isdir() is slow on windows
Martin v. Löwis mar...@v.loewis.de added the comment: How do you expect this to be resolved? Or will it stay open until Microsoft improves the NTFS performance? -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11568] docstring of select.epoll.register() is wrong
Changes by Gennadiy Zlobin gennad.zlo...@gmail.com: -- assignee: - docs@python components: +Documentation nosy: +docs@python type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11568 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11568] docstring of select.epoll.register() is wrong
Gennadiy Zlobin gennad.zlo...@gmail.com added the comment: The patch fixes the docstring -- keywords: +patch nosy: +gennad Added file: http://bugs.python.org/file21265/11568.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11568 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11583] os.path.isdir() is slow on windows
Eli Bendersky eli...@gmail.com added the comment: On Thu, Mar 17, 2011 at 12:46, Martin v. Löwis rep...@bugs.python.orgwrote: I opened this in order not to forget to look at the implementation of isdir on windows, making sure it's the most optimal thing we can do. If you know it is, the issue can be closed as far as I'm concerned. -- Added file: http://bugs.python.org/file21266/unnamed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11583 ___div dir=ltrbrbrdiv class=gmail_quoteOn Thu, Mar 17, 2011 at 12:46, Martin v. Löwis span dir=ltrlt;a href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/span wrote:brblockquote class=gmail_quote style=margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex; br Martin v. Löwis lt;a href=mailto:mar...@v.loewis.de;mar...@v.loewis.de/agt; added the comment:br br How do you expect this to be resolved? Or will it stay open until Microsoft improves the NTFS performance?br br/blockquote/divbrI opened this in order not to forget to look at the implementation of isdir on windows, making sure it#39;s the most optimal thing we can do. If you know it is, the issue can be closed as far as I#39;m concerned.br br/div ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11583] os.path.isdir() is slow on windows
Changes by SilentGhost ghost@gmail.com: Removed file: http://bugs.python.org/file21266/unnamed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11583 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11584] email/header.py: missing str()ification, and bogus encode()s
New submission from Steffen Daode Nurpmeso sdao...@googlemail.com: My minimal failing test case dragged yet another EMAIL error to the light!!! Man, man, man - it's really great that QNX fund money so that you have the time to fix this broken thing! It's got washed away, but http://bugs.python.org/file21210/email_header.diff can be used on top of 42cd61b96e54 to fix the following: __ Traceback (most recent call last): [FOREIGN CODE] File /Users/steffen/usr/bin/s-postman.py, line 1765, in _bewitch_msg self._msg[n] = email.header.make_header(email.header.decode_header(b)) File /Users/steffen/usr/opt/py3k/lib/python3.3/email/header.py, line 73, in decode_header if not ecre.search(header): Exception: TypeError: expected string or buffer __ However, if that's patched in, we end up here __ Traceback (most recent call last): [FOREIGN CODE] File /Users/steffen/usr/bin/s-postman.py, line 1765, in _bewitch_msg self._msg[n] = email.header.make_header(email.header.decode_header(b)) File /Users/steffen/usr/opt/py3k/lib/python3.3/email/header.py, line 154, in make_header h.append(s, charset) File /Users/steffen/usr/opt/py3k/lib/python3.3/email/header.py, line 278, in append s.encode(output_charset, errors) Exception: UnicodeEncodeError: 'ascii' codec can't encode character '\ufffd' in position 7: ordinal not in range(128) __ Let me know if you want that '456943 17 Mar 12:51 rdm-postman.tbz' thing, it's waiting for you. It contains a digest mbox, a config and the patched S-Postman. Maybe i can strip it to 42 if i spend some more time on it. -- components: Library (Lib) messages: 131242 nosy: r.david.murray, sdaoden priority: normal severity: normal status: open title: email/header.py: missing str()ification, and bogus encode()s versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11580] Add width and precision formatters to PyBytes_FromFormatV()
Changes by Amaury Forgeot d'Arc amaur...@gmail.com: -- assignee: - haypo nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11580 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1628484] Python 2.5 64 bit compile fails on Solaris 10/gcc 4.1.1
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1628484 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1676121] Problem linking to readline lib on x86(64) Solaris
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1676121 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1733484] Solaris 64 bit LD_LIBRARY_PATH_64 needs to be set
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1733484 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue847812] 64 bit solaris versus /usr/local/lib
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue847812 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1294959] Problems with /usr/lib64 builds.
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1294959 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1681333] email.header unicode fix
R. David Murray rdmur...@bitdance.com added the comment: Yes, I can well understand that feeling. I've only relatively recently taken over maintaining the email package. I'm working my way through the old bug queue, and I can only deal with them in the context in which I find them. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1681333 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11584] email/header.py: missing str()ification, and bogus encode()s
R. David Murray rdmur...@bitdance.com added the comment: I don't see a test case here, did you forget to attatch something? Also, in this: elf._msg[n] = email.header.make_header(email.header.decode_header(b)) unless 'b' is an ASCII-only string, it isn't going to work. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11584] email/header.py: missing str()ification, and bogus encode()s
Changes by R. David Murray rdmur...@bitdance.com: -- assignee: - r.david.murray stage: - test needed type: - behavior versions: +Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11584 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11383] compilation seg faults on insanely large expressions
SilentGhost ghost@gmail.com added the comment: 100k is, apparently, not enough on my system (linux2). test_crashers now fails. Are any system-specific details needed? -- nosy: +SilentGhost ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11383 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11585] Documentation 1.8 shows Python 2 example
New submission from Clive Darke clive.da...@qa.com: Python 3.2 version attached -- assignee: docs@python components: Documentation files: parrot.c messages: 131246 nosy: cdarke, docs@python priority: normal severity: normal status: open title: Documentation 1.8 shows Python 2 example versions: Python 3.1, Python 3.2 Added file: http://bugs.python.org/file21267/parrot.c ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11585 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11585] Documentation 1.8 shows Python 2 example
Clive Darke clive.da...@qa.com added the comment: 1.8. Keyword Parameters for Extension Functions Here is an example module which uses keywords, based on an example by Geoff Philbrick (philbr...@hks.com): The example which follows will not compile on Python 3. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11585 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11383] compilation seg faults on insanely large expressions
SilentGhost ghost@gmail.com added the comment: 10**6 on the other hand seem to do the job -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11383 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11582] Boilerplate code replaced in Python/ceval.c
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: Hmm, this kind of macros make it difficult to step line by line in a debugger. From this point of view, an inlined function would be better, I'm not sure if this can have a performance impact though. -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11582 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10535] Enable warnings by default in unittest
Brian Curtin br...@python.org added the comment: I'm not seeing those warnings anymore, so I think the patch can be ignored. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10535 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11582] Boilerplate code replaced in Python/ceval.c
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11582 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11586] Python/pythonrun.c: get_codec_name() typo
New submission from Ray.Allen ysj@gmail.com: I guess there is a typo in the source of this function: Python/pythonrun.c: get_codec_name() diff -r 48970d754841 Python/pythonrun.c --- a/Python/pythonrun.cThu Mar 17 17:06:27 2011 +0800 +++ b/Python/pythonrun.cThu Mar 17 22:11:15 2011 +0800 @@ -147,7 +147,7 @@ goto error; name_utf8 = _PyUnicode_AsString(name); -if (name == NULL) +if (name_utf8 == NULL) goto error; name_str = strdup(name_utf8); Py_DECREF(name); -- components: Interpreter Core messages: 131252 nosy: ysj.ray priority: normal severity: normal status: open title: Python/pythonrun.c: get_codec_name() typo versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11586 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11587] METH_KEYWORDS alone gives METH_OLDARGS is no longer supported!
New submission from Clive Darke clive.da...@qa.com: In the PyMethodDef struct, METH_VARARGS | METH_KEYWORDS works fine. METH_KEYWORDS on its own gives: SystemError: Bad call flags in PyCFunction_Call. METH_OLDARGS is no longer supported! METH_KEYWORDS on its own tested OK on 2.6 and 2.7, fails as described on 3.1.2 and 3.2. -- components: Extension Modules messages: 131253 nosy: cdarke priority: normal severity: normal status: open title: METH_KEYWORDS alone gives METH_OLDARGS is no longer supported! type: compile error versions: Python 3.1, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11587 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11586] Python/pythonrun.c: get_codec_name() typo
Changes by Antoine Pitrou pit...@free.fr: -- assignee: - haypo nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11586 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com