SMTP-Email Help
Hi Guys. I need some help with the coding for my program. This coding is suppose to sort text file according to the latest date and send the latest file. Attach it to my email and sent to another email account. But somehow the program is unable to send email. [CODE]#!/usr/bin/python import os, glob, smtplib, datetime from email.MIMEMultipart import MIMEMultipart from email.MIMEBase import MIMEBase from email.MIMEText import MIMEText from email import Encoders process_list=[] AP_filelist=[] Client_filelist=[] BlackClient_filelist=[] sniff_assoc = 0 i = 0 to = iamsiaozhar...@hotmail.sg gmail_user = root.phidg...@gmail.com gmail_pwd = rootphidget def mail(to, subject, text, attach): msg = MIMEMultipart() msg['From'] = gmail_user msg['To'] = to msg['Subject'] = subject msg.attach(MIMEText(text)) part = MIMEBase('application', 'octet-stream') part.set_payload(open(attach, 'rb').read()) Encoders.encode_base64(part) part.add_header('Content-Disposition', 'attachment; filename=%s' % os.path.basename(attach)) msg.attach(part) mailServer = smtplib.SMTP(smtp.gmail.com, 587) mailServer.ehlo() mailServer.starttls() mailServer.ehlo() mailServer.login(gmail_user, gmail_pwd) mailServer.sendmail(gmail_user, to, msg.as_string()) # Should be mailServer.quit(), but that crashes... mailServer.close() Client_files = glob.glob('/root/wifi/Output_assoc/*Rouge-Client*.txt') def get_oldest_Client_file(Client_files): for data in Client_files: stats = os.stat(data) Client_filelist.append(data) sortedClient = sorted(Client_filelist) return sortedClient[0] BlackClient_files = glob.glob('/root/wifi/Output_arp/*DeAuth-Client*.txt') def get_oldest_BlackClient_file(BlackClient_files): for data in BlackClient_files: stats = os.stat(data) BlackClient_filelist.append(data) sortedBlackClient = sorted(BlackClient_filelist) return sortedBlackClient[0] if __name__=='__main__': try: if os.path.getsize(get_oldest_Client_file(Client_files)) 1: mail(root.phidg...@gmail.com, Rouge Client Found, Client MAC address in the attachment, get_oldest_Client_file(Client_files)) print str(datetime.datetime.now()) + ' -- ' + get_oldest_Client_file(Client_files) + ' was sent.' os.remove(get_oldest_Client_file(Client_files)) else: for line in os.popen(ps -e): fields = line.split() process = fields[3] process_list.append(process) for pro in process_list: if pro == 'sniff_assoc': sniff_assoc = 1 i+=1 if sniff_assoc == 0: os.remove(get_oldest_Client_file(Client_files)) print str(datetime.datetime.now()) + ' -- ' + 'program is not running. ' + get_oldest_Client_file(Client_files) + ' is remove.' else: print str(datetime.datetime.now()) + ' -- ' + 'Client file is still writing.' except: print str(datetime.datetime.now()) + ' -- ' + 'No AP file to send.' try: if os.path.getsize(get_oldest_BlackClient_file(BlackClient_files)) 1: mail(root.phidg...@gmail.com, DeAuth Rouge Client, Client MAC address in the attachment., get_oldest_BlackClient_file(BlackClient_files)) print str(datetime.datetime.now()) + ' -- ' + get_oldest_BlackClient_file(BlackClient_files) + ' was sent.' os.remove(get_oldest_BlackClient_file(BlackClient_files)) else: for line in os.popen(ps -e): fields = line.split() process = fields[3] process_list.append(process) for pro in process_list: if pro == 'sniff_arp': sniff_assoc = 1 i+=1 if sniff_assoc == 0: os.remove(get_oldest_BlackClient_file(BlackClient_files)) print str(datetime.datetime.now()) + ' -- ' + 'program is not running. ' + get_oldest_BlackClient_file(BlackClient_files) + ' is REMOVED!!' else: print str(datetime.datetime.now()) + ' -- ' + 'DeAuth client file is still writing!' except: print str(datetime.datetime.now()) + ' -- ' + 'No DeAuth client file to send.'[/CODE] -- http://mail.python.org/mailman/listinfo/python-list
Re: SMTP-Email Help
On Sun, 28 Apr 2013 23:39:53 -0700, root.phidgets wrote: Hi Guys. I need some help with the coding for my program. This coding is suppose to sort text file according to the latest date and send the latest file. Attach it to my email and sent to another email account. But somehow the program is unable to send email. I believe that Google has locked you out of your account. Are you aware that you've just made your username and password visible to the entire Internet? If you hadn't already triggered Google's anti-spam detection, you surely have now. gmail_user = @gmail.com gmail_pwd = ** (details redacted, to shut the barn door now that the horse has already run away) When I log into your gmail account with those credentials, I see: Verify your account We've detected unusual activity on your account. To immediately restore access to your account, choose how to verify your account. so I believe Google have locked the account because they think you're spamming. You'll need to fix that before anything else. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: [pyxl] Re: xlrd 0.9.2 released!
On 26/04/2013 20:37, Ondrej Ján wrote: If users have python-xlrd installed, package maintainer should release only updates, which are API compatible with older versions. Right, the only API change between 0.6 and 0.9 is the removal of the 'pickleable' parameter to open_workbook. However, this was removed because it hadn't worked in a long long time. Both Fedora and CentOS has python=2.6, python3 is available for Fedora too (no plans to release python3-xlrd now). xlrd 0.9 and above works with both python2 and python3 as-is. So can I release an update for all my Linux distributions with backward compatibility of this package? xlrd-0.8 was requested for xlsx support. I would suggest just going for 0.9.2. Are there some howtos describing upgrading applications using xlrd to newer versions? These documents can help me to choose, if I can release an update. There aren't any, because there are no changes. Applications written for 0.6.x will still work without change when using 0.9.2. cheers, Chris -- Simplistix - Content Management, Batch Processing Python Consulting - http://www.simplistix.co.uk -- http://mail.python.org/mailman/listinfo/python-list
How do I encode and decode this data to write to a file?
I am debugging some code that creates a static HTML gallery from a directory hierarchy full of images. It's this package:- https://pypi.python.org/pypi/Gallery2.py/2.0 It's basically working and does pretty much what I want so I'm happy to put some effort into it and fix things. The problem I'm currently chasing is that it can't cope with directory names that have accented characters in them, it fails when it tries to write the HTML that creates the page with the thumbnails on. The code that's failing is:- raw = os.path.join(directory, self.getNameNoExtension()) + .html file = open(raw, w) file.write(.join(html).encode('utf-8')) file.close() The variable html is a list containing the lines of HTML to write to the file. It fails when it contains accented characters (an é in this case). Here's the traceback:- Traceback (most recent call last): File /usr/local/lib/python2.7/dist-packages/gallery/galleries.py, line 41, in run self._recurse() File /usr/local/lib/python2.7/dist-packages/gallery/galleries.py, line 272, in _recurse os.path.walk(self.props[sourcedir], self.processDir, None) File /usr/lib/python2.7/posixpath.py, line 246, in walk walk(name, func, arg) File /usr/lib/python2.7/posixpath.py, line 246, in walk walk(name, func, arg) File /usr/lib/python2.7/posixpath.py, line 246, in walk walk(name, func, arg) File /usr/lib/python2.7/posixpath.py, line 238, in walk func(arg, top, names) File /usr/local/lib/python2.7/dist-packages/gallery/galleries.py, line 263, in processDir self.createGallery() File /usr/local/lib/python2.7/dist-packages/gallery/galleries.py, line 215, in createGallery self.picturemanager.createPictureHTMLs(self.footer) File /usr/local/lib/python2.7/dist-packages/gallery/picturemanager.py, line 84, in createPictureHTMLs curPic.createPictureHTML(self.galleryDirectory, self.getStylesheet(), self.fullsize, footer) File /usr/local/lib/python2.7/dist-packages/gallery/picture.py, line 361, in createPictureHTML file.write(.join(html).encode('utf-8')) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 783: ordinal not in range(128) If I understand correctly the encode() is saying that it can't understand the data in the html because there's a character 0xc3 in it. I *think* this means that the é is encoded in UTF-8 already in the incoming data stream (should be as my system is wholly UTF-8 as far as I know and I created the directory name). So how do I change the code so I don't get the error? Do I just decode() the data first and then encode() it? -- Chris Green -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I encode and decode this data to write to a file?
On 2013.04.29 04:47, c...@isbd.net wrote: If I understand correctly the encode() is saying that it can't understand the data in the html because there's a character 0xc3 in it. I *think* this means that the é is encoded in UTF-8 already in the incoming data stream (should be as my system is wholly UTF-8 as far as I know and I created the directory name). You can verify that your filesystem is set to use UTF-8 with sys.getfilesystemencoding(). If it returns 'ascii', then your locale settings are incorrect. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
RE: xml.etree.ElementTree if element does not exist?
Good Afternoon, Among other elements values that my script finds is value for sepid sepid = content.find(.//{http://www.huawei.com.cn/schema/common/v2_1}sepid ).text however, if i pass xml data that DOES NOT contain sepid element, i get an error: Traceback (most recent call last): File /usr/local/bin/receive.py, line 21, in module sepid = content.find(.//{ http://www.huawei.com.cn/schema/common/v2_1}sepid;).text AttributeError: 'NoneType' object has no attribute 'text' some messages i receive will have the sepid parameter, other will not have this parameter. How can i cater for this? kinda like an if .. else implementation for xml.etree.ElementTree ? Thanks in advance. Saludos Ombongi Moraa Faith -- http://mail.python.org/mailman/listinfo/python-list
Drag and drop in Windows
Hello all, Sorry to post such a generic question, but after searching the interwebs I'm not really any wiser about how to start with this. I'm currently on: Windows XP Python 2.7 I'm trying to create a small window in Python 2.7, that when you drop a file onto it from Windows explorer returns the file's path so that I can then go on to open the file and do whatever with it. I was planning on using Tkinter because that's what I've used before for GUI's, but I can be swayed from this if needs be. I've found this (TkDND): http://wiki.tcl.tk/2768 But I don't know how to implement this in Python. The Windows binary for it comes as a set of .tcl files and a single .dll file. The two options I've stumbled across seem to be 1. a Python wrapper for the DLL (I think to wrap C code??), which can then be imported like you'd import a Python package 2. direct implementation of the Tcl file [tk.eval('source ...')], but I don't reallu understand what's going on with this - can you only execute a main bit of Tcl files rather than implementing individual functions? Any input (however minimal) is definitely appreciated! I've included what I think are probably the relevant functions from the Tcl files at the bottom of the email, but I don't really understand the nuts and bolts of the code. All the best, Rob [From tkdnd.tcl...] # # Command tkdnd::drag_source # proc tkdnd::drag_source { mode path { types {} } { event 1 } } { set tags [bindtags $path] set idx [lsearch $tags TkDND_Drag*] switch -- $mode { register { if { $idx != -1 } { bindtags $path [lreplace $tags $idx $idx TkDND_Drag$event] } else { bindtags $path [concat $tags TkDND_Drag$event] } set types [platform_specific_types $types] set old_types [bind $path DragSourceTypes] foreach type $types { if {[lsearch $old_types $type] 0} {lappend old_types $type} } bind $path DragSourceTypes $old_types } unregister { if { $idx != -1 } { bindtags $path [lreplace $tags $idx $idx] } } } };# tkdnd::drag_source [From tkdnd_windows.tcl...] # # Command olednd::_GetDragSource # proc olednd::_GetDragSource { } { variable _drag_source return $_drag_source };# olednd::_GetDragSource DISCLAIMER: This email and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful. -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I encode and decode this data to write to a file?
c...@isbd.net wrote: I am debugging some code that creates a static HTML gallery from a directory hierarchy full of images. It's this package:- https://pypi.python.org/pypi/Gallery2.py/2.0 It's basically working and does pretty much what I want so I'm happy to put some effort into it and fix things. The problem I'm currently chasing is that it can't cope with directory names that have accented characters in them, it fails when it tries to write the HTML that creates the page with the thumbnails on. The code that's failing is:- raw = os.path.join(directory, self.getNameNoExtension()) + .html file = open(raw, w) file.write(.join(html).encode('utf-8')) file.close() The variable html is a list containing the lines of HTML to write to the file. It fails when it contains accented characters (an é in this case). Here's the traceback:- Traceback (most recent call last): File /usr/local/lib/python2.7/dist-packages/gallery/galleries.py, line 41, in run self._recurse() File /usr/local/lib/python2.7/dist-packages/gallery/galleries.py, line 272, in _recurse os.path.walk(self.props[sourcedir], self.processDir, None) File /usr/lib/python2.7/posixpath.py, line 246, in walk walk(name, func, arg) File /usr/lib/python2.7/posixpath.py, line 246, in walk walk(name, func, arg) File /usr/lib/python2.7/posixpath.py, line 246, in walk walk(name, func, arg) File /usr/lib/python2.7/posixpath.py, line 238, in walk func(arg, top, names) File /usr/local/lib/python2.7/dist-packages/gallery/galleries.py, line 263, in processDir self.createGallery() File /usr/local/lib/python2.7/dist-packages/gallery/galleries.py, line 215, in createGallery self.picturemanager.createPictureHTMLs(self.footer) File /usr/local/lib/python2.7/dist-packages/gallery/picturemanager.py, line 84, in createPictureHTMLs curPic.createPictureHTML(self.galleryDirectory, self.getStylesheet(), self.fullsize, footer) File /usr/local/lib/python2.7/dist-packages/gallery/picture.py, line 361, in createPictureHTML file.write(.join(html).encode('utf-8')) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 783: ordinal not in range(128) If I understand correctly the encode() is saying that it can't understand the data in the html because there's a character 0xc3 in it. I *think* this means that the é is encoded in UTF-8 already in the incoming data stream (should be as my system is wholly UTF-8 as far as I know and I created the directory name). So how do I change the code so I don't get the error? Do I just decode() the data first and then encode() it? Note that you are getting a *UnicodeDecodeError*, not a UnicodeEncodeError. Try omitting the encode() step, i. e. instead of file.write(.join(html).encode('utf-8')) use file.write(join(html)) Background (applies to Python 2 only): the str type deals with bytes, not code points. The right thing to do is to use .decode(...) to convert from str to unicode and .encode(...) to convert from unicode to str. In Python 2 however the str type has an encode(...) method which is basically equivalent to class str: # imaginary python implementation of python2's str ... def encode(self, encoding): return self.decode(ascii).encode(encoding) and is almost never called intentionally. PS Python3 has relabeled unicode to str and thus uses unicode by default. str was renamed to bytes and the annoying bytes.encode() method is gone. -- http://mail.python.org/mailman/listinfo/python-list
Re: xml.etree.ElementTree if element does not exist?
Ombongi, however, if i pass xml data that DOES NOT contain sepid element, i get an error: Traceback (most recent call last): File /usr/local/bin/receive.py, line 21, in module sepid = content.find(.//{http://www.huawei.com.cn/schema/common/v2_1}sepid;).text AttributeError: 'NoneType' object has no attribute 'text' some messages i receive will have the sepid parameter, other will not have this parameter. How can i cater for this? kinda like an if .. else implementation for xml.etree.ElementTree ? What about simply testing whether the value returned by find is None? For example: $ cat test.py from xml.etree import ElementTree myTree = ElementTree.fromstring('test /') myElement = myTree.find('orange') if myElement is None: print 'tree does not contain a child element orange' else: print myElement.text $ python test.py tree does not contain a child element orange HTH, Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I encode and decode this data to write to a file?
On 04/29/2013 05:47 AM, c...@isbd.net wrote: A couple of generic comments: your email program made a mess of the traceback by appending each source line to the location information. Please mention your Python version OS. Apparently you're running 2.7 on Linux or similar. I am debugging some code that creates a static HTML gallery from a directory hierarchy full of images. It's this package:- https://pypi.python.org/pypi/Gallery2.py/2.0 It's basically working and does pretty much what I want so I'm happy to put some effort into it and fix things. The problem I'm currently chasing is that it can't cope with directory names that have accented characters in them, it fails when it tries to write the HTML that creates the page with the thumbnails on. The code that's failing is:- raw = os.path.join(directory, self.getNameNoExtension()) + .html file = open(raw, w) file.write(.join(html).encode('utf-8')) You can't encode byte data, it's already encoded. So you're forcing the Python system to implicitly decode it (using ASCII codec) before letting you encode it to utf-8. If you think it's already in utf-8, then omit the encode() call there. Additionally, you can debug things with some simple print statements, at least if you decompose your 3-function line so you can get at the intermediate data. Split the line into three parts; temp1 = .join(html) #temp1 is byte data temp2 = temp1.decode()#temp2 is unicode data temp3 = temp2.encode(utf-8) #temp3 is byte data again file.write(temp3) Now, you'll presumably get the error on the second line, so examine the bytes around byte 783. Make sure it's really in utf-8, and if it is, then skip the decode and the encode. If it's not, then Andrew's advice is pertinent. I would also look at the variable html. It's a list, but what are the types of the elements in it? file.close() The variable html is a list containing the lines of HTML to write to the file. It fails when it contains accented characters (an é in this case). Here's the traceback:- Traceback (most recent call last): File /usr/local/lib/python2.7/dist-packages/gallery/galleries.py, line 41, in run self._recurse() File /usr/local/lib/python2.7/dist-packages/gallery/galleries.py, line 272, in _recurse os.path.walk(self.props[sourcedir], self.processDir, None) File /usr/lib/python2.7/posixpath.py, line 246, in walk walk(name, func, arg) File /usr/lib/python2.7/posixpath.py, line 246, in walk walk(name, func, arg) File /usr/lib/python2.7/posixpath.py, line 246, in walk walk(name, func, arg) File /usr/lib/python2.7/posixpath.py, line 238, in walk func(arg, top, names) File /usr/local/lib/python2.7/dist-packages/gallery/galleries.py, line 263, in processDir self.createGallery() File /usr/local/lib/python2.7/dist-packages/gallery/galleries.py, line 215, in createGallery self.picturemanager.createPictureHTMLs(self.footer) File /usr/local/lib/python2.7/dist-packages/gallery/picturemanager.py, line 84, in createPictureHTMLs curPic.createPictureHTML(self.galleryDirectory, self.getStylesheet(), self.fullsize, footer) File /usr/local/lib/python2.7/dist-packages/gallery/picture.py, line 361, in createPictureHTML file.write(.join(html).encode('utf-8')) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 783: ordinal not in range(128) If I understand correctly the encode() is saying that it can't understand the data in the html because there's a character 0xc3 in it. I *think* this means that the é is encoded in UTF-8 already in the incoming data stream (should be as my system is wholly UTF-8 as far as I know and I created the directory name). So how do I change the code so I don't get the error? Do I just decode() the data first and then encode() it? -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: xml.etree.ElementTree if element does not exist?
Hi Stefan, Group Thanks for the thumbs up. Worked perfectly. Saludos Ombongi Moraa Faith On 29 April 2013 14:22, Stefan Holdermans ste...@vectorfabrics.com wrote: Ombongi, however, if i pass xml data that DOES NOT contain sepid element, i get an error: Traceback (most recent call last): File /usr/local/bin/receive.py, line 21, in module sepid = content.find(.//{ http://www.huawei.com.cn/schema/common/v2_1}sepid;).text AttributeError: 'NoneType' object has no attribute 'text' some messages i receive will have the sepid parameter, other will not have this parameter. How can i cater for this? kinda like an if .. else implementation for xml.etree.ElementTree ? What about simply testing whether the value returned by find is None? For example: $ cat test.py from xml.etree import ElementTree myTree = ElementTree.fromstring('test /') myElement = myTree.find('orange') if myElement is None: print 'tree does not contain a child element orange' else: print myElement.text $ python test.py tree does not contain a child element orange HTH, Stefan -- http://mail.python.org/mailman/listinfo/python-list
Re: Shear image (numpy.ndarray)
Yes, I already find that scipy.ndimage.interpolation.affine_transform will solve this (but thank you Robert anyway!). Just for others (if somebody will find this thread): The 'matrix' parameter is transformation matrix for shear transformation. For more detailes see: http://en.wikipedia.org/wiki/Shear_matrix Radek -- http://mail.python.org/mailman/listinfo/python-list
Re: xml.etree.ElementTree if element does not exist?
On 2013-04-29, Ombongi Moraa Fe moraa.lovetak...@gmail.com wrote: Good Afternoon, Among other elements values that my script finds is value for sepid sepid = content.find(.//{http://www.huawei.com.cn/schema/common/v2_1}sepid ).text however, if i pass xml data that DOES NOT contain sepid element, i get an error: Traceback (most recent call last): File /usr/local/bin/receive.py, line 21, in module sepid = content.find(.//{ http://www.huawei.com.cn/schema/common/v2_1}sepid;).text AttributeError: 'NoneType' object has no attribute 'text' find returns None when it doesn't find what you asked for. So you can't check the .text attribute right away unless you want an exception thrown. I deal with these annoyances like this: sepelem = content.find(.//{http://www.huawei.com.cn/schema/common/v2_1}sepid;) if sepelem is not None: sepid = sepid.text else: sepid = '' The empty string works for my purposes. Your script might need something else. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Re: [pyxl] Re: xlrd 0.9.2 released!
On 2013-04-29, Chris Withers ch...@simplistix.co.uk wrote: There aren't any, because there are no changes. Applications written for 0.6.x will still work without change when using 0.9.2. The Python 3 support is greatly appreciated. I've started using the xlrd package recently, and it's made the life of a few of my coworkers incrementally easier. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Re: xml.etree.ElementTree if element does not exist?
On 2013-04-29, Neil Cerutti ne...@norwich.edu wrote: find returns None when it doesn't find what you asked for. So you can't check the .text attribute right away unless you want an exception thrown. I deal with these annoyances like this: sepelem = content.find(.//{http://www.huawei.com.cn/schema/common/v2_1}sepid;) if sepelem is not None: sepid = sepid.text Oops. One edit too fiew. That line should of course be sepid = sepelem.text else: sepid = '' The empty string works for my purposes. Your script might need something else. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I encode and decode this data to write to a file?
Andrew Berg bahamutzero8...@gmail.com wrote: On 2013.04.29 04:47, c...@isbd.net wrote: If I understand correctly the encode() is saying that it can't understand the data in the html because there's a character 0xc3 in it. I *think* this means that the é is encoded in UTF-8 already in the incoming data stream (should be as my system is wholly UTF-8 as far as I know and I created the directory name). You can verify that your filesystem is set to use UTF-8 with sys.getfilesystemencoding(). If it returns 'ascii', then your locale settings are incorrect. chris$ python Python 2.7.3 (default, Sep 26 2012, 21:51:14) [GCC 4.7.2] on linux2 Type help, copyright, credits or license for more information. import sys sys.getfilesystemencoding() 'UTF-8' So I am set up right for UTF-8. -- Chris Green -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I encode and decode this data to write to a file?
Dave Angel da...@davea.name wrote: On 04/29/2013 05:47 AM, c...@isbd.net wrote: A couple of generic comments: your email program made a mess of the traceback by appending each source line to the location information. What's me email program got to do with it? :-) I'm using a dedicated newsreader (tin) as I posted via the gmane/usenet interface. The posting looks perfectly OK to me when I read it back from usenet. Please mention your Python version OS. Apparently you're running 2.7 on Linux or similar. Sorry, yes you're spot on. I am debugging some code that creates a static HTML gallery from a directory hierarchy full of images. It's this package:- https://pypi.python.org/pypi/Gallery2.py/2.0 It's basically working and does pretty much what I want so I'm happy to put some effort into it and fix things. The problem I'm currently chasing is that it can't cope with directory names that have accented characters in them, it fails when it tries to write the HTML that creates the page with the thumbnails on. The code that's failing is:- raw = os.path.join(directory, self.getNameNoExtension()) + .html file = open(raw, w) file.write(.join(html).encode('utf-8')) You can't encode byte data, it's already encoded. So you're forcing the Python system to implicitly decode it (using ASCII codec) before letting you encode it to utf-8. If you think it's already in utf-8, then omit the encode() call there. It's the way the code was as I installed it from pypi. What you say makes a lot of sense though, I'll remove the encode(). Additionally, you can debug things with some simple print statements, at least if you decompose your 3-function line so you can get at the intermediate data. Split the line into three parts; temp1 = .join(html) #temp1 is byte data temp2 = temp1.decode()#temp2 is unicode data temp3 = temp2.encode(utf-8) #temp3 is byte data again file.write(temp3) OK, thanks for this and all the other advice on this thread. -- Chris Green -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I encode and decode this data to write to a file?
On 2013-04-29 13:59, c...@isbd.net wrote: Dave Angel da...@davea.name wrote: On 04/29/2013 05:47 AM, c...@isbd.net wrote: A couple of generic comments: your email program made a mess of the traceback by appending each source line to the location information. What's me email program got to do with it? :-) I'm using a dedicated newsreader (tin) as I posted via the gmane/usenet interface. The posting looks perfectly OK to me when I read it back from usenet. FWIW, I see the same problem Dave sees. I'm using gmane via Thunderbird. -- Robert Kern I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth. -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I encode and decode this data to write to a file?
Robert Kern robert.k...@gmail.com wrote: On 2013-04-29 13:59, c...@isbd.net wrote: Dave Angel da...@davea.name wrote: On 04/29/2013 05:47 AM, c...@isbd.net wrote: A couple of generic comments: your email program made a mess of the traceback by appending each source line to the location information. What's me email program got to do with it? :-) I'm using a dedicated newsreader (tin) as I posted via the gmane/usenet interface. The posting looks perfectly OK to me when I read it back from usenet. FWIW, I see the same problem Dave sees. I'm using gmane via Thunderbird. How strange. I think it must be something to do with the gmane interface between news and mail then. -- Chris Green -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I encode and decode this data to write to a file?
How strange. I think it must be something to do with the gmane interface between news and mail then. Probably. It was borked in Gmail as well... Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: Unwanted window spawns when using Tkinter with multiprocessing.
My full code is : #Import from tkinter import * import wave import winsound import multiprocessing #Initialisation fenetre=Tk() frame = Frame(fenetre, width=200, height=100) instance = 'Instance' #Fonctions def key(event): instance = 'Instance' hitkey = event.char instance = multiprocessing.Process(target=player, args=(hitkey,)) instance.start() def player(hitkey): winsound.PlaySound(hitkey + '.wav', winsound.SND_FILENAME|winsound.SND_NOWAIT|winsound.SND_ASYNC) #TK frame.focus_set() frame.bind(Key, key) frame.pack() fenetre.mainloop() The problem is that I don't know where to put that clause. -- http://mail.python.org/mailman/listinfo/python-list
Re: Unwanted window spawns when using Tkinter with multiprocessing.
On 29/04/2013 16:31, alternativ...@rocketmail.com wrote: My full code is : #Import from tkinter import * import wave import winsound import multiprocessing #Initialisation fenetre=Tk() frame = Frame(fenetre, width=200, height=100) instance = 'Instance' #Fonctions def key(event): instance = 'Instance' hitkey = event.char instance = multiprocessing.Process(target=player, args=(hitkey,)) instance.start() def player(hitkey): winsound.PlaySound(hitkey + '.wav', winsound.SND_FILENAME|winsound.SND_NOWAIT|winsound.SND_ASYNC) #TK frame.focus_set() frame.bind(Key, key) frame.pack() fenetre.mainloop() The problem is that I don't know where to put that clause. I hope this helps: #Import from tkinter import * import wave import winsound import multiprocessing #Fonctions def key(event): instance = 'Instance' hitkey = event.char instance = multiprocessing.Process(target=player, args=(hitkey,)) instance.start() def player(hitkey): winsound.PlaySound(hitkey + '.wav', winsound.SND_FILENAME|winsound.SND_NOWAIT|winsound.SND_ASYNC) if __name__ == __main__: # This part will be run if the file is run as the main script. # # The multiprocessing module will import this file to run the # player function, but __name__ won't be __main__ when it does # so, therefore this bit of code won't be run. #Initialisation fenetre = Tk() frame = Frame(fenetre, width=200, height=100) instance = 'Instance' #TK frame.focus_set() frame.bind(Key, key) frame.pack() fenetre.mainloop() -- http://mail.python.org/mailman/listinfo/python-list
Can read in the BMP data correctly ,but the size is not right?
I'm trying to read in the BMP data by the the code below,and I'm check the data array with WINHEX,and it is correct,but which confuse me is why the size is 0x180,but the actual picture should be 48*48 = 0x120 bytes because I use 1-bit BMP not the 24bit BMP,could any one give some hints? __Head_Info = [ [ 'Type' ,0 , 2],#BM [ 'FSize',2 , 4],#File Size [ 'Reserved' ,6 , 4],#0x [ 'OffBits' ,10 , 4],#Offset of Image [ 'SSize',14 , 4],# 40 [ 'Width',18 , 4],#Width [ 'Height' ,22 , 4],#Hight [ 'Planes' ,26 , 2],#1 [ 'BitCount' ,28 , 2],#{1,2,4,8,24} [ 'Compress' ,30 , 4],#0 [ 'SizeImage',34 , 4],#Bytes Per Line [ 'XPM' ,38 , 4],#2835 [ 'YPM' ,42 , 4],#2835 [ 'ClrUsed' ,46 , 4],#0 [ 'ClrImportant' ,50 , 4]#0 ] _Type =0; _FSize =1; _Reserved =2; _OffBits =3; _SSize =4; _Width =5; _Height=6; _Planes=7; _BitCount =8; _Compress =9; _SizeImage =10; _XPM =11; _YPM =12; _ClrUsed =13; _ClrImportant =14; def __getInt( b, idx): return binToInt(b,__Head_Info[idx][1],__Head_Info[idx][2]) def saveMatrixtoASC(bmpfilename,ascfilename): try: handle1=open( bmpfilename ,rb) raw = bytearray(handle1.read( )) handle1.close except Exception as E: return error:+ str(E), datastart=__getInt(raw, _OffBits) datasize =__getInt(raw, _SizeImage) print ('Image Offset = 0x%X'%datastart) print ('Image Size = 0x%X'%datasize) handle2=open( ascfilename ,w) for i in range(0,datasize): handle2.write('0x%02X,'%raw[datastart+i]) if (i+1) % 16 == 0 : handle2.write(\n) handle2.close -- http://mail.python.org/mailman/listinfo/python-list
Re: Unwanted window spawns when using Tkinter with multiprocessing.
It definetly helped, windows don't pop up anymore, but now it doesn't make any sound anymore. Could it be because of a local (non-global) variable ? -- http://mail.python.org/mailman/listinfo/python-list
Re: Unwanted window spawns when using Tkinter with multiprocessing.
On Tue, Apr 30, 2013 at 3:32 AM, alternativ...@rocketmail.com wrote: It definetly helped, windows don't pop up anymore, but now it doesn't make any sound anymore. Could it be because of a local (non-global) variable ? Did you read what I linked you to? There are rules to using multiprocessing; more of them on Windows. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Can read in the BMP data correctly ,but the size is not right?
On Tue, Apr 30, 2013 at 3:20 AM, Jimmie He jimmie...@gmail.com wrote: handle1.close I haven't looked at the rest of the code, but be careful of this: You aren't actually *calling* this function. That might be your problem and it might not, but try fixing it (add the parentheses, even though there's nothing to put in them) and see if that helps. Same with the handle2.close at the end. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Can read in the BMP data correctly ,but the size is not right?
Jimmie He wrote: I'm trying to read in the BMP data by the the code below,and I'm check the data array with WINHEX,and it is correct,but which confuse me is why the size is 0x180,but the actual picture should be 48*48 = 0x120 bytes because I use 1-bit BMP not the 24bit BMP,could any one give some hints? According to wikipedia http://en.wikipedia.org/wiki/BMP_file_format The size of each row is rounded up to a multiple of 4 bytes [...] So 48/8 == 6 will be rounded to 8, and 8*48 == 384 == 0x180. handle1=open( bmpfilename ,rb) raw = bytearray(handle1.read( )) handle1.close To actually do something the last line should be handle1.close(). I recommend with open(bmpfilename ,rb) as handle1: raw = bytearray(handle1.read()) instead which has the additional advantage that the file will be closed if an exception occurs in the with-suite. -- http://mail.python.org/mailman/listinfo/python-list
Re: Can read in the BMP data correctly ,but the size is not right?
On 29/04/2013 18:20, Jimmie He wrote: I'm trying to read in the BMP data by the the code below,and I'm check the data array with WINHEX,and it is correct,but which confuse me is why the size is 0x180,but the actual picture should be 48*48 = 0x120 bytes because I use 1-bit BMP not the 24bit BMP,could any one give some hints? [snip] What size is 0x180? If you're asking why the file size is 0x180 and not 0x120, it's simply because of the header. An image file contains not just the pixels of the image, but also information about the image. -- http://mail.python.org/mailman/listinfo/python-list
Re: Can read in the BMP data correctly ,but the size is not right?
Jimmie He於 2013年4月30日星期二UTC+8上午1時20分49秒寫道: I'm trying to read in the BMP data by the the code below,and I'm check the data array with WINHEX,and it is correct,but which confuse me is why the size is 0x180,but the actual picture should be 48*48 = 0x120 bytes because I use 1-bit BMP not the 24bit BMP,could any one give some hints? __Head_Info = [ [ 'Type' ,0 , 2],#BM [ 'FSize',2 , 4],#File Size [ 'Reserved' ,6 , 4],#0x [ 'OffBits' ,10 , 4],#Offset of Image [ 'SSize',14 , 4],# 40 [ 'Width',18 , 4],#Width [ 'Height' ,22 , 4],#Hight [ 'Planes' ,26 , 2],#1 [ 'BitCount' ,28 , 2],#{1,2,4,8,24} [ 'Compress' ,30 , 4],#0 [ 'SizeImage',34 , 4],#Bytes Per Line [ 'XPM' ,38 , 4],#2835 [ 'YPM' ,42 , 4],#2835 [ 'ClrUsed' ,46 , 4],#0 [ 'ClrImportant' ,50 , 4]#0 ] _Type =0; _FSize =1; _Reserved =2; _OffBits =3; _SSize =4; _Width =5; _Height=6; _Planes=7; _BitCount =8; _Compress =9; _SizeImage =10; _XPM =11; _YPM =12; _ClrUsed =13; _ClrImportant =14; def __getInt( b, idx): return binToInt(b,__Head_Info[idx][1],__Head_Info[idx][2]) def saveMatrixtoASC(bmpfilename,ascfilename): try: handle1=open( bmpfilename ,rb) raw = bytearray(handle1.read( )) handle1.close except Exception as E: return error:+ str(E), datastart=__getInt(raw, _OffBits) datasize =__getInt(raw, _SizeImage) print ('Image Offset = 0x%X'%datastart) print ('Image Size = 0x%X'%datasize) handle2=open( ascfilename ,w) for i in range(0,datasize): handle2.write('0x%02X,'%raw[datastart+i]) if (i+1) % 16 == 0 : handle2.write(\n) handle2.close The start of each line of bytes must be in the 32 bit=4byte boundary in the MS BMP format. Please read the MS specs. -- http://mail.python.org/mailman/listinfo/python-list
Re: Unwanted window spawns when using Tkinter with multiprocessing.
Yeah I did, but I globalized my variables, I've got only functions, and not methods, and my clause seems to work so I don't know why it doesn't work. -- http://mail.python.org/mailman/listinfo/python-list
Mystery of module bindings!
This must be a trivial question: I have import numpy as np in the python startup file. A file called mod1.py contains def myfn... and inside myfn there is a call to, say, np.convolve. Interactively: python (numpy imported as np) import mod1 mod1.myfn(...) Error: global name np is not known. === Why is np not known to functions in an imported module ? === I can fix this by including import numpy as np in any module that uses numpy functions -- but then what is the point of having a startup file? -- PeterR -- http://mail.python.org/mailman/listinfo/python-list
Re: Mystery of module bindings!
On Mon, 29 Apr 2013 12:30:29 -0700, Peter Rowat wrote: This must be a trivial question: I have import numpy as np in the python startup file. That only runs interactively. It does not run when you execute a script. A file called mod1.py contains def myfn... and inside myfn there is a call to, say, np.convolve. Interactively: python (numpy imported as np) import mod1 mod1.myfn(...) Error: global name np is not known. === Why is np not known to functions in an imported module ? === Let's suppose it was. What would that mean? Look inside mod1, where there might be a function spam(), and also another function eggs(). spam() calls eggs(), it sees the eggs function in the same module, and all is well with the world. Then you add to the startup file: def eggs(): return Something unexpected and all of a sudden mod1.spam() breaks, because it now sees *your* eggs() instead of its eggs. This would be a bad, bad thing. This is why modules are their own namespace, and the interactive interpreter is its own, independent, namespace. What happens in the interactive interpreter stays in the interactive interpreter, without stomping all over every other module. I can fix this by including import numpy as np in any module that uses numpy functions -- but then what is the point of having a startup file? The point of the startup file is to add things to the interactive interpreter's module, not to inject things into every module in sight. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Mystery of module bindings!
On 4/29/2013 3:30 PM, Peter Rowat wrote: This must be a trivial question: I have import numpy as np in the python startup file. A file called mod1.py contains def myfn... and inside myfn there is a call to, say, np.convolve. Interactively: python (numpy imported as np) import mod1 mod1.myfn(...) Error: global name np is not known. === Why is np not known to functions in an imported module ? === I can fix this by including import numpy as np in any module that uses numpy functions -- but then what is the point of having a startup file? The startup file is only for interactive use. Python programs in files shouldn't depend on a startup file, as it will limit their portability. In an interactive session, it's helpful to save some typing, but you can use explicit imports in programs, as they only need to be typed once, and will be used many more times. --Ned. -- PeterR -- http://mail.python.org/mailman/listinfo/python-list
Re: Mystery of module bindings!
On 04/29/2013 03:30 PM, Peter Rowat wrote: This must be a trivial question: I have import numpy as np in the python startup file. A file called mod1.py contains def myfn... and inside myfn there is a call to, say, np.convolve. Interactively: python (numpy imported as np) import mod1 mod1.myfn(...) Error: global name np is not known. === Why is np not known to functions in an imported module ? === I can fix this by including import numpy as np in any module that uses numpy functions Yes, you need a separate import from any module that references numpy. Don't worry about performance, subsequent imports do not take noticeable time, since the module objects are cached. Any time you want to use a symbol from another module, you have to get it somehow. into your own module. You do not have to get it from the import statement, but it's certainly the simplest way, and the way that's usually clearest. Each module represents a namespace, and except for the global namespace which is handled specially, you have to describe which ones you want access to. It's a feature, not a limitation. There are lots of modules automatically imported indirectly by the ones you use. A quick test on a local copy of Python 3.3 shows 51 modules imported before I write any code. I certainly wouldn't want all of them visible in my script's namespace. -- but then what is the point of having a startup file? Presumably by startup file, you mean script. Without a script, Python wouldn't have any idea what code to run. You import a few modules, use functionality from them, and lots of things happen behind the scenes. Fortunately for all of us, Python doesn't throw all the symbols into one big pile. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Mystery of module bindings!
On 04/29/2013 04:03 PM, Dave Angel wrote: Please ignore my previous response, obviously I misread your question entirely. I've never used a startup file, so I misread it as script file. Yes, you need a separate import from any module that references numpy. Don't worry about performance, subsequent imports do not take noticeable time, since the module objects are cached. and more blathering... -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: Drag and drop in Windows
Hi Robert, Am 29.04.13 12:25, schrieb Robert Flintham: I’ve found this (TkDND): http://wiki.tcl.tk/2768 But I don’t know how to implement this in Python. The Windows binary for it comes as a set of “.tcl” files and a single “.dll” file. 2.direct implementation of the Tcl file [tk.eval(‘source …’)], but I don’t reallu understand what’s going on with this – can you only execute a “main” bit of Tcl files rather than implementing individual functions? I can only comment on the Tcl side, since I'm not an expert in the Tkinter coupling mechanism. TkDND is indeed the way to go if you want native drag'n'drop support. The first step would indeed be to load the package into the Tcl interpreter. You need to: 1) Create a folder for the packages, put the files in a subfolder Typically, this is something like lib/tkdnd, and at that level there must be the pkgIndex.tcl file 2) Append the lib/ folder to the auto path tk.eval('lappend auto_path {mypath/lib}') (the braces are Tcl's quoting mechanism) 3) load the package tk.eval('package require tkdnd') Then, you need to register the target, i.e. declare a widget that it accepts files. Here, you need the Tk path name of the widget, which is retrieved by __str__: tk.eval('tkdnd::drop_target register ' + yourwidget +' *') Then, if you drop something, the widget recieves a virtual event Drop:DND_Files . Now this is tricky, I don't know how to bind to that event. Following the tutorial for Tcl on http://wiki.tcl.tk/36708, I suppose something like yourwidget.bind(Drop::DND_Files, filesdropped) should in principle work, but how to get the data out of it? It is stuffed into the %D bind substitution. Usual events store the MouseWheel distance in this field; so maybe you can get it from the field event.delta. I can't test it now, but I am a bit skeptical whether this works with the guts of TkInter. If not, you'd need to do some more forwarding from the Tcl side. Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: Mystery of module bindings!
On 04/29/2013 12:30 PM, Peter Rowat wrote: This must be a trivial question: I have import numpy as np in the python startup file. A file called mod1.py contains def myfn... and inside myfn there is a call to, say, np.convolve. Interactively: python (numpy imported as np) import mod1 mod1.myfn(...) Error: global name np is not known. === Why is np not known to functions in an imported module ? === I can fix this by including import numpy as np in any module that uses numpy functions -- but then what is the point of having a startup file? That fix is indeed the way things are done. Modules only know about what they import or create*. The point of the startup file is to have things ready for interactive investigation -- if you use numpy *alot* then having it already there beats the heck out of typing `import numpy as np` every time you start the interpreter. -- ~Ethan~ *Unless you start playing with injection and stuff. -- http://mail.python.org/mailman/listinfo/python-list
Re: Unwanted window spawns when using Tkinter with multiprocessing.
On Tue, Apr 30, 2013 at 4:44 AM, alternativ...@rocketmail.com wrote: Yeah I did, but I globalized my variables, I've got only functions, and not methods, and my clause seems to work so I don't know why it doesn't work. I don't know what you mean by your clause, and I think we have a language barrier here. (Though your English is *way* better than my French.) But for a simple rule of thumb, the only things you should have flush left are def and class statements, and the one if that checks __name__. Everything else should be indented. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I encode and decode this data to write to a file?
On 4/29/2013 5:47 AM, c...@isbd.net wrote: case). Here's the traceback:- File /usr/local/lib/python2.7/dist-packages/gallery/picture.py, line 361, in createPictureHTML file.write(.join(html).encode('utf-8')) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 783: ordinal not in range(128) Generiric advice for anyone getting unicode errors: unpack the composition producing the error so that one can see which operation produced it. In this case s = .join(html)\ s = s.encode('utf-8') file.write(s) This also makes it possible to print intermediate results. print(type(s), s) # would have been useful Doing so would have immediately shown that in this case the error was the encode operation, because s was already bytes. For many other posts, the error with the same type of message has been the print or write operation, do to output encoding issues, but that was not the case here. -- http://mail.python.org/mailman/listinfo/python-list
repeat program
How do I make the following program repeat twice instead of asking whether the player wants to play again? import random import time def intro(): print('You spot 2 caves in the distance.') print ('You near 2 cave entrances..') time.sleep(1) print('You proceed even nearer...') time.sleep(1) def choosecave(): cave='' while cave!='1' and cave !='2': print('which cave?(1 or 2)') cave=input() return cave def checkcave(chosencave): friendlycave=random.randint(1,2) if chosencave==str(friendlycave): print ('you win') else: print('you lose') playagain='yes' while playagain=='yes': intro() cavenumber=choosecave() checkcave(cavenumber) print('wanna play again?(yes no)') playagain=input() Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list
Re: repeat program
On 04/29/2013 08:22 PM, eschneide...@comcast.net wrote: How do I make the following program repeat twice instead of asking whether the player wants to play again? Turn it into a function call, and call that function twice from top-level. Or, more generally, for i in range(2): doit() import random import time def intro(): print('You spot 2 caves in the distance.') print ('You near 2 cave entrances..') time.sleep(1) print('You proceed even nearer...') time.sleep(1) def choosecave(): cave='' while cave!='1' and cave !='2': print('which cave?(1 or 2)') cave=input() return cave def checkcave(chosencave): friendlycave=random.randint(1,2) if chosencave==str(friendlycave): print ('you win') else: print('you lose') playagain='yes' while playagain=='yes': intro() cavenumber=choosecave() checkcave(cavenumber) print('wanna play again?(yes no)') playagain=input() Thanks in advance. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
Re: repeat program
On 30/04/2013 01:22, eschneide...@comcast.net wrote: How do I make the following program repeat twice instead of asking whether the player wants to play again? import random import time def intro(): print('You spot 2 caves in the distance.') print ('You near 2 cave entrances..') time.sleep(1) print('You proceed even nearer...') time.sleep(1) def choosecave(): cave='' while cave!='1' and cave !='2': print('which cave?(1 or 2)') cave=input() return cave def checkcave(chosencave): friendlycave=random.randint(1,2) if chosencave==str(friendlycave): print ('you win') else: print('you lose') playagain='yes' while playagain=='yes': intro() cavenumber=choosecave() checkcave(cavenumber) print('wanna play again?(yes no)') playagain=input() Thanks in advance. Replace the 'while' loop with a 'for' loop that loops twice. By the way, there's a bug in 'choosecave': what happens if the user enters, say, '3'? -- http://mail.python.org/mailman/listinfo/python-list
Re: repeat program
On Mon, 29 Apr 2013 17:22:28 -0700, eschneider92 wrote: How do I make the following program repeat twice instead of asking whether the player wants to play again? You change something in the folowing two lines: playagain='yes' while playagain=='yes': What you change and how you change it is probably your homework task, so I really shouldn't tell you any more than that. Also, I might not be right about where you need to make the change, but hey, this is the internet, it must be right, yeah? -- Denis McMahon, denismfmcma...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Unwanted window spawns when using Tkinter with multiprocessing.
I thought 'clause' was reffering to the 'if __name__ == __main__:' thing in English, but apparently not. Well except the import and the 'globalization' of my variables, every thing is idented. -- http://mail.python.org/mailman/listinfo/python-list
Re: repeat program
On Mon, Apr 29, 2013 at 6:43 PM, MRAB pyt...@mrabarnett.plus.com wrote: By the way, there's a bug in 'choosecave': what happens if the user enters, say, '3'? Then they lose. :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Unwanted window spawns when using Tkinter with multiprocessing.
On 04/29/2013 09:17 PM, alternativ...@rocketmail.com wrote: I thought 'clause' was reffering to the 'if __name__ == __main__:' thing in English, but apparently not. Well except the import and the 'globalization' of my variables, every thing is idented. No clue whom you think you're replying to, but all your replies so far are appearing in the thread as replies to your OP. Please use a little context from the message you think you're responding to, so we have an idea what you're talking about. Did you ever see MRAB's message, where he told you exactly what the change requested was? if __name__ == __main__: # This part will be run if the file is run as the main script. # # The multiprocessing module will import this file to run the # player function, but __name__ won't be __main__ when it does # so, therefore this bit of code won't be run. #Initialisation fenetre = Tk() frame = Frame(fenetre, width=200, height=100) instance = 'Instance' #TK frame.focus_set() frame.bind(Key, key) frame.pack() fenetre.mainloop() All of those lines were at the left margin in your earlier posted code, and you give us no reason to expect you've made them conditional. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list
[issue16142] ArgumentParser inconsistent with parse_known_args
paul j3 added the comment: Correction: The patch I gave in the last message produces: parser.parse_known_args(['-ku']) (Namespace(known=False), ['u']) It doesn't take action on the '-k', and puts 'u' in extras, not '-u'. This new patch gets it right: parser.parse_known_args(['-ku']) (Namespace(known=True), ['-u']) We need more test cases, including ones that work as expected with optparse or other unix parsers. -- Added file: http://bugs.python.org/file30056/dashku.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16142 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16631] tarfile.extractall() doesn't extract everything if .next() was used
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka versions: -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16631 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17865] PowerPC exponentiation and round() interaction
Serhiy Storchaka added the comment: I can't reproduce this on 2.7.4. Could you please test 2.7.4? -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17865 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17865] PowerPC exponentiation and round() interaction
Changes by Mark Dickinson dicki...@gmail.com: -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17865 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17865] PowerPC exponentiation and round() interaction
Mark Dickinson added the comment: Hmm: it's not an obvious Python bug, either: both math.exp and math.ceil are simple wrappers around the libm functions, so there's little room for things to go wrong between Python and the OS. Are you in a position to compile Python from source on your platform? What was the equivalent C program you tried? What's the compiler on this platform? Note that gcc (I believe) evaluates math function calls for constants at compile time (using MPFR), rather than run time, which would mean if your C program simply does exp(-2.0); then it's not even using the OS libm. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17865 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17864] IDLE won't run
Ben Read added the comment: I've tried this and it looks like write access is already enabled, but I entered the commands you listed all the same - here's the output: Bens-iMac:~ ben$ cd Bens-iMac:~ ben$ ls -lde drwxr-xr-x 28 temp staff 952 28 Apr 18:46 . Bens-iMac:~ ben$ mkdir /.idlerc mkdir: /.idlerc: Permission denied Bens-iMac:~ ben$ chmod u+w usage: chmod [-fhv] [-R [-H | -L | -P]] [-a | +a | =a [i][# [ n]]] mode|entry file ... chmod [-fhv] [-R [-H | -L | -P]] [-E | -C | -N | -i | -I] file ... Bens-iMac:~ ben$ mkdir /.idlerc mkdir: /.idlerc: Permission denied On 28 Apr 2013, at 23:43, Ned Deily rep...@bugs.python.org wrote: Ned Deily added the comment: That's really odd. It looks you have a permissions problem with your home directory. On startup, IDLE attempts to create the directory .idlerc in your home directory, /Users/ben, if it doesn't exist already. If for some reason the directory creation fails, IDLE aborts. Interestingly, if the directory exists but IDLE lacks write permission to create files in it, it does not abort but posts a warning message in a window. Perhaps it could be a little more consistent about that. But still, this appears to be avery unusual situation. I can't think of any reason why IDLE would be unable to create a directory unless you have some security system installed or some unusual access control list setting. The most likely reason is just a plain old permission problem on your home directory. Try this in a terminal session: cd ~ ls -lde ~ You should see something similar to this: drwxr-xr-x+ 38 nad staff 2992 Apr 28 15:26 /Users/nad/ 0: group:everyone deny delete if the permissions string is missing the w (dr-xr-x), that means you do not have write permission to your home directory and can't create new directories there. In that case, mkdir ~/.idlerc should fail. (This is essentially what IDLE is trying to do.) If you are missing write permission on your home directory, you *should* be able to fix it by doing: chmod u+w ~ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17864 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17864 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17865] PowerPC exponentiation and round() interaction
Serhiy Storchaka added the comment: Oh, sorry, I missed PowerPC. Please ignore my previous comment. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17865 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11632] difflib.unified_diff loses context
Miguel Latorre added the comment: This bug is still present in python 2.7.4 and python 3.3.1. I attach another example, the result differs depending on number of lines to process (see test.py). -- nosy: +mal versions: +Python 2.7, Python 3.3 Added file: http://bugs.python.org/file30057/test.zip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11632 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17865] PowerPC exponentiation and round() interaction
Ellen Wang added the comment: OK. My bad. I should have been tipped off that the program didn't need -lm to link. Output from C code: 0.135335 1 0.239022 Feel free to close. I'll have to look into this on my own. Thanks and sorry. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17865 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17866] TestCase.assertItemsEqual exists in 2.7, not in 3.3
New submission from Ronald Oussoren: assertItemsEqual was added to unittest.TestCase in Python 2.7 (according to the documentation), but is not present in Python 3.3. I'd expect it to be present in 3.3 as well, or for it to be mentioned in documentation as not being present (either in the 2.7 documentation or the Misc/NEWS file for py3k) -- components: Library (Lib) messages: 188045 nosy: ronaldoussoren priority: normal severity: normal status: open title: TestCase.assertItemsEqual exists in 2.7, not in 3.3 versions: Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17866 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17866] TestCase.assertItemsEqual exists in 2.7, not in 3.3
Ezio Melotti added the comment: I don't remember how it went exactly, but there were a few similar methods (assertItemsEqual, assertSameElements, assertCountEqual). In 3.x we eventually decide to remove the first 2 because it wasn't clear what they were doing, and only assertCountEqual survived. In 2.7 this wasn't possible, so assertItemsEqual survived. assertDictContainsSubset is another method that was in 2.7 but is not in 3.x anymore. Do you think the docs for 2.x should mention this? -- assignee: - docs@python components: +Documentation nosy: +docs@python, ezio.melotti type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17866 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17866] TestCase.assertItemsEqual exists in 2.7, not in 3.3
Ronald Oussoren added the comment: I do think this should be mentioned in the 2.7 docs, assertDictContainsSubset is mentioned as deprecated since 3.2 in the 2.7 docs. The only problem with that is that there doesn't seem to be a versionremoved directive in sphinx, the best alternative seems to be deprecated-removed. I'm not to happy about the removal though, assertCountEqual is not in 2.7 which means it is unnecessarily hard to port tests from 2.7 to 3.3. I also don't quite understand the difference between assertCountEqual and assetItemsEqual, the documentation for the two (in the 3.3 and 2.7 docs) appears to indicate they have the same behavior (both assert that two sequence have the same contents when the order of items is ignored). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17866 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17865] PowerPC exponentiation and round() interaction
Mark Dickinson added the comment: No problem; thanks for the update. By the way, if you do file an OS bug report of some form, it would be great if you could add a link to this issue. That might help anyone who encounters this in Python in the future. Closing. -- resolution: - works for me status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17865 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17866] TestCase.assertItemsEqual exists in 2.7, not in 3.3
Changes by Florent Xicluna florent.xicl...@gmail.com: -- nosy: +flox ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17866 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17866] TestCase.assertItemsEqual exists in 2.7, not in 3.3
Ezio Melotti added the comment: I think they might actually be the same (i.e. the name changed but not the implementation). See #10242. If this is true the new name could be mentioned in 2.7. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17866 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10242] unittest's assertItemsEqual() method makes too many assumptions about its input
Changes by Florent Xicluna florent.xicl...@gmail.com: -- nosy: +flox ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10242 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17849] Missing size argument in readline() method for httplib's class LineAndFileWrapper
Miroslav Stampar added the comment: This trivial patch solved the issue (reported back by user): def _(self, *args): return self._readline() httplib.LineAndFileWrapper._readline = httplib.LineAndFileWrapper.readline httplib.LineAndFileWrapper.readline = _ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17849 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17866] TestCase.assertItemsEqual exists in 2.7, not in 3.3
Ronald Oussoren added the comment: You're right, according to #10242 the method was renamed in 3.2. Something like the attached patch? I'm somewhat flabbergasted that #10242 came to the conclusion that it would be a good idea to rename this method, given the folks that contributed the discussion. It not that the new name is very good, I've seen it in the 3.3 docs and didn't notice that it was relevant for what I was trying to do until you mentioned the method and I actually read the description. When I first saw the method I thought it was related to list.count. -- Added file: http://bugs.python.org/file30058/issue17866.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17866 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17866] TestCase.assertItemsEqual exists in 2.7, not in 3.3
Ezio Melotti added the comment: Apparently assertItemsEqual was added to 2.7 and 3.2 and, after the release of 2.7 but before the release of 3.2, assertItemsEqual has been renamed assertCountEqual (596239da3db7) and initially the assertItemsEqual was available too. However, since the method was new in 3.2 the old alias got removed shortly after (bdd57841f5e2). Eventually 3.2 was released with only assertCountEqual. -- keywords: +patch Added file: http://bugs.python.org/file30059/issue17866.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17866 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17866] TestCase.assertItemsEqual exists in 2.7, not in 3.3
Ezio Melotti added the comment: Looks like we wrote a similar patch at the same time :) We don't usually use versionchanged in the 2.x docs for things that changed in 3.x. Using named instead of renamed is better, since in 3.x the name was assertCountEqual since the beginning, however saying In Python 3.2 might be confusing (people might think that it's different for 3.3+). I suggest to replace it with simply Python 3, or perhaps Python 3.2+. -- Added file: http://bugs.python.org/file30060/issue17866-2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17866 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17866] TestCase.assertItemsEqual exists in 2.7, not in 3.3
Ronald Oussoren added the comment: Your patch looks good. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17866 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17866] TestCase.assertItemsEqual exists in 2.7, not in 3.3
Roundup Robot added the comment: New changeset d9921cb6e3cd by Ezio Melotti in branch '2.7': #17866: mention that in Python 3, assertItemsEqual is named assertCountEqual. http://hg.python.org/cpython/rev/d9921cb6e3cd -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17866 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17866] TestCase.assertItemsEqual exists in 2.7, not in 3.3
Ezio Melotti added the comment: Applied. -- assignee: docs@python - ezio.melotti components: -Library (Lib) resolution: - fixed stage: - committed/rejected status: open - closed versions: +Python 2.7 -Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17866 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17864] IDLE won't run
Ned Deily added the comment: The ls shows that, for some reason, your home directory is owned by user temp, not by user ben. That's not good. Try doing this: sudo chown ben /Users/ben/ But we're way past an IDLE or Python problem here. This is a basic Unix system administration issue. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17864 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17851] Grammar errors in threading.Lock documentation
Ramchandra Apte added the comment: I'm saying that they aren't valid grammar mistakes (there is no grammar mistake). I agree with Georg Brandl's comment. On 27 April 2013 20:18, Andriy Mysyk rep...@bugs.python.org wrote: Andriy Mysyk added the comment: Ramachandra, if I understand you correctly, I think what you are saying that both are grammar mistakes and the first one could addressed by adding s to block. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17851 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17851 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17867] Deleting __import__ from builtins can crash Python3
New submission from Dmi Baranov: Simple case - let's delete __import__ and try to import anything $ python3.3 Python 3.3.0 (default, Oct 7 2012, 11:03:52) [GCC 4.4.3] on linux Type help, copyright, credits or license for more information. del __builtins__.__dict__['__import__'] import os Traceback (most recent call last): File stdin, line 1, in module Fatal Python error: __import__ missing Current thread 0x7f07c9ebc700: Aborted But in python2.x $ python2.7 Python 2.7.3 (default, Sep 22 2012, 02:37:18) [GCC 4.4.3] on linux2 Type help, copyright, credits or license for more information. del __builtins__.__dict__['__import__'] import os Traceback (most recent call last): File stdin, line 1, in module ImportError: __import__ not found -- components: Interpreter Core messages: 188059 nosy: Dmi.Baranov priority: normal severity: normal status: open title: Deleting __import__ from builtins can crash Python3 type: crash versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17867 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17867] Deleting __import__ from builtins can crash Python3
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +brett.cannon, ezio.melotti stage: - test needed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17867 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17834] Add Heap (and DynamicHeap) classes to heapq module
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17834 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17834] Add Heap (and DynamicHeap) classes to heapq module
Raymond Hettinger added the comment: Daniel, I've already been in the process of adding a class to the heapq module and have done substantial work on it over the last few months. I'll look at your code to see if there are any ideas that should be merged with it before I finish it up. Am attaching my current draft for Heap(). A PriorityQueue() variant would also be added to 3.4. -- Added file: http://bugs.python.org/file30061/heap2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17834 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17834] Add Heap (and DynamicHeap) classes to heapq module
Raymond Hettinger added the comment: See also http://bugs.python.org/issue17794 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17834 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17834] Add Heap (and DynamicHeap) classes to heapq module
Raymond Hettinger added the comment: Daniel, I'm going to close this one so we can continue work in just a single tracker item: http://bugs.python.org/issue17794 I'll see if anything in your code should be merged in to mine and will list you as a co-contributor when it all goes in. -- resolution: - duplicate status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17834 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17834] Add Heap (and DynamicHeap) classes to heapq module
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- Removed message: http://bugs.python.org/msg188061 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17834 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15535] Fix pickling efficiency of named tuples in 2.7.3
Raymond Hettinger added the comment: [Antoine] I would like to call this a critical regression. I concur. I will post the suggested fix with tests. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15535 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13742] Add a key parameter (like sorted) to heapq.merge
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- priority: low - normal Added file: http://bugs.python.org/file30062/heap2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15535] Fix pickling efficiency of named tuples in 2.7.3
Raymond Hettinger added the comment: Amaury, please go ahead and apply your patch. -- assignee: rhettinger - amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15535 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15535] Fix pickling efficiency of named tuples in 2.7.3
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- Removed message: http://bugs.python.org/msg188063 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15535 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17834] Add Heap (and DynamicHeap) classes to heapq module
Raymond Hettinger added the comment: Daniel, I'm going to close this one so we can continue work in just a single tracker item: http://bugs.python.org/issue13742 I'll see if anything in your code should be merged in to mine and will list you as a co-contributor when it all goes in. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17834 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17834] Add Heap (and DynamicHeap) classes to heapq module
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- Removed message: http://bugs.python.org/msg188062 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17834 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17867] Deleting __import__ from builtins can crash Python3
Changes by Florent Xicluna florent.xicl...@gmail.com: -- nosy: +flox ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17867 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15535] Fix pickling efficiency of named tuples in 2.7.3
Changes by Florent Xicluna florent.xicl...@gmail.com: -- nosy: +flox ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15535 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13742] Add a key parameter (like sorted) to heapq.merge
Changes by Raymond Hettinger raymond.hettin...@gmail.com: Added file: http://bugs.python.org/file30063/heap2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13742] Add a key parameter (like sorted) to heapq.merge
Changes by Raymond Hettinger raymond.hettin...@gmail.com: Removed file: http://bugs.python.org/file30062/heap2.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13742] Add a key parameter (like sorted) to heapq.merge
Mark Dickinson added the comment: heap2.diff contains only a single line's change. Wrong file attached? -- nosy: +mark.dickinson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13742] Add a key parameter (like sorted) to heapq.merge
Mark Dickinson added the comment: Ah, I see the new file now (I'd failed to refresh my browser); sorry for the noise. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17867] Deleting __import__ from builtins can crash Python3
Dmi Baranov added the comment: Another example of post-effects: del __builtins__.__dict__['__import__'] 1/0 Traceback (most recent call last): File stdin, line 1, in module Fatal Python error: __import__ missing Current thread 0x7f3db64fd700: Aborted -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17867 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17867] Deleting __import__ from builtins can crash Python3
Benjamin Peterson added the comment: Technically its not a crash but a fatal error. That's not to say its desirable, of course. :) -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17867 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17867] Deleting __import__ from builtins can crash Python3
Roundup Robot added the comment: New changeset 08ce30768003 by Benjamin Peterson in branch '3.3': raise an ImportError (rather than fatal) when __import__ is not found in __builtins__ (closes #17867) http://hg.python.org/cpython/rev/08ce30768003 -- nosy: +python-dev resolution: - fixed stage: test needed - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17867 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17863] Bad sys.stdin assignment hangs interpreter.
Changes by Florent Xicluna florent.xicl...@gmail.com: -- nosy: +flox title: Bad sys.stdin assignment hands interpreter. - Bad sys.stdin assignment hangs interpreter. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17863 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17863] Bad sys.stdin assignment hangs interpreter.
Roundup Robot added the comment: New changeset 68d1ac152b5d by Benjamin Peterson in branch '3.3': ignore errors when trying to fetch sys.stdin.encoding (closes #17863) http://hg.python.org/cpython/rev/68d1ac152b5d New changeset 97522b189c79 by Benjamin Peterson in branch 'default': merge 3.3 (#17863) http://hg.python.org/cpython/rev/97522b189c79 -- nosy: +python-dev resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17863 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17861] put opcode information in one place
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17861 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17839] base64 module should use memoryview
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17839 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17864] IDLE won't run
Roger Serwy added the comment: This looks like a duplicate of issue8231. -- nosy: +roger.serwy type: crash - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17864 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17673] add `copy_from` argument to temporaryfile
Kyle Roberts added the comment: Thanks for the comments Antoine. I didn't have a good reason for using the file name at the time, although even when using the file name I should have used the file variable that was already created. I tried using the file descriptor, but I encountered a [Errno 9] Bad file descriptor once the methods using _mkstemp_inner call _io.open on the returned fd. This leads me to believe that the fd is being closed somehow, but as you can see from my copy function, I don't implicitly or explicitly close the file using the file descriptor. I'm not sure yet why the file name works as expected but the fd does not. Am I missing something simple? As for points 2-4 I have most of that done. What's the pythonic way for determining if an argument is file-like? I've seen isinstance, hasattr, etc. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17673 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2704] IDLE: Patch to make PyShell behave more like a Terminal interface
Changes by Sarah sarahpythoni...@gmail.com: -- nosy: +Sarah ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2704 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com