ANN: Python Meeting Düsseldorf - 17.07.2012 (Erinnerung)
[This announcement is in German since it targets a local user group meeting in Düsseldorf, Germany] Wir hatten vor ein paar Wochen schon die Ankündigung verschickt. Da wir noch ein paar Plätze frei haben, wiederhole ich hier das Posting. Sowohl Anmeldungen zu dem Meeting als auch für die Lightning Talks sind noch in begrenzter Zahl möglich. Beste Grüße, Marc-Andre Lemburg ANKÜNDIGUNG Python Meeting Düsseldorf http://pyddf.de/ Ein Treffen von Python Enthusiasten und Interessierten in ungezwungener Atmosphäre. Dienstag, 17.07.2012, 18:00 Uhr Clara Schumann Raum DJH Düsseldorf Diese Nachricht können Sie auch online lesen: http://www.egenix.com/company/news/Python-Meeting-Duesseldorf-2012-07-17 EINLEITUNG Das Python Meeting Düsseldorf (http://pyddf.de/) ist eine neue lokale Veranstaltung in Düsseldorf, die sich an Python Begeisterte in der Region wendet. Wir starten bei den Treffen mit einer kurzen Einleitung und gehen dann zu einer Reihe Kurzvorträgen (Lightning Talks) über, bei denen die Anwesenden über neue Projekte, interessante Probleme und sonstige Aktivitäten rund um Python berichten können. Anschließend geht es in eine Gaststätte, um die Gespräche zu vertiefen. Einen guten Überblick über die Vorträge bietet unser YouTube-Kanal, auf dem wir die Vorträge nach den Meetings veröffentlichen: http://www.youtube.com/pyddf/ Veranstaltet wird das Meeting von der eGenix.com GmbH, Langenfeld, in Zusammenarbeit mit Clark Consulting Research, Düsseldorf: * http://www.egenix.com/ * http://www.clark-consulting.eu/ ORT Für das Python Meeting Düsseldorf haben wir den Clara Schumann Raum in der modernen Jugendherberge Düsseldorf angemietet: Jugendherberge Düsseldorf Düsseldorfer Str. 1 40545 Düsseldorf Telefon: +49 211 557310 http://www.duesseldorf.jugendherberge.de Die Jugendherberge verfügt über eine kostenpflichtige Tiefgarage (EUR 2,50 pro Stunde, maximal EUR 10,00). Es ist aber auch möglich per Bus und Bahn anzureisen. Der Raum befindet sich im 1.OG links. PROGRAMM Das Python Meeting Düsseldorf nutzt eine Mischung aus Open Space und Lightning Talks: Die Treffen starten mit einer kurzen Einleitung. Danach geht es weiter mit einer Lightning Talk Session, in der die Anwesenden Kurzvorträge von fünf Minuten halten können. Hieraus ergeben sich dann meisten viele Ansatzpunkte für Diskussionen, die dann den Rest der verfügbaren Zeit in Anspruch nehmen können. Für 19:45 Uhr haben wir in einem nahegelegenen Restaurant Plätze reserviert, damit auch das leibliche Wohl nicht zu kurz kommt. Lightning Talks können vorher angemeldet werden, oder auch spontan während des Treffens eingebracht werden. Ein Beamer mit XGA Auflösung steht zur Verfügung. Folien bitte als PDF auf USB Stick mitbringen. Lightning Talk Anmeldung bitte formlos per EMail an i...@pyddf.de KOSTENBETEILIGUNG Das Python Meeting Düsseldorf wird von Python Nutzern für Python Nutzer veranstaltet. Da Tagungsraum, Beamer, Internet und Getränke Kosten produzieren, bitten wir die Teilnehmer um einen Beitrag in Höhe von EUR 10,00 inkl. 19% Mwst. Wir möchten alle Teilnehmer bitten, den Betrag in bar mitzubringen. ANMELDUNG Da wir nur für ca. 20 Personen Sitzplätze haben, möchten wir bitten, sich per EMail anzumelden. Damit wird keine Verpflichtung eingegangen. Es erleichtert uns allerdings die Planung. Meeting Anmeldung bitte formlos per EMail an i...@pyddf.de WEITERE INFORMATIONEN Weitere Informationen finden Sie auf der Webseite des Meetings: http://pyddf.de/ Mit freundlichen Grüßen, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jul 09 2012) Python/Zope Consulting and Support ...http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/ 2012-07-17: Python Meeting Duesseldorf ... 8 days to go ::: Try our new mxODBC.Connect Python Database Interface for free ! eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/ --
Re: Tkinter.event.widget: handler gets name instead of widget.
On 7/8/2012 5:19 PM, Frederic Rentsch wrote: Hi widget wizards, The manual describes the event attribute widget as The widget which generated this event. This is a valid Tkinter widget instance, not a name. This attribute is set for all events. Same in 3.3, with nice example of using it. def turnRed(self, event): event.widget[activeforeground] = red self.button.bind(Enter, self.turnRed) Ans so it is--has been until on the latest occasion event.widget was not the widget, but its name, crashing the handler. Has event.widget been the widget only in other programs or previously with the same program? # Here I build a list of selectable records having each four fields. # The fields are labels. The selectable line is a frame containing the # labels side by side. The line frames go into self, which is a Frame. for n in range (len (records)): for n, record in enumerate(records): record = records [n] line_frame = Frame (self, name = '-%d-' % n, relief = RAISED, **BUTTON_FRAME_) line_frame.bind ('Enter', self.enter) line_frame.bind ('Leave', self.leave) line_frame.bind ('ButtonRelease-1', self.pick_record) line_frame.bind ('ButtonRelease-3', self.info_profile) line_frame.grid (row = n+2, column = 1) for i in self.range_n_fields: # (0, 1, 2, 3) field = Label (line_frame, text = record [self.INDICES [i]], anchor = W, width = self.COLUMN_WIDTHS [i], **DB_LIST_LABEL_) field.grid (row = 0, column = i, sticky = NW) When posting problem code, you should post a minimal, self-contained example that people can try on other systems and versions. Can you create the problem with one record, which you could give, and one binding? Do you need 4 fields, or would 1 'work'? # Here is the Enter handler: def enter (self, event): w = event.widget print 'hit list.enter (). Event, widget', event, w, w.__class__ # Tracing line w.config (bg = SELECTED_BG_COLOR) # And here is what comes out. The first line is my tracing line. The name is correct in that it # names the entered line_frame, but is wrong because it should be the line_frame, not its name. # The rest is the red exception message: hit list.enter (). Event, widget Tkinter.Event instance at 0x9115dcc .main-frame.data-frame.title-hit-list.-10- type 'str' Exception in Tkinter callback Traceback (most recent call last): File /usr/lib/python2.6/lib-tk/Tkinter.py, line 1413, in __call__ return self.func(*args) File /home/fr/python/finance/piam/hit_list.py, line 83, in enter w.config (bg = SELECTABLE_BG_COLOR) AttributeError: 'str' object has no attribute 'config' # The same thing happens with Leave. The other handlers I haven't done yet. The same bindings work well in # a Menu class with the difference that the bindings are on the Labels, not a containing Frame. # Dell E6500, Ubuntu 10.04, Python 2.6 You might try a current Python release, and the latest tcl/tk 8.5.11 released last March (comes with 3.3.0 Windows release, don't know how on Ubuntu). There might be (have been?) a bug with events on Frames, or on Frames within Frames treated as widgets. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: How to safely maintain a status file
and then on startup read from tmp_file if status_file does not exist. But this seems awkward. It also violates your requirement -- since the crash could take place with a partial temp file. Can you explain why? My thinking was if crash took place when writing the temp file this would not matter because the status file would still exist and be read from. The temp file would only be renamed when fully written. -- http://mail.python.org/mailman/listinfo/python-list
Re: how can I make it work?
On 7/8/2012 10:02 PM, self.python wrote: it's a finder using threading to accelerate Threading with Python does not accelerate unless all but one of the treads are i/o bound. You need multiple processes to use multiple cores in parallel. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: How to safely maintain a status file
Windows doesn't suppport atomic renames if the right side exists. I suggest that you implement two code paths: if os.name == posix: rename = os.rename else: def rename(a, b): try: os.rename(a, b) except OSError, e: if e.errno != 183: raise os.unlink(b) os.rename(a, b) Problem is if the process is stopped between unlink and rename there would no status file. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
On Tuesday, 30 October 2007 21:24:04 UTC+2, Tim Chase wrote: I have used Python for a couple of projects last year and I found it extremely useful. I could write two middle size projects in 2-3 months (part time). Right now I am a bit rusty and trying to catch up again with Python. I am now appearing for Job Interviews these days and I am wondering if anybody of you appeared for a Python Interview. Can you please share the questions you were asked. That will be great help to me. While I haven't interviewed precisely for Python, I've been on the other (interviewing) end and can offer a few of the sorts of things I ask. I don't expect perfect answers to all of them, but they show me a range of what the interviewee knows. I try and give a scattershot of questions from the following areas to try and narrow down where they fall in terms of pythonability, and then grill more deeply around the edges that I find. Basic Python: = - do they know a tuple/list/dict when they see it? - when to use list vs. tuple vs. dict. vs. set - can they use list comprehensions (and know when not to abuse them? :) - can they use tuple unpacking for assignment? - string building...do they use += or do they build a list and use .join() to recombine them efficiently - truth-value testing questions and observations (do they write if x == True or do they just write if x) - basic file-processing (iterating over a file's lines) - basic understanding of exception handling Broader Basic Python: = - questions about the standard library (do you know if there's a standard library for doing X?, or in which library would you find [common functionality Y]?) Most of these are related to the more common libraries such as os/os.path/sys/re/itertools - questions about iterators/generators - questions about map/reduce/sum/etc family of functions - questions about special methods (__foo__) More Advanced Python: = - can they manipulate functions as first-class objects (Python makes it easy, but do they know how) - more detailed questions about the std. libraries (such as datetime/email/csv/zipfile/networking/optparse/unittest) - questions about testing (unittests/doctests) - questions about docstrings vs. comments, and the Why of them - more detailed questions about regular expressions - questions about mutability - keyword/list parameters and unpacked kwd args - questions about popular 3rd-party toolkits (BeautifulSoup, pyparsing...mostly if they know about them and when to use them, not so much about implementation details) - questions about monkey-patching - questions about PDB - questions about properties vs. getters/setters - questions about classmethods - questions about scope/name-resolution - use of lambda Python History: === - decorators added in which version? - batteries included SQL-capible DB in which version? - the difference between class Foo and class Foo(object) - questions from import this about pythonic code Python Resources: = - what do they know about various Python web frameworks (knowing a few names is usually good enough, though knowledge about the frameworks is a nice plus) such as Django, TurboGears, Zope, etc. - what do they know about various Python GUI frameworks and the pros/cons of them (tkinter, wx, pykde, etc) - where do they go with Python related questions (c.l.p, google, google-groups, etc) Other Process-releated things: == - do they use revision control (RCS/CVS/Subversion/Mercurial/Git...anything but VSS) and know how to use it well - do they write automated tests for their code Touchy-feely things: - tabs vs. spaces, and their reasoning - reason for choosing Python - choice of editor/IDE Good luck with your interviewing and hope this helped, -tkc -- http://mail.python.org/mailman/listinfo/python-list
How can I disable module of tkinter when compiling Python 2.5 on redhat9 ?
I don't need it. thanks -- http://mail.python.org/mailman/listinfo/python-list
Re: How to safely maintain a status file
Am 09.07.2012 07:50, schrieb Plumo: Windows doesn't suppport atomic renames if the right side exists. I suggest that you implement two code paths: Problem is if the process is stopped between unlink and rename there would no status file. Yeah, you have to suffer all of Windows' design flaws. You could add a backup status file or use a completely different approach. -- http://mail.python.org/mailman/listinfo/python-list
Re: Discussion on some Code Issues
On Mon, Jul 9, 2012 at 10:57 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Mon, 09 Jul 2012 07:54:47 +1000, Chris Angelico wrote: It's like the difference between reminder text on a Magic: The Gathering card and the actual entries in the Comprehensive Rules. Perfect example is the Madness ability - the reminder text explains the ability, but uses language that actually is quite incorrect. It's a better explanation, though. Hang on, you say that an explanation which is quite incorrect is *better* than one which is correct? I can see why they call the card Madness. :-P Agreed about the ability name :) The fact is, though, that when you're explaining something, it's often better to have a one-sentence explanation that's not quite technically accurate than two paragraphs explaining it in multiple steps and are opaque to anyone who doesn't have the rules-lawyer mind. (I happen to have such a mind. It's not always a good thing, but it makes me a better debugger.) Does it really hurt to anthropomorphize and say that Python looks for modules in the directories in sys.path instead of Module lookup consists of iterating over the elements in sys.path [and that's leaving out the worst-case DFS where you explain THAT in detail], calling combine_path [or whatever it is] with the element and the module name, and attempting to stat/open the result? While your listener's getting bogged down in unnecessary detail, s/he isn't grokking the overall purpose of what you're saying. One option is more accurate. The other is far more helpful. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: How to safely maintain a status file
On Sun, 08 Jul 2012 22:57:56 +0200, Laszlo Nagy wrote: Yes, this is much better. Almost perfect. Don't forget to consult your system documentation, and check if the rename operation is atomic or not. (Most probably it will only be atomic if the original and the renamed file are on the same physical partition and/or mount point). On Unix, rename() is always atomic, and requires that source and destination are on the same partition (if you want to move a file across partitions, you have to copy it then delete the original). But even if the rename operation is atomic, there is still a race condition. Your program can be terminated after the original status file has been deleted, and before the temp file was renamed. In this case, you will be missing the status file (although your program already did something just it could not write out the new status). In the event of abnormal termination, losing some data is to be expected. The idea is to only lose the most recent data while keeping the old copy, rather than losing everything. Writing to a temp file then rename()ing achieves that. -- http://mail.python.org/mailman/listinfo/python-list
migrating from python 2.4 to python 2.6
Hi I have a large code base that was written in python 2.4. I want to migrate to python 2.6. Are there any tools that will aid me in this migration? Thanks A -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I disable module of tkinter when compiling Python 2.5 on redhat9 ?
09.07.12 13:21, cheetah ?: I don't need it. thanks In python's setup.py replace: self.detect_tkinter(inc_dirs, lib_dirs) of def detect_modules(self): This will ignore the compilation of _tkinter.c and tkappinit.c of the python distribution. -- http://mail.python.org/mailman/listinfo/python-list
Re: migrating from python 2.4 to python 2.6
On 09/07/2012 10:37, Mark Devine wrote: Hi I have a large code base that was written in python 2.4. I want to migrate to python 2.6. Are there any tools that will aid me in this migration? Thanks A Check the what's new for python 2.6. If, and I doubt that there are, any compatabilty issues change your code accordingly. If not your code should run as is. An alternative is simply to run your code and see if it breaks, again I doubt it. -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
On 07/09/12 01:39, yeryomin.i...@gmail.com wrote: On Tuesday, 30 October 2007 21:24:04 UTC+2, Tim Chase wrote: yes, yes I did, almost 5 years ago. :-) You didn't include any questions/comments on my email, so it's a bit hard to respond. While I haven't interviewed precisely for Python, I've been on the other (interviewing) end and can offer a few of the sorts of things I ask. [snip] Python History: === - decorators added in which version? - batteries included SQL-capible DB in which version? I've long wanted to update my original post in this department to include things like the with statement as well as my reasoning. Some of our deployments were stuck on earlier versions (currently our oldest is a 2.4 deployment that is merrily chugging along, somewhat stuck due to an external binary dependency for which terms changed between versions). At the time I wrote that, we had some 2.2 and 2.3 code in production that couldn't use decorators, and sqlite wasn't officially added until 2.5 (IIRC). Now that everything is at least 2.4, code can now use decorators freely. I'd also likely include questions about integer division and other stuff added in 3.x (such as the default new-class behavior). So my main motivation was to make sure applicants knew that, in some of our environments, certain features might not be available. Not that I wanted to hire a Python historian. Other Process-releated things: == - do they use revision control (RCS/CVS/Subversion/Mercurial/Git...anything but VSS) and know how to use it well - do they write automated tests for their code Don't let the importance of these two escape. It's SOOO easy to grab any of the freely available VCS tools and learn the ropes, or to write some test code. Failure to do so just seems like negligence these days. -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: Deditor 0.4.0
Kruptein wrote: Hey I released a new version of my python-focused text-editor. you can download it at http://launchpad.net/deditor What is it? Deditor is aimed to be a text-editor which can be used as a basic text-editor as gedit or with the right plugins become a full-feature ide. I focus on making it a python specific editor but you can use it to edit other files as well. It is python specific because the plugin system that is used (DPlug) is written in python and thus all plugins are written in python. Also some of the plugins there is one plugin that comes bundled with deditor that adds some python specific features like code-analyzing, code-inspection, auto-completion etc. So plugins are the main core of the program you can disable and enable plugins at your will. The plugins that come bundled are made to increase the joy of programming. NOTICE that this I don't regard this as a stable product yet. There is no high risk in data loss and there are definitely no privacy concerns but you should still be aware that there are bugs/malfunctions and that you will encounter them. I hope some of you like it and if you don't try to give some constructive criticism :) Most changes in regard to previous release are under the hood. so existing users might not notice a lot. Also the customize plugin's second configuration tab: syntax highlighting is bugged try to avoid it :p Good job. I have 2 question: Aren't you reinventing the wheel ? No way to use tabs for tabulation ??? (I'm CEO of the 'space haters club') Otherwise, I found this bug : Start the editor, click twice on 'Analyse code', and you'll get a traceback. I looked into the related code: def dUpdate(self, trig, value=None): if trig == tabclosed: return self.tabClosed(value) def tabClosed(self, tab): Checks if the tab that is closing is a project if tab.parentTab == None: pass Your method interfaces are quite inconsistent, I sense this is quite global to your code: 1/ dUpdate has None as default value for 'value' 2/ tab.parentTab will fail if tab is None 3/ on the traceback you get from the bug above, a bool has been given, bool has no parentTab. Here are 2 advices: 1/ Default values are for the fool/weak/noob/..., your pick. I tend to use them only for backward compatibilty or for interface stability. Otherwise, it's better not to use them. Some people still use them appropriately but in your I think it may help. 2/ In your docstrings, note down the expected type of your parameters (only 1 type ! (except for the None alternative)) and stick to it. Regards, JM -- http://mail.python.org/mailman/listinfo/python-list
Re: Deditor 0.4.0
Op maandag 9 juli 2012 13:05:58 UTC+2 schreef Jean-Michel Pichavant het volgende: Kruptein wrote: Hey I released a new version of my python-focused text-editor. you can download it at http://launchpad.net/deditor What is it? Deditor is aimed to be a text-editor which can be used as a basic text-editor as gedit or with the right plugins become a full-feature ide. I focus on making it a python specific editor but you can use it to edit other files as well. It is python specific because the plugin system that is used (DPlug) is written in python and thus all plugins are written in python. Also some of the plugins there is one plugin that comes bundled with deditor that adds some python specific features like code-analyzing, code-inspection, auto-completion etc. So plugins are the main core of the program you can disable and enable plugins at your will. The plugins that come bundled are made to increase the joy of programming. NOTICE that this I don't regard this as a stable product yet. There is no high risk in data loss and there are definitely no privacy concerns but you should still be aware that there are bugs/malfunctions and that you will encounter them. I hope some of you like it and if you don't try to give some constructive criticism :) Most changes in regard to previous release are under the hood. so existing users might not notice a lot. Also the customize plugin's second configuration tab: syntax highlighting is bugged try to avoid it :p Good job. I have 2 question: Aren't you reinventing the wheel ? No way to use tabs for tabulation ??? (I'm CEO of the 'space haters club') Otherwise, I found this bug : Start the editor, click twice on 'Analyse code', and you'll get a traceback. I looked into the related code: def dUpdate(self, trig, value=None): if trig == tabclosed: return self.tabClosed(value) def tabClosed(self, tab): Checks if the tab that is closing is a project if tab.parentTab == None: pass Your method interfaces are quite inconsistent, I sense this is quite global to your code: 1/ dUpdate has None as default value for 'value' 2/ tab.parentTab will fail if tab is None 3/ on the traceback you get from the bug above, a bool has been given, bool has no parentTab. Here are 2 advices: 1/ Default values are for the fool/weak/noob/..., your pick. I tend to use them only for backward compatibilty or for interface stability. Otherwise, it's better not to use them. Some people still use them appropriately but in your I think it may help. 2/ In your docstrings, note down the expected type of your parameters (only 1 type ! (except for the None alternative)) and stick to it. Regards, JM To begin with not everything that I want to see is yet implemented. A lot still has to be done for example indentation although I really hate tabs ;D I will give the option in a future release maybe even the next one. I'll check the bug as it probably is indeed a bug. Regarding the default value dUpdate is a method from the plugin system and is called when a trigger is updated. some triggers give an additional value for example a trigger that registers pressed buttons could potentially give which exact key as value. However some triggers don't need this additional value. If a plugin needs both types of triggers the method will need this default value to work. Also the dev version already changed that there always will be sent a value so no need for the default value anymore. Regarding the docstrings: as deditor still is under heavy development not all docstrings are correct or even there. -- http://mail.python.org/mailman/listinfo/python-list
recompiling standard modules
I noticed that active state python Tk inter isnt compiled with --enable-threads therefore I would like to recompile the module with a new version of TCL/TK which is compiled with threads. How can I do this? -- --- Get your facts first, then you can distort them as you please.-- -- http://mail.python.org/mailman/listinfo/python-list
Re: Discussion on some Code Issues
On Mon, 09 Jul 2012 18:41:28 +1000, Chris Angelico wrote: Does it really hurt to anthropomorphize Don't anthropomorphise computers. They don't like it when you do. and say that Python looks for modules in the directories in sys.path instead of Module lookup consists of iterating blah blah blah yadda watermelon yadda blah. I don't think so, I often talk about Python looking for files myself. The intentional stance is an incredibly powerful technique for understanding behaviour of all sorts of entities, sentient or not, from DNA to computers to corporations, and even people. But it does depend on context. Sometimes you need more detail than just Python looks. You need to know precisely *how* Python looks, and how it decides whether it has found or not. And note that I'm still using the intentional stance. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
how to write configure
PyGObject uses the standard autotools for the build infrastructure. To build, it should be as simple as running: $ ./configure --prefix=prefix where python is installed my python2.7 is in /usr/lib/python2.7 will i write : ./configure --prefix=/usr/lib/python2.7 or ./configure --prefix=/usr/lib -- http://mail.python.org/mailman/listinfo/python-list
Re: Deditor 0.4.0
Kruptein wrote: Op maandag 9 juli 2012 13:05:58 UTC+2 schreef Jean-Michel Pichavant het volgende: Kruptein wrote: Hey I released a new version of my python-focused text-editor. you can download it at http://launchpad.net/deditor What is it? Deditor is aimed to be a text-editor which can be used as a basic text-editor as gedit or with the right plugins become a full-feature ide. I focus on making it a python specific editor but you can use it to edit other files as well. It is python specific because the plugin system that is used (DPlug) is written in python and thus all plugins are written in python. Also some of the plugins there is one plugin that comes bundled with deditor that adds some python specific features like code-analyzing, code-inspection, auto-completion etc. So plugins are the main core of the program you can disable and enable plugins at your will. The plugins that come bundled are made to increase the joy of programming. NOTICE that this I don't regard this as a stable product yet. There is no high risk in data loss and there are definitely no privacy concerns but you should still be aware that there are bugs/malfunctions and that you will encounter them. I hope some of you like it and if you don't try to give some constructive criticism :) Most changes in regard to previous release are under the hood. so existing users might not notice a lot. Also the customize plugin's second configuration tab: syntax highlighting is bugged try to avoid it :p Good job. I have 2 question: Aren't you reinventing the wheel ? No way to use tabs for tabulation ??? (I'm CEO of the 'space haters club') Otherwise, I found this bug : Start the editor, click twice on 'Analyse code', and you'll get a traceback. I looked into the related code: def dUpdate(self, trig, value=None): if trig == tabclosed: return self.tabClosed(value) def tabClosed(self, tab): Checks if the tab that is closing is a project if tab.parentTab == None: pass Your method interfaces are quite inconsistent, I sense this is quite global to your code: 1/ dUpdate has None as default value for 'value' 2/ tab.parentTab will fail if tab is None 3/ on the traceback you get from the bug above, a bool has been given, bool has no parentTab. Here are 2 advices: 1/ Default values are for the fool/weak/noob/..., your pick. I tend to use them only for backward compatibilty or for interface stability. Otherwise, it's better not to use them. Some people still use them appropriately but in your I think it may help. 2/ In your docstrings, note down the expected type of your parameters (only 1 type ! (except for the None alternative)) and stick to it. Regards, JM To begin with not everything that I want to see is yet implemented. A lot still has to be done for example indentation although I really hate tabs ;D I will give the option in a future release maybe even the next one. I'll check the bug as it probably is indeed a bug. Regarding the default value dUpdate is a method from the plugin system and is called when a trigger is updated. some triggers give an additional value for example a trigger that registers pressed buttons could potentially give which exact key as value. However some triggers don't need this additional value. If a plugin needs both types of triggers the method will need this default value to work. Also the dev version already changed that there always will be sent a value so no need for the default value anymore. If you can, use the **kwargs syntax. def foo(tabs, **kwargs): # optional arg if kwargs.get('saveFile', False): self.saveFile(tab.file) # required arg if kwargs['saveFile']: self.saveFile() The type of kwargs will be consistent, it will be always a dictionnary, possibly an empty one, but still a dictionnary, and best part of it, if you change the number of argument in the call, you don't break your interface. Regarding the docstrings: as deditor still is under heavy development not all docstrings are correct or even there. Yep, but writing the expected type of your parameters always help, in particular during the dev phase. you can save the verbose part of the documentation for later. Cheers, JM -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
In article 3e0ef383-9615-4b4d-89c1-e55199711...@googlegroups.com, yeryomin.i...@gmail.com wrote: On Tuesday, 30 October 2007 21:24:04 UTC+2, Tim Chase wrote: - more detailed questions about the std. libraries (such as datetime/email/csv/zipfile/networking/optparse/unittest) You need to be careful when you ask questions like this. I would expect somebody to be aware of those and have a high-level understanding of what they do, but certainly not remember the details of the exact syntax and argument order. Even with stuff I use everyday (like unittest and datetime), I have a browser open to the reference manual most of the time. - questions about PDB Heh. I would answer that with, Python Debugger? I've never used it. Python History: === - decorators added in which version? - batteries included SQL-capible DB in which version? - the difference between class Foo and class Foo(object) - questions from import this about pythonic code With the exception of the question about new-style classes, these are silly questions. I was around when both decorators and sqlite3 were added. I couldn't possible tell you when to any precision better than 2 dot something. As for the zen of python, it's cute, and a piece of python folklore, but hardly an essential part of being a good python p -- http://mail.python.org/mailman/listinfo/python-list
Re: Deditor 0.4.0
Op maandag 9 juli 2012 14:54:03 UTC+2 schreef Jean-Michel Pichavant het volgende: Kruptein wrote: Op maandag 9 juli 2012 13:05:58 UTC+2 schreef Jean-Michel Pichavant het volgende: Kruptein wrote: Hey I released a new version of my python-focused text-editor. you can download it at http://launchpad.net/deditor What is it? Deditor is aimed to be a text-editor which can be used as a basic text-editor as gedit or with the right plugins become a full-feature ide. I focus on making it a python specific editor but you can use it to edit other files as well. It is python specific because the plugin system that is used (DPlug) is written in python and thus all plugins are written in python. Also some of the plugins there is one plugin that comes bundled with deditor that adds some python specific features like code-analyzing, code-inspection, auto-completion etc. So plugins are the main core of the program you can disable and enable plugins at your will. The plugins that come bundled are made to increase the joy of programming. NOTICE that this I don't regard this as a stable product yet. There is no high risk in data loss and there are definitely no privacy concerns but you should still be aware that there are bugs/malfunctions and that you will encounter them. I hope some of you like it and if you don't try to give some constructive criticism :) Most changes in regard to previous release are under the hood. so existing users might not notice a lot. Also the customize plugin's second configuration tab: syntax highlighting is bugged try to avoid it :p Good job. I have 2 question: Aren't you reinventing the wheel ? No way to use tabs for tabulation ??? (I'm CEO of the 'space haters club') Otherwise, I found this bug : Start the editor, click twice on 'Analyse code', and you'll get a traceback. I looked into the related code: def dUpdate(self, trig, value=None): if trig == tabclosed: return self.tabClosed(value) def tabClosed(self, tab): Checks if the tab that is closing is a project if tab.parentTab == None: pass Your method interfaces are quite inconsistent, I sense this is quite global to your code: 1/ dUpdate has None as default value for 'value' 2/ tab.parentTab will fail if tab is None 3/ on the traceback you get from the bug above, a bool has been given, bool has no parentTab. Here are 2 advices: 1/ Default values are for the fool/weak/noob/..., your pick. I tend to use them only for backward compatibilty or for interface stability. Otherwise, it's better not to use them. Some people still use them appropriately but in your I think it may help. 2/ In your docstrings, note down the expected type of your parameters (only 1 type ! (except for the None alternative)) and stick to it. Regards, JM To begin with not everything that I want to see is yet implemented. A lot still has to be done for example indentation although I really hate tabs ;D I will give the option in a future release maybe even the next one. I'll check the bug as it probably is indeed a bug. Regarding the default value dUpdate is a method from the plugin system and is called when a trigger is updated. some triggers give an additional value for example a trigger that registers pressed buttons could potentially give which exact key as value. However some triggers don't need this additional value. If a plugin needs both types of triggers the method will need this default value to work. Also the dev version already changed that there always will be sent a value so no need for the default value anymore. If you can, use the **kwargs syntax. def foo(tabs, **kwargs): # optional arg if kwargs.get('saveFile', False): self.saveFile(tab.file) # required arg if kwargs['saveFile']: self.saveFile() The type of kwargs will be consistent, it will be always a dictionnary, possibly an empty one, but still a dictionnary, and best part of it, if you change the number of argument in the call, you don't break your interface. Regarding the docstrings: as deditor still is under heavy development not all docstrings are correct or even there. Yep, but writing the expected type of your parameters always help, in particular during the dev phase. you can save the verbose part of the documentation for later. Cheers, JM Yeah I started to use kwargs in some methods but it's only usefull in some cases imo. I'm a pretty decent python dev imo but I know that there is still a lot that I've to learn so often if I get to know something knew I tend to rewrite a large portion of my program(s) and thus I often am too lazy to write proper docstrings as they would change anyway (- very bad coding practice
Re: How to safely maintain a status file
Richard Baron Penman richar...@gmail.com wrote: Is there a better way? Or do I need to use a database? Using a database would seem to meet a lot of your needs. Don't forget that Python comes with a sqlite database engine included, so it shouldn't take you more than a few lines of code to open the database once and then write out your status every few seconds. import sqlite3 con = sqlite3.connect('status.db') ... with con: cur = con.cursor() cur.execute('UPDATE ...', ...) and similar code to restore the status or create required tables on startup. -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Discussion on some Code Issues
On Mon, Jul 9, 2012 at 10:24 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: But it does depend on context. Sometimes you need more detail than just Python looks. You need to know precisely *how* Python looks, and how it decides whether it has found or not. Agreed. So, looking back at the original context: A question was posed that isn't really about Python at all, but more about file systems. I gave a simple one-sentence answer that omitted heaps of details. It didn't seem likely that someone confused by path names would be changing the current directory inside the script, nor that the distinction of who evaluates a path would be significant (how often does _anyone_ care whether your path is parsed by Python, by the OS, or by the underlying file system?). ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: tiffany 0.6.1 released
On 30.06.12 18:25, Paul Rubin wrote: Christian Tismer tis...@stackless.com writes: Tiffany stands for any tiff. The tiny module solves a large set of problems, has no dependencies and just works wherever Python works. Tiffany was developed in the course of the *DiDoCa* project and will always appear on PyPi. This sounds pretty neat. I didn't comment on it earlier because I haven't tried it out, since I haven't had occasion to deal with tiff files anytime recently. But I've had to process them for some projects in the past, and tiffany would have been useful then. It's good to know that it's out there. Meanwhile I got some feedback and test data. (Thanks to Christian and Anthon) It turns out to be a problem with multiple strips in a tiff file. PIL does not support that. Maybe I can find an easy solution, maybe I'm better off using smc.freeimage as suggested by Christian Heimes, we will see. Right now I'm pretty exhaused after EuroPython... cheers - chris -- Christian Tismer :^) mailto:tis...@stackless.com tismerysoft GmbH : Have a break! Take a ride on Python's Karl-Liebknecht-Str. 121 :*Starship* http://starship.python.net/ 14482 Potsdam: PGP key - http://pgp.uni-mainz.de work +49 173 24 18 776 mobile +49 173 24 18 776 fax n.a. PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
On 07/09/12 08:25, Roy Smith wrote: On Tuesday, 30 October 2007 21:24:04 UTC+2, Tim Chase wrote: - more detailed questions about the std. libraries (such as datetime/email/csv/zipfile/networking/optparse/unittest) You need to be careful when you ask questions like this. I would expect somebody to be aware of those and have a high-level understanding of what they do, but certainly not remember the details of the exact syntax and argument order. Even with stuff I use everyday (like unittest and datetime), I have a browser open to the reference manual most of the time. Yeah, the aim isn't to grill them on the minutia, but to get a feeling that they know the basics. The zipfile module offers a ZipFile object for reading/writing zip files with or without compression. The CSV file allows for reading/writing CSV files with definable delimiters and quoting/escaping. Etc. - questions about PDB Heh. I would answer that with, Python Debugger? I've never used it. The ability to know off the top of your head that it's the Python Debugger is more than enough :-) That's just first-order ignorance: you know what you don't know and can spend a few minutes reading up on it if you need it. The second[or higher]-order ignorance of not knowing what pdb is (or, if you need more powerful debugging, how to do it) is sign the person hasn't been programming in Python much. Python History: === - decorators added in which version? - batteries included SQL-capible DB in which version? - the difference between class Foo and class Foo(object) - questions from import this about pythonic code With the exception of the question about new-style classes, these are silly questions. I was around when both decorators and sqlite3 were added. I couldn't possible tell you when to any precision better than 2 dot something. I'd even be satisfied if a person just knew that such features weren't there all along and might need to be worked around for older deployments. As for the zen of python, it's cute, and a piece of python folklore, but hardly an essential part of being a good python p [Ed: something appears to have gotten truncated there] Yeah, it's more about a person being sufficiently steeped in python to know bits and pieces of the zen, and their ability to recognize/create pythonic code. I've seen enough Java-written-in-Python to know what I don't want :-) -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter.event.widget: handler gets name instead of widget.
On Jul 9, 12:58 am, Terry Reedy tjre...@udel.edu wrote: When posting problem code, you should post a minimal, self-contained example that people can try on other systems and versions. Can you create the problem with one record, which you could give, and one binding? Do you need 4 fields, or would 1 'work'? I'll firmly back that sentiment. Fredric, if you cannot get the following simple code events to work properly, then how do you think you can get events working properly on something more complex? ## START CODE ARTISTRY ## import Tkinter as tk from Tkconstants import * class MyFrame(tk.Frame): def __init__(self, master, **kw): tk.Frame.__init__(self, master, **kw) self.bind('Enter', self.evtMouseEnter) self.bind('Leave', self.evtMouseLeave) self.bind('Button-1', self.evtButtonOneClick) def evtMouseEnter(self, event): event.widget.config(bg='magenta') def evtMouseLeave(self, event): event.widget.config(bg='SystemButtonFace') def evtButtonOneClick(self, event): event.widget.config(bg='green') if __name__ == '__main__': root = tk.Tk() for x in range(10): f = MyFrame(root, height=20, bd=1, relief=SOLID) f.pack(fill=X, expand=YES, padx=5, pady=5) root.mainloop() ## END CODE ARTISTRY ## --- More points to ponder: --- 1. Just because the Tkinter designers decided to use idiotic names for event sequences does not mean you are required to blindly follow their bad example (the whole: if johnny jumps off a cliff..., thing comes to mind) 2. I would strongly recommend you invest more thought into your event handler identifiers. ALL event handlers should marked as *event handlers* using a prefix. I like to use the prefix evt. Some people prefer other prefixes. In any case, just remember to be consistent. Also, event handler names should reflect WHAT event they are processing, not some esoteric functionality of the application like pick_record or info_profile. However if you like, simply have the event handler CALL an outside func/meth. This type of consistency is what separates the men from the boys. 3. The Python Style Guide[1] frowns on superfluous white space (be it horizontal OR vertical!) I would strongly recommend you read and adapt as much of this style as you possibly can bear. Even if we don't all get along, it IS *very* important that we structure our code in a similar style. [1] http://www.python.org/dev/peps/pep-0008/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
On Jul 9, 12:40 pm, Tim Chase python.l...@tim.thechases.com wrote: The second[or higher]-order ignorance of not knowing what pdb is (or, if you need more powerful debugging, how to do it) is sign the person hasn't been programming in Python much. So guru knowledge of pdb is prerequisite to being accepted as a Pythonista? I find that ridiculous since *real* programmers don't use debuggers anyway. [Ed: something appears to have gotten truncated there] Yeah, it's more about a person being sufficiently steeped in python to know bits and pieces of the zen, and their ability to recognize/create pythonic code. I've seen enough Java-written-in-Python to know what I don't want :-) I know you are a member of the group who has an aversion to strict OOP paradigm but is this a justified aversion, or just fear of OOP due to static evolution? Look, i don't like java's strict approach either, however, i do not have an aversion to OOP. -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter.event.widget: handler gets name instead of widget.
On 7/9/2012 1:49 PM, Rick Johnson wrote: On Jul 9, 12:58 am, Terry Reedy tjre...@udel.edu wrote: When posting problem code, you should post a minimal, self-contained example that people can try on other systems and versions. Can you create the problem with one record, which you could give, and one binding? Do you need 4 fields, or would 1 'work'? I'll firmly back that sentiment. Fredric, if you cannot get the following simple code events to work properly, then how do you think you can get events working properly on something more complex? ## START CODE ARTISTRY ## import Tkinter as tk from Tkconstants import * class MyFrame(tk.Frame): def __init__(self, master, **kw): tk.Frame.__init__(self, master, **kw) self.bind('Enter', self.evtMouseEnter) self.bind('Leave', self.evtMouseLeave) self.bind('Button-1', self.evtButtonOneClick) def evtMouseEnter(self, event): event.widget.config(bg='magenta') def evtMouseLeave(self, event): event.widget.config(bg='SystemButtonFace') def evtButtonOneClick(self, event): event.widget.config(bg='green') if __name__ == '__main__': root = tk.Tk() for x in range(10): f = MyFrame(root, height=20, bd=1, relief=SOLID) f.pack(fill=X, expand=YES, padx=5, pady=5) root.mainloop() ## END CODE ARTISTRY ## I copied and pasted this self-contained code into a 3.3 Idle edit window and lightly edited for 3.x. Change 'Tkinter' to 'tkinter', remove tkconstants import and prefix constants with 'tk.'. (The alternative: change 'tkconstants' to 'tkinter.constants', but I prefer prefixes). It runs as expected. import tkinter as tk class MyFrame(tk.Frame): def __init__(self, master, **kw): tk.Frame.__init__(self, master, **kw) self.bind('Enter', self.evtMouseEnter) self.bind('Leave', self.evtMouseLeave) self.bind('Button-1', self.evtButtonOneClick) def evtMouseEnter(self, event): event.widget.config(bg='magenta') def evtMouseLeave(self, event): event.widget.config(bg='SystemButtonFace') def evtButtonOneClick(self, event): event.widget.config(bg='green') if __name__ == '__main__': root = tk.Tk() for x in range(10): f = MyFrame(root, height=20, bd=1, relief=tk.SOLID) f.pack(fill=tk.X, expand=tk.YES, padx=5, pady=5) root.mainloop() Add details and data (maybe less than 10 records) until you get what you want or recreate problem. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
On Monday, 9 July 2012 10:40:59 UTC-7, Tim Chase wrote: On 07/09/12 08:25, Roy Smith wrote: On Tuesday, 30 October 2007 21:24:04 UTC+2, Tim Chase wrote: - more detailed questions about the std. libraries (such as datetime/email/csv/zipfile/networking/optparse/unittest) You need to be careful when you ask questions like this. I would expect somebody to be aware of those and have a high-level understanding of what they do, but certainly not remember the details of the exact syntax and argument order. Even with stuff I use everyday (like unittest and datetime), I have a browser open to the reference manual most of the time. Yeah, the aim isn't to grill them on the minutia, but to get a feeling that they know the basics. The zipfile module offers a ZipFile object for reading/writing zip files with or without compression. The CSV file allows for reading/writing CSV files with definable delimiters and quoting/escaping. Etc. - questions about PDB Heh. I would answer that with, Python Debugger? I've never used it. The ability to know off the top of your head that it's the Python Debugger is more than enough :-) That's just first-order ignorance: you know what you don't know and can spend a few minutes reading up on it if you need it. The second[or higher]-order ignorance of not knowing what pdb is (or, if you need more powerful debugging, how to do it) is sign the person hasn't been programming in Python much. Python History: === - decorators added in which version? - batteries included SQL-capible DB in which version? - the difference between class Foo and class Foo(object) - questions from import this about pythonic code With the exception of the question about new-style classes, these are silly questions. I was around when both decorators and sqlite3 were added. I couldn't possible tell you when to any precision better than 2 dot something. I'd even be satisfied if a person just knew that such features weren't there all along and might need to be worked around for older deployments. As for the zen of python, it's cute, and a piece of python folklore, but hardly an essential part of being a good python p [Ed: something appears to have gotten truncated there] Yeah, it's more about a person being sufficiently steeped in python to know bits and pieces of the zen, and their ability to recognize/create pythonic code. I've seen enough Java-written-in-Python to know what I don't want :-) -tkc Definitely appreciate your approach, I've asked similar questions when interviewing. I also usually like to ask what a candidate likes and dislikes about Python, hoping for the GIL to creep up, along with an explanation as to what it is, implementations that don't have it along with methods of getting around the lock (although that would be a fairly advanced topic IMHO). If it doesn't come up, sometimes I'll pop it in depending on their level of experience. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to safely maintain a status file
On 7/8/2012 2:52 PM, Christian Heimes wrote: You are contradicting yourself. Either the OS is providing a fully atomic rename or it doesn't. All POSIX compatible OS provide an atomic rename functionality that renames the file atomically or fails without loosing the target side. On POSIX OS it doesn't matter if the target exists. Rename on some file system types (particularly NFS) may not be atomic. You don't need locks or any other fancy stuff. You just need to make sure that you flush the data and metadata correctly to the disk and force a re-write of the directory inode, too. It's a standard pattern on POSIX platforms and well documented in e.g. the maildir RFC. You can use the same pattern on Windows but it doesn't work as good. That's because you're using the wrong approach. See how to use ReplaceFile under Win32: http://msdn.microsoft.com/en-us/library/aa365512%28VS.85%29.aspx Renaming files is the wrong way to synchronize a crawler. Use a database that has ACID properties, such as SQLite. Far fewer I/O operations are required for small updates. It's not the 1980s any more. I use a MySQL database to synchronize multiple processes which crawl web sites. The tables of past activity are InnoDB tables, which support transactions. The table of what's going on right now is a MEMORY table. If the database crashes, the past activity is recovered cleanly, the MEMORY table comes back empty, and all the crawler processes lose their database connections, abort, and are restarted. This allows multiple servers to coordinate through one database. John Nagle -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter.event.widget: handler gets name instead of widget.
On Mon, 2012-07-09 at 01:58 -0400, Terry Reedy wrote: On 7/8/2012 5:19 PM, Frederic Rentsch wrote: Hi widget wizards, The manual describes the event attribute widget as The widget which generated this event. This is a valid Tkinter widget instance, not a name. This attribute is set for all events. Same in 3.3, with nice example of using it. def turnRed(self, event): event.widget[activeforeground] = red self.button.bind(Enter, self.turnRed) Ans so it is--has been until on the latest occasion event.widget was not the widget, but its name, crashing the handler. Has event.widget been the widget only in other programs or previously with the same program? I bind Enter to Frames, each Frame calling the same handler that is supposed to change the background color. It is the Enter action that generates the event. No later the handler receives the event whose attribute widget is the widget's name (full path). My code doesn't create events anywhere. I suppose events vanish when the last handler terminates. . . . When posting problem code, you should post a minimal, self-contained example that people can try on other systems and versions. Attempting to strip the critical code, throwing out everything incidental to the problem so I could post something intelligible, I failed to fail: the bare essentials work. The problem appears to be in the incidental. Can you create the problem with one record, which you could give, and one binding? Do you need 4 fields, or would 1 'work'? It fails even with the Frame containing no Labels at all, like this: for n, record in enumerate(records): line_frame = Frame (self, name = _verbalize_number (n), width = 600, height = 20, relief = RAISED, **BUTTON_FRAME_) line_frame.bind ('Enter', self.enter) ## No Labels at all: ## for i in self.range_n_fields: ## field = Label (line_frame, text = record [self.INDICES [i]], anchor = W, width = self.COLUMN_WIDTHS [i], **DB_LIST_LABEL_) ## field.grid (row = 0, column = i, sticky = NW) def enter (self, event): w = event.widget print 'hit list.enter (). Event, widget', event, w, w.__class__ w.config (bg = ENTERED_BG_COLOR) hit list.leave (). Event, widget Tkinter.Event instance at 0xa52c60c .main-frame.data-frame.title-hit-list.one-zero type 'str' Exception in Tkinter callback Traceback (most recent call last): File /usr/lib/python2.6/lib-tk/Tkinter.py, line 1413, in __call__ return self.func(*args) File /home/fr/python/finance/piam/hit_list.py, line 114, in enter w.config (bg = ENTERED_BG_COLOR) AttributeError: 'str' object has no attribute 'config' _verbalize_number spells out the line numbers, because the manual says something about digits being reserved for the auto-generated widget names. I thought that assigned names containing digits might be a problem, but it wasn't. The dictionary arguments, by the way, are just style elements: colors, fonts, reliefs, etc. nothing functionally essential. # Dell E6500, Ubuntu 10.04, Python 2.6 You might try a current Python release, and the latest tcl/tk 8.5.11 released last March (comes with 3.3.0 Windows release, don't know how on Ubuntu). There might be (have been?) a bug with events on Frames, or on Frames within Frames treated as widgets. -- Terry Jan Reedy Terry, I interspersed a couple of answers above. As to your last suggestion I got Python 2.7.3 and managed to compile it. I would have preferred something ready to install, but that doesn't seem to be available for Linux. The compile went smoothly. But it'll take me another day to reorganize, beginning with the Applications menu which still shows IDLE (Python 2.6), while terminals already call the new version 2.7.3, but it doesn't know where MySQLdb is, and possibly where other things are. So for now I can't report on this effort either. But I certainly appreciate your help. Many thanks. Frederic -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter.event.widget: handler gets name instead of widget.
On Mon, 2012-07-09 at 10:49 -0700, Rick Johnson wrote: On Jul 9, 12:58 am, Terry Reedy tjre...@udel.edu wrote: When posting problem code, you should post a minimal, self-contained example that people can try on other systems and versions. Can you create the problem with one record, which you could give, and one binding? Do you need 4 fields, or would 1 'work'? I'll firmly back that sentiment. Fredric, if you cannot get the following simple code events to work properly, then how do you think you can get events working properly on something more complex? ## START CODE ARTISTRY ## import Tkinter as tk from Tkconstants import * class MyFrame(tk.Frame): def __init__(self, master, **kw): tk.Frame.__init__(self, master, **kw) self.bind('Enter', self.evtMouseEnter) self.bind('Leave', self.evtMouseLeave) self.bind('Button-1', self.evtButtonOneClick) def evtMouseEnter(self, event): event.widget.config(bg='magenta') def evtMouseLeave(self, event): event.widget.config(bg='SystemButtonFace') def evtButtonOneClick(self, event): event.widget.config(bg='green') if __name__ == '__main__': root = tk.Tk() for x in range(10): f = MyFrame(root, height=20, bd=1, relief=SOLID) f.pack(fill=X, expand=YES, padx=5, pady=5) root.mainloop() ## END CODE ARTISTRY ## --- More points to ponder: --- 1. Just because the Tkinter designers decided to use idiotic names for event sequences does not mean you are required to blindly follow their bad example (the whole: if johnny jumps off a cliff..., thing comes to mind) 2. I would strongly recommend you invest more thought into your event handler identifiers. ALL event handlers should marked as *event handlers* using a prefix. I like to use the prefix evt. Some people prefer other prefixes. In any case, just remember to be consistent. Also, event handler names should reflect WHAT event they are processing, not some esoteric functionality of the application like pick_record or info_profile. However if you like, simply have the event handler CALL an outside func/meth. This type of consistency is what separates the men from the boys. 3. The Python Style Guide[1] frowns on superfluous white space (be it horizontal OR vertical!) I would strongly recommend you read and adapt as much of this style as you possibly can bear. Even if we don't all get along, it IS *very* important that we structure our code in a similar style. [1] http://www.python.org/dev/peps/pep-0008/ Rick, Thanks for your remarks. I spent most of the day working with Terry's input. And now I am falling asleep. So I shall study your inspirations tomorrow. Frederic -- http://mail.python.org/mailman/listinfo/python-list
Re: How to safely maintain a status file
Please consider batching this data and doing larger writes. Thrashing the hard drive is not a good plan for performance or hardware longevity. For example, crawl an entire FQDN and then write out the results in one operation. If your job fails in the middle and you have to start that FQDN over, no big deal. If that's too big of a chunk for your purposes, perhaps break each FQDN up into top-level directories and crawl each of those in one operation before writing to disk. There are existing solutions for managing job queues, so you can choose what you like. If you're unfamiliar, maybe start by looking at celery. Michael On Mon, Jul 9, 2012 at 1:52 AM, Plumo richar...@gmail.com wrote: What are you keeping in this status file that needs to be saved several times per second? Depending on what type of state you're storing and how persistent it needs to be, there may be a better way to store it. Michael This is for a threaded web crawler. I want to cache what URL's are currently in the queue so if terminated the crawler can continue next time from the same point. -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
One of my favourite questions when interviewing - and it was 100% reliable :-) - what are your hobbies? If the answer included programming then they were hired, if not, then they went to the B list. In my experience, anybody who is really interested in programming will have it as a hobby (and is keen to learn even if they don't currently have the knowledge you require) - otherwise it is just a job. Every job has a learning curve - whether it is just the particular domain or even a new language, the individual who sees programming as more than a job will come up to speed much faster and be more productive in both the short and long term. Every programmer I have ever hired using this criteria worked out well. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to safely maintain a status file
On Mon, Jul 9, 2012 at 8:24 PM, John Nagle na...@animats.com wrote: On 7/8/2012 2:52 PM, Christian Heimes wrote: You are contradicting yourself. Either the OS is providing a fully atomic rename or it doesn't. All POSIX compatible OS provide an atomic rename functionality that renames the file atomically or fails without loosing the target side. On POSIX OS it doesn't matter if the target exists. Rename on some file system types (particularly NFS) may not be atomic. Actually, ISTR that rename() is one of the few things on NFS that is atomic. http://bugs.python.org/issue8828 -- http://mail.python.org/mailman/listinfo/python-list
Re: Tkinter.event.widget: handler gets name instead of widget.
On Tue, Jul 10, 2012 at 3:49 AM, Rick Johnson rantingrickjohn...@gmail.com wrote: ALL event handlers should marked as *event handlers* using a prefix. I like to use the prefix evt. Some people prefer other prefixes. In any case, just remember to be consistent. Also, event handler names should reflect WHAT event they are processing, not some esoteric functionality of the application like pick_record or info_profile. However if you like, simply have the event handler CALL an outside func/meth. This type of consistency is what separates the men from the boys. Or perhaps it separates the half-elves from the hobgoblins. Hard-and-fast rules are seldom valid in stylistic questions. There's nothing wrong with having a prefix like evt or on or whatever; there's also nothing wrong with a naming convention of PB_Open_Click (PB for PushButton (which is what that GUI toolkit called them), Open being what the button does, and Click is the event being handled - that's the VX-REXX convention). Or having no specific event handler and going straight to your pick_record function; that's fine too, especially if you have multiple entry-points to that. Frederic, you'll get a lot of advice on this list, but treat it as just that - advice. There are very few actual rules; read what people say and then make your own choices. ChrisA -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
On Mon, Jul 9, 2012 at 5:22 PM, Peter peter.milli...@gmail.com wrote: One of my favourite questions when interviewing - and it was 100% reliable :-) - what are your hobbies? If the answer included programming then they were hired, if not, then they went to the B list. Woe is the poor college grad, who wants to appear like a well-rounded individual and lists capoeira and gardening, instead. -- Devin -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
On 09Jul2012 11:44, Rick Johnson rantingrickjohn...@gmail.com wrote: | On Jul 9, 12:40 pm, Tim Chase python.l...@tim.thechases.com wrote: | The second[or higher]-order | ignorance of not knowing what pdb is (or, if you need more powerful | debugging, how to do it) is sign the person hasn't been programming | in Python much. | | So guru knowledge of pdb is prerequisite to being accepted as a | Pythonista? I find that ridiculous since *real* programmers don't use | debuggers anyway. You've misread him. He's saying not knowing what PDB is and what it may be used for is a sign of low experience. Whether one uses it or not isn't what he's measuring, it's whether one knows what it is for and how it may be used. | [...] I've seen enough Java-written-in-Python to know what | I don't want :-) | | I know you are a member of the group who has an aversion to strict OOP | paradigm but is this a justified aversion, or just fear of OOP due to | static evolution? Look, i don't like java's strict approach either, | however, i do not have an aversion to OOP. More misreading. Java-written-in-Python (and its variants) means non-python code written in python, in this case from someone with a strong (or rigid) Java background who is not adept with Python idioms. It has nothing to do with OOP one way or the other. Surely we've all seen (and doubtless written) clumsy python code; this is an example. Cheers, -- Cameron Simpson c...@zip.com.au A strong conviction that something must be done is the parent of many bad measures. - Daniel Webster -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
In article mailman.1959.1341868974.4697.python-l...@python.org, Peter peter.milli...@gmail.com wrote: One of my favourite questions when interviewing - and it was 100% reliable :-) - what are your hobbies? My hobby happens to be gardening, for which I don't expect to be paid. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
On 09Jul2012 18:53, Devin Jeanpierre jeanpierr...@gmail.com wrote: | On Mon, Jul 9, 2012 at 5:22 PM, Peter peter.milli...@gmail.com wrote: | One of my favourite questions when interviewing - and it was 100% reliable :-) - what are your hobbies? | If the answer included programming then they were hired, if not, then they went to the B list. | | Woe is the poor college grad, who wants to appear like a well-rounded | individual and lists capoeira and gardening, instead. A new word! A quick google search confused me as to whether this was martial art or a form of dance. The GF suggested it was both. Having seen this: http://www.youtube.com/watch?v=Z8xxgFpK-NM I am now convinced :-) -- Cameron Simpson c...@zip.com.au Hit the button Chewie! - Han Solo -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
Am 09.07.2012 23:22, schrieb Peter: One of my favourite questions when interviewing - and it was 100% reliable :-) - what are your hobbies? If the answer included programming then they were hired, if not, then they went to the B list. on the contrary! When a potential candidate has computer stuff as her main hobby then she goes on the no-hire list. I prefer people that can cope with stress and pressure as well as people who can think outside the box. When you work with computers all day at work *and* at home then you are unable to shut off mentally. Gardening is great hobbies for a developer. You need to be patient, reliable and provide constantly good work to grow your own vegetables. Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
On 07/09/12 17:53, Devin Jeanpierre wrote: One of my favourite questions when interviewing - and it was 100% reliable :-) - what are your hobbies? If the answer included programming then they were hired, if not, then they went to the B list. Woe is the poor college grad, who wants to appear like a well-rounded individual and lists capoeira and gardening, instead. The problem is the instead...if your list of hobbies includes capoeira and gardening in addition to programming, you're at least considered. :-) -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: How to safely maintain a status file
Am 09.07.2012 22:24, schrieb John Nagle: Rename on some file system types (particularly NFS) may not be atomic. The actual operation is always atomic but the NFS server may not notify you about success or failure atomically. See http://linux.die.net/man/2/rename, section BUGS. That's because you're using the wrong approach. See how to use ReplaceFile under Win32: http://msdn.microsoft.com/en-us/library/aa365512%28VS.85%29.aspx The page doesn't say that ReplaceFile is an atomic op. Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
On 07/09/12 18:12, Cameron Simpson wrote: On 09Jul2012 18:53, Devin Jeanpierre jeanpierr...@gmail.com wrote: | On Mon, Jul 9, 2012 at 5:22 PM, Peter peter.milli...@gmail.com wrote: | One of my favourite questions when interviewing - and it was 100% reliable :-) - what are your hobbies? | If the answer included programming then they were hired, if not, then they went to the B list. | | Woe is the poor college grad, who wants to appear like a well-rounded | individual and lists capoeira and gardening, instead. A new word! A quick google search confused me as to whether this was martial art or a form of dance. The GF suggested it was both. You were unfamiliar with the word gardening and unsure whether it was a martial art or a form of dance? http://groovewitch.files.wordpress.com/2011/07/ninja-garden-gnome-1.jpeg «grins, ducks runs» -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
In article mailman.1965.1341876813.4697.python-l...@python.org, Christian Heimes li...@cheimes.de wrote: Am 09.07.2012 23:22, schrieb Peter: One of my favourite questions when interviewing - and it was 100% reliable :-) - what are your hobbies? If the answer included programming then they were hired, if not, then they went to the B list. on the contrary! When a potential candidate has computer stuff as her main hobby then she goes on the no-hire list. I think this points out the silliness of these kinds of questions. There is no right answer. More to the point, the interviewee, when he/she gets one of these questions, probably goes into hyper-analysis mode: Now, just what did he mean by that question? He's likely to give the answer he thinks you want to hear. Do you really want to make hire/no-hire decisions based on somebody's ability to second-guess what you probably wanted to hear when you asked a pointless question? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
On 7/9/2012 2:22 PM Peter said... One of my favourite questions when interviewing - and it was 100% reliable :-) - what are your hobbies? If the answer included programming then they were hired, if not, then they went to the B list. In my experience, anybody who is really interested in programming will have it as a hobby (and is keen to learn even if they don't currently have the knowledge you require) - otherwise it is just a job. Every job has a learning curve - whether it is just the particular domain or even a new language, the individual who sees programming as more than a job will come up to speed much faster and be more productive in both the short and long term. Every programmer I have ever hired using this criteria worked out well. Hence the age bias. Personally, I'm quite happy now that I've divorced my hobby from my career. And my family likes me better too. Emile -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
Am 10.07.2012 01:40, schrieb Roy Smith: Do you really want to make hire/no-hire decisions based on somebody's ability to second-guess what you probably wanted to hear when you asked a pointless question? I don't want her/him to second-guess at all. I expect a straight and honest answer. Second-guessing leads to cheating and lying which doesn't work in the long run. I don't like to disclose my personal life is also a good answer as it shows that the candidate self-confidence and doesn't sell privacy for a job. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
Tim, I've read your list and with one exception it all looks very reasonable. (As an hobbiest, I'm amazed at just how much I have picked up.) The set of questions I'm not sure I understand is the 'What version did ... appear?' questions. This, to me, doesn't seem to indicate any programming experience or expertise. A question asking 'Do you understand different versions?' and 'How would you find out whether a particular version can do a particular thing?' (i.e. which version can you use on GAE?) would seem to give good information. 'How do decorators work?' would seem to give good information. So my question is: what information are you looking for by asking which version introduced decorators? With respect, Den -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
On 07/09/12 19:01, dnca...@gmail.com wrote: The set of questions I'm not sure I understand is the 'What version did ... appear?' questions. This, to me, doesn't seem to indicate any programming experience or expertise. A question asking 'Do you understand different versions?' and 'How would you find out whether a particular version can do a particular thing?' (i.e. which version can you use on GAE?) would seem to give good information. The reason *I* ask them is that we have some 2.4 installations (where things like with aren't available) and at the time I typed up the list, there was some earlier 2.2 and 2.3 code out there where decorators or sqlite[*] didn't work. So I guess it's a bit of a how long have they been programming in python experience aspect. Programmers that have been around a while often remember the frustration of $FEATURE_LACK and then the relief of a much better way to do it. The functionality of decorators was around far earlier, but the clean syntactic sugar made it much nicer to use. The sqlite/sqlite3 libraries were around, but you had to install them yourself (whether from source, a custom installer, or your package manager). As mentioned in another branch of this thread, I don't require python historians, but do prefer folks that know which features to check availability for deployment. -tkc [*] without installing an add-on -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
In article mailman.1972.1341879526.4697.python-l...@python.org, Tim Chase python.l...@tim.thechases.com wrote: As mentioned in another branch of this thread, I don't require python historians, but do prefer folks that know which features to check availability for deployment. Heh. Tell me, when did strings get methods? :-) -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
On 07/09/12 19:27, Roy Smith wrote: prefer folks that know which features to check availability for deployment. Heh. Tell me, when did strings get methods? :-) IIRC, ~2.0? I'm cognizant of the shift happening from the string module to string methods, but I wouldn't expect deep history knowledge--last I checked, RedHat still supports a RHEL version that ships with 2.4, so that's about as far back as I'd probe these days (so I'd drop the decorators question now). Certainly not a deal-breaker either way. Just more data points. -tkc -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Interview Questions
On 10/07/2012 00:33, Christian Heimes wrote: Am 09.07.2012 23:22, schrieb Peter: One of my favourite questions when interviewing - and it was 100% reliable :-) - what are your hobbies? If the answer included programming then they were hired, if not, then they went to the B list. on the contrary! When a potential candidate has computer stuff as her main hobby then she goes on the no-hire list. I prefer people that can cope with stress and pressure as well as people who can think outside the box. When you work with computers all day at work *and* at home then you are unable to shut off mentally. Gardening is great hobbies for a developer. You need to be patient, reliable and provide constantly good work to grow your own vegetables. Christian I guess that's why I detest gardening :-) -- Cheers. Mark Lawrence. -- http://mail.python.org/mailman/listinfo/python-list
Re: How to safely maintain a status file
On Jul 10, 6:24 am, John Nagle na...@animats.com wrote: That's because you're using the wrong approach. See how to use ReplaceFile under Win32: http://msdn.microsoft.com/en-us/library/aa365512%28VS.85%29.aspx I'm not convinced ReplaceFile is atomic: The ReplaceFile function combines several steps within a single function. An application can call ReplaceFile instead of calling separate functions to save the data to a new file, rename the original file using a temporary name, rename the new file to have the same name as the original file, and delete the original file. About the best you can get in Windows, I think, is MoveFileTransacted, but you need to be running Vista or later: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365241(v=vs.85).aspx I agree with your suggestion of using something transactional that isn't bound to later Window versions, though. -- http://mail.python.org/mailman/listinfo/python-list
How to pick content from html using beatifulsoup
Hi, I am a newbie in python, I need to fetch names of side filters and save in csv [PFA screen shot]. Following is snippet from code: soup = BeautifulStoneSoup(html) #for e in soup.findAll('div'): # for c in e.findAll('h3'): #for d in c.findAll('li'): #print'@@@', d.extract() # ##select_pod=soup.findAll('div', {class:win aboutUs}) ##promeg= select_pod[0].findAll(p)[0] # # #for dv in soup.findAll('div', {class:attribution}): #ds = dv.findAll(h3) #print ds select_pod = soup.findAll('div') print select_pod for j in select_pod: if j is not None: print j.findall('a') promeg = select_pod.findAll(h3) #print '--', promeg #hreflist = [ each.get('value') for each in soup.findAll('h3') ] for m in promeg : if m: print 'Data values', m fd1.writerow([x[2], m, i[0], Data Found]) Structure of HTML: div class=attribution div h3By Brand/h3 ul li a href=http://www.xyz.com/cellphones/nokia/nokia/259-33902/buy;Nokia/a /li li li li li li li li li class=more /ul /div div h3By Seller/h3 ul li a id=att_296935_184059 class=attributeUrlReplacementTarget href=http://www.xyz.com/cellphones/nokia/amazon-marketplace/296935-184059/buy;Amazon Marketplace/a input id=att_296935_184059_replacement type=hidden value=http://www.xyz.com/cellphones/nokia/amazon-marketplace/296935-184059/buy; /li li li li li li li li li class=more /ul /div div div /div Output required in csv: By Brands Nokia Samsung . . By Seller Amazon Buy.com . . . Please suggest how to fetch details. Sheetal Singh attachment: filters.png-- http://mail.python.org/mailman/listinfo/python-list
RE: Python Interview Questions
I agree with Christian, a developer should have hobbies other than computer stuffs. Versatile environment give more Ability to think differently. I like playing guitar :-) Be enthu, run foolishly and learn intelligently. -Shambhu -Original Message- From: Christian Heimes [mailto:li...@cheimes.de] Sent: 10/07/2012 5:03 AM To: python-list@python.org Subject: Re: Python Interview Questions Am 09.07.2012 23:22, schrieb Peter: One of my favourite questions when interviewing - and it was 100% reliable :-) - what are your hobbies? If the answer included programming then they were hired, if not, then they went to the B list. on the contrary! When a potential candidate has computer stuff as her main hobby then she goes on the no-hire list. I prefer people that can cope with stress and pressure as well as people who can think outside the box. When you work with computers all day at work *and* at home then you are unable to shut off mentally. Gardening is great hobbies for a developer. You need to be patient, reliable and provide constantly good work to grow your own vegetables. Christian -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I disable module of tkinter when compiling Python 2.5 on redhat9 ?
cheetah hong.yi...@gmail.com wrote: I don't need it. It's not worth worrying about. You're talking about way less than a megabyte of disk space, and there is no performance penalty unless you're using it. In general, the parts of the Python standard library are not individually selectable. -- Tim Roberts, t...@probo.com Providenza Boekelheide, Inc. -- http://mail.python.org/mailman/listinfo/python-list
[issue11176] give more meaningful argument names in argparse documentation
David Lam d...@dlam.me added the comment: haha wow, I was working on this bug too! maybe we can work on the final patch together I got through about 2/3's of the docs, so I thought it might help to upload what I got so far. I basically just made stuff up so I'm totally winning to change anything (or everything) I made a little effort to make the examples mildly amusing, since novelty sorta helps in retention. So one of the recurring examples I used involves that of a pizza-making-program... hopefully this helps in some way! -- nosy: +dlam Added file: http://bugs.python.org/file26325/issue11165-doc-fix-up-to-section-15.4.4.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11176 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15189] tkinter.messagebox does not use the application's icon
Mark Summerfield m...@qtrac.eu added the comment: On Linux Windows every top-level window (including dialogs) normally has an icon at the left of the title bar. Typically this icon is the application's icon. But tkinter doesn't provide such an icon and so a system default icon is used instead. For one's own code this can be fixed by using the iconbitmap() function, but for the tkinter convenience dialogs (e.g., askyesno()), this cannot be done. So, my suggestion is to make the convenience dialogs use the same icon as the application (if the application has one). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15189 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15303] Minor revision to the BaseWidget._setup method in Tkinter
New submission from Drew French rectangletan...@gmail.com: In the BaseWidget._setup method, master is evaluated as a Boolean (when Tkinter attempts to find a parent for the widget). I think it should really be evaluated against None, seeing as that is the default master keyword argument value for most widgets. I ran into problems with this when making a container widget class that inherited from the Canvas, then implementing the __len__ magic method. When the length was zero the widget would evaluate as false, which would prevented me from packing widgets inside my container widget. I attached a revised version of the method. -- components: Tkinter files: tkbugfix.py messages: 165070 nosy: Drew.French priority: normal severity: normal status: open title: Minor revision to the BaseWidget._setup method in Tkinter type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file26326/tkbugfix.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15303 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15279] Spurious unittest warnings
Łukasz Langa luk...@langa.pl added the comment: Unfortunately, exactly the same thing happens with == CPython 3.3.0b1 (default:464c6a50b0ce, Jul 9 2012, 09:26:07) [GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.61)] == Darwin-11.4.0-x86_64-i386-64bit little-endian == /Users/ambv/Documents/Projekty/Python/cpython/py33/build/test_python_37987 Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1) What's interesting is that test_warnings itself works as advertised and it's only Lib/unittest/test/_test_warnings.py that misbehaves. On my friend's 10.7 machine everything runs fine with a little older Clang: == CPython 3.3.0b1 (default, Jul 9 2012, 09:52:57) [GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)] == Darwin-11.4.0-x86_64-i386-64bit little-endian == /Users/sheep/dev/python/cpython-464c6a50b0ce/build/test_python_7695 Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1) Will investigate further. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15279 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15283] pyvenv says nothing on success
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset baf5ed391a7f by Vinay Sajip in branch 'default': Issue #15283: Updated pyvenv documentation to expand on activation. http://hg.python.org/cpython/rev/baf5ed391a7f -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15283 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15189] tkinter.messagebox does not use the application's icon
Drew French rectangletan...@gmail.com added the comment: This is also true for some of the other dialogs (such as the file dialogs). Does anyone know if this behavior can be changed in Tk itself? -- nosy: +Drew.French ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15189 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15267] tempfile.TemporaryFile and httplib incompatibility
Tim Golden m...@timgolden.me.uk added the comment: Could you create a failing test, please, Tim S? -- nosy: +tim.golden ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15267 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15279] Spurious unittest warnings
Changes by Chris Jerdonek chris.jerdo...@gmail.com: -- nosy: +cjerdonek ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15279 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15304] Wrong path in test.support.temp_cwd() error message
New submission from Chris Jerdonek chris.jerdo...@gmail.com: test.support.temp_cwd() has a typo (s/name/path/): try: os.chdir(path) except OSError: if not quiet: raise warnings.warn('tests may fail, unable to change the CWD to ' + name, RuntimeWarning, stacklevel=3) -- components: Tests keywords: easy messages: 165075 nosy: cjerdonek priority: normal severity: normal status: open title: Wrong path in test.support.temp_cwd() error message versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15304 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15267] tempfile.TemporaryFile and httplib incompatibility
Ramchandra Apte maniandra...@gmail.com added the comment: BTW, type(0) should be replaced with int in the code. -- nosy: +ramchandra.apte ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15267 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15305] Test harness unnecessarily disambiguating twice
New submission from Chris Jerdonek chris.jerdo...@gmail.com: It seems like our test harness is disambiguating more than it needs to for parallel testing. In Lib/test/regrtest.py, we do this-- # Define a writable temp dir that will be used as cwd while running # the tests. The name of the dir includes the pid to allow parallel # testing (see the -j option). TESTCWD = 'test_python_{}'.format(os.getpid()) ... with support.temp_cwd(TESTCWD, quiet=True): main() And then in Lib/test/support.py, we are doing this-- # Disambiguate TESTFN for parallel testing, while letting it remain a valid # module name. TESTFN = {}_{}_tmp.format(TESTFN, os.getpid()) with uses like-- with open(TESTFN, wb) as f: # Do stuff with f. It seems like only one of these measures should be necessary (a single working directory for all parallel tests using a disambiguated TESTFN, or one working directory for each process with a non-disambiguated TESTFN). -- components: Tests keywords: easy messages: 165077 nosy: cjerdonek priority: normal severity: normal status: open title: Test harness unnecessarily disambiguating twice versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15305 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15305] Test harness unnecessarily disambiguating twice
Chris Jerdonek chris.jerdo...@gmail.com added the comment: The former option seems to make more sense to me (a single working directory for all parallel tests using a disambiguated TESTFN). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15305 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15300] test directory doubly-nested running tests with -j/--multiprocess
Chris Jerdonek chris.jerdo...@gmail.com added the comment: After this patch, it's clear that TEMPDIR and TESTCWD no longer have to be global variables. I can make that a separate issue after this one. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15300 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15304] Wrong path in test.support.temp_cwd() error message
Chris Jerdonek chris.jerdo...@gmail.com added the comment: Adding failing test. -- keywords: +patch stage: - needs patch Added file: http://bugs.python.org/file26327/issue-15304-failing-test.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15304 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15304] Wrong path in test.support.temp_cwd() error message
Chris Jerdonek chris.jerdo...@gmail.com added the comment: Attaching fix. -- stage: needs patch - patch review Added file: http://bugs.python.org/file26328/issue-15304-fix.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15304 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15297] pkgutil.iter_importers() includes an ImpImporter
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15297 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15299] pkgutil.ImpImporter(None).iter_modules() does not search sys.path
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15299 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15299] pkgutil.ImpImporter(None).iter_modules() does not search sys.path
Chris Jerdonek chris.jerdo...@gmail.com added the comment: I'm working on a test for this. -- stage: - test needed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15299 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15299] pkgutil.ImpImporter(None).iter_modules() does not search sys.path
Chris Jerdonek chris.jerdo...@gmail.com added the comment: Add failing tests. -- keywords: +patch stage: test needed - needs patch Added file: http://bugs.python.org/file26329/issue-15299-failing-test.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15299 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15262] Idle does not show traceback in other threads
Mark myagn...@students.poly.edu added the comment: Yay! I can't wait :) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15262 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15306] Python3 segfault? (works in Python2)
Ztatik Light ztatik.li...@gmail.com added the comment: Crash happens in FT_Request_Size and seems to have been addressed by someone working at SFML: http://en.sfml-dev.org/forums/index.php?topic=2208.0 [Backtrace attached as 'backtrace.txt'] -- Added file: http://bugs.python.org/file26331/backtrace.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15307] Patch for --symlink support in pyvenv with framework python
New submission from Ronald Oussoren ronaldousso...@mac.com: The attached patch ensures that python3.3 -mvenv --symlinks myenv works with framework builds. There are two functional changes: 1) don't call 'realpath' in pythonw.c because realpath resolves symlinks and that breaks the '--symlinks' options because the python command is a symlink with that option (and resolving that gives the path to the python executable in the framework) 2) Look for the __PYVENV_LAUNCHER__ environment variable in Modules/getpath.c and use that in preference on the already calculated value of argv0_path. That code is only active for framework builds I'm not happy with the following line in this patch: +wcsncpy(argv0_path, (wchar_t*)pyvenv_launcher, MAXPATHLEN); That mirrors a similar cast of the result of NSLibraryNameForModule earlier in Modules/getpath.c, but in both cases the input stream is a narrow character string (char, not wchar_t) and wcsncpy expects a wchar_t. The the cast seems to paper over a real problem here. Shouldn't both lines use _Py_char2wchar to convert the char* buffer to a wchar_t* one? -- assignee: ronaldoussoren components: Library (Lib), Macintosh files: venv-symlinks.txt keywords: needs review, patch messages: 165087 nosy: ronaldoussoren priority: normal severity: normal status: open title: Patch for --symlink support in pyvenv with framework python versions: Python 3.3 Added file: http://bugs.python.org/file26332/venv-symlinks.txt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15307 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15307] Patch for --symlink support in pyvenv with framework python
Changes by Ronald Oussoren ronaldousso...@mac.com: -- nosy: +ned.deily, vinay.sajip ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15307 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15306] Python3 segfault? (works in Python2)
Ztatik Light ztatik.li...@gmail.com added the comment: I think this is the related SFML fix patch commit: https://github.com/LaurentGomila/SFML/commit/da5ac8a9512885c5b245a24915733c3b26f689b7 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15306] Python3 segfault? (works in Python2)
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: How is the fix related to Python? Also, you pass a unicode string to freetype.FT_New_Face. You should probably pass a bytes string there, and in any case set the argtypes and restypes attributes to ctypes functions, to prevent such failures. -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15306] Python3 segfault? (works in Python2)
Ztatik Light ztatik.li...@gmail.com added the comment: Mmmm. The fix isn't necessary related to python at all but I figured might potentially AIDE in a python fix. Also, I'm not passing a unicode string... that says '/u' not '\u' ... Also, I tried setting res/argtypes but to no avail. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15306] Python3 segfault? (works in Python2)
Ztatik Light ztatik.li...@gmail.com added the comment: Ooo ... using bytes() DID seem to help. HAHA? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15306] Python3 segfault? (works in Python2)
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: In Python2, strings are bytes; in Python3, they are unicode. You need to use the b'' syntax. -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15267] tempfile.TemporaryFile and httplib incompatibility
Tim Smith t...@tzs.net added the comment: Here is a program that demonstrates the problem: import httplib import tempfile f = tempfile.TemporaryFile() f.write(Hello, Temporary File!) f.seek(0) c = httplib.HTTPConnection('bugs.python.org') c.request('POST', '/', f, {'Content-type' : 'application/octet-stream'}) r = c.getresponse() print r.status, r.reason The expected output is 200 OK, and that's what happens on Mac and almost certainly on Linux. On Windows, this is the result: Traceback (most recent call last): File bad.py, line 9, in module c.request('POST', '/', f, {'Content-type' : 'application/octet File C:\Python27\lib\httplib.py, line 958, in request self._send_request(method, url, body, headers) File C:\Python27\lib\httplib.py, line 989, in _send_request self._set_content_length(body) File C:\Python27\lib\httplib.py, line 964, in _set_content_len thelen = str(len(body)) File C:\Python27\lib\tempfile.py, line 383, in __getattr__ a = getattr(file, name) AttributeError: 'file' object has no attribute '__len__' Changing the lines: f = tempfile.TemporaryFile() f.write(Hello, Temporary File!) f.seek(0) to: f = open(temp.file, w+) f.write(Hello, Less Temporary File!) f.seek(0) makes it work on Windows. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15267 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14787] pkgutil.walk_packages returns extra modules
Brett Cannon br...@python.org added the comment: So the lack of output in 3.3 is not surprising as walk_packages() won't work with the new import implementation as it relies on a non-standard method on loaders that import does not provide. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14787 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15297] pkgutil.iter_importers() includes an ImpImporter
Ronan Lamy ronan.l...@gmail.com added the comment: AFAICT, the intent of this function was to help provide a fully PEP-302 compliant import process wrapping the builtin C-implemented import mechanism. Nowadays, I believe that iterating over sys.meta_path should probably be enough. -- nosy: +Ronan.Lamy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15297 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15288] Clarify the pkgutil.walk_packages() note
Ronan Lamy ronan.l...@gmail.com added the comment: It seems that most, if not all, uses of importer in pkgutil refer to finders, e.g. ImpImporter is a actually only a finder, not an importer. So s/importer/finder/ is needed, and perhaps also a note explaining that ImpImporter isn't in fact an importer, in addition to glossary links. -- nosy: +Ronan.Lamy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15288 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15256] Typo in error message
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 75831951a6b5 by Brett Cannon in branch 'default': Issue #15256: Re-use the ImportError exception message as defined by http://hg.python.org/cpython/rev/75831951a6b5 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15256 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15256] Typo in error message
Brett Cannon br...@python.org added the comment: Thanks for the patch, Marc! -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15256 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15297] pkgutil.iter_importers() includes an ImpImporter
Chris Jerdonek chris.jerdo...@gmail.com added the comment: Marking this a documentation issue because the same behavior is also present in 2.7: Python 2.7.3 (default, Apr 19 2012, 00:55:09) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin from pkgutil import iter_importers list(iter_importers())[-1] pkgutil.ImpImporter instance at 0x10517b710 -- assignee: - docs@python components: +Documentation -Library (Lib) keywords: +easy nosy: +docs@python versions: +Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15297 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15056] Have imp.cache_from_source() raise NotImplementedError when cache tag not available
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset e86330669bb5 by Brett Cannon in branch 'default': Issue #15056: imp.cache_from_source() and source_from_cache() raise http://hg.python.org/cpython/rev/e86330669bb5 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15056 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15056] Have imp.cache_from_source() raise NotImplementedError when cache tag not available
Brett Cannon br...@python.org added the comment: I released Pranav's patch and fleshed it out with docs, tests, and changes to importlib's use of cache_from_source(). -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15056 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15288] Clarify the pkgutil.walk_packages() note
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 96f7926ea444 by Brett Cannon in branch 'default': Issue #15288: Clarify that pkgutil.walk_packages() and friends will no http://hg.python.org/cpython/rev/96f7926ea444 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15288 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15288] Clarify the pkgutil.walk_packages() note
Brett Cannon br...@python.org added the comment: I changed to term to loader and linked to the glossary. I also added a versionchanged note for Python 3.3 so people are not too surprised that pkgutil no longer does what it did in Python 3.2. -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15288 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15242] PyImport_GetMagicTag() should use the same const char * as sys.implementation.cache_tag
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset ee01fd98b5b0 by Brett Cannon in branch 'default': Issue #15242: Have PyImport_GetMagicTag() return a const char * http://hg.python.org/cpython/rev/ee01fd98b5b0 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15242 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15242] PyImport_GetMagicTag() should use the same const char * as sys.implementation.cache_tag
Brett Cannon br...@python.org added the comment: I went ahead and committed Eric's patch. Amaury, if you want to move the macros to a header file I see no reason not to, but I also don't see a need so I didn't want to spend the time doing it myself. -- resolution: - fixed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15242 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15288] Clarify the pkgutil.walk_packages() note
Brett Cannon br...@python.org added the comment: Ronan is right that it is all about finders, not importers per-se. I fixed the docs to not say loader. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15288 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15300] test directory doubly-nested running tests with -j/--multiprocess
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +flox, r.david.murray stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15300 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com