title
stringlengths
10
172
question_id
int64
469
40.1M
question_body
stringlengths
22
48.2k
question_score
int64
-44
5.52k
question_date
stringlengths
20
20
answer_id
int64
497
40.1M
answer_body
stringlengths
18
33.9k
answer_score
int64
-38
8.38k
answer_date
stringlengths
20
20
tags
list
find the colour name from a hexadecimal colour code
2,453,344
<p>i want to find the name of a colour from the hexadecimal colour code. When i get a hex colour code i want to find the most matching colour name. for example for the code #c06040 , how to find out if it is a shade of brown, blue or yellow ?. so that i can find the colour of an object in the image without human interv...
8
2010-03-16T09:57:33Z
2,453,436
<p>Hexadecimal web colour values are just a form of RGB. Convert your RGB values to <a href="http://en.wikipedia.org/wiki/HSL_and_HSV">HSL</a>, and then partition the Hue space into the different colours.</p> <p>For example, a Hue value of about 0-19 would be "red", 20-39 "orange", 40-59 "yellow", etc. (These numbers ...
5
2010-03-16T10:09:42Z
[ "python", "image-processing" ]
find the colour name from a hexadecimal colour code
2,453,344
<p>i want to find the name of a colour from the hexadecimal colour code. When i get a hex colour code i want to find the most matching colour name. for example for the code #c06040 , how to find out if it is a shade of brown, blue or yellow ?. so that i can find the colour of an object in the image without human interv...
8
2010-03-16T09:57:33Z
2,453,444
<p>You can build <code>dict</code> of hex codes as keys and human readable color names as values.</p> <p>Here is a <em>heuristic/fuzzy</em> function for guessing <strong>what a color might look like</strong> ;)</p> <pre><code>colorof = {'f0f8ff':"Alice Blue", 'faebd7':"Antique White", '000000':...
1
2010-03-16T10:10:55Z
[ "python", "image-processing" ]
find the colour name from a hexadecimal colour code
2,453,344
<p>i want to find the name of a colour from the hexadecimal colour code. When i get a hex colour code i want to find the most matching colour name. for example for the code #c06040 , how to find out if it is a shade of brown, blue or yellow ?. so that i can find the colour of an object in the image without human interv...
8
2010-03-16T09:57:33Z
2,453,492
<p>There is a program distributed with the Python source called <em>pynche</em> which can do this</p> <p>The functionality you need is in the method <code>ColorDB.nearest()</code> in <code>ColorDB.py</code></p> <p>From Python/Tools/README</p> <blockquote> <pre><code>Introduction Pynche is a color editor based l...
7
2010-03-16T10:18:24Z
[ "python", "image-processing" ]
find the colour name from a hexadecimal colour code
2,453,344
<p>i want to find the name of a colour from the hexadecimal colour code. When i get a hex colour code i want to find the most matching colour name. for example for the code #c06040 , how to find out if it is a shade of brown, blue or yellow ?. so that i can find the colour of an object in the image without human interv...
8
2010-03-16T09:57:33Z
2,453,715
<p>Here is a small example I have written, which uses the pearson coefficient to compare two colors and chooses the most similar color from a dict. This solution is probably not the most efficient one, but the results should be quite good:</p> <pre><code>import re re_color = re.compile('#([0-9a-f]{2})([0-9a-f]{2})([0-...
0
2010-03-16T10:55:32Z
[ "python", "image-processing" ]
Python list is not the same reference
2,453,672
<p>This is the code:</p> <pre><code>L=[1,2] L is L[:] False </code></pre> <p>Why is this False?</p>
6
2010-03-16T10:49:29Z
2,453,688
<p><code>L[:]</code> (slice notation) means: Make a copy of the entire list, element by element.</p> <p>So you have two lists that have identical content, but are separate entities. Since <code>is</code> evaluates object identity, it returns <code>False</code>.</p> <p><code>L == L[:]</code> returns <code>True</code>....
14
2010-03-16T10:51:45Z
[ "python" ]
Python list is not the same reference
2,453,672
<p>This is the code:</p> <pre><code>L=[1,2] L is L[:] False </code></pre> <p>Why is this False?</p>
6
2010-03-16T10:49:29Z
2,453,711
<p>When in doubt ask for <code>id</code> ;)</p> <pre><code>&gt;&gt;&gt; li = [1,2,4] &gt;&gt;&gt; id(li) 18686240 &gt;&gt;&gt; id(li[:]) 18644144 &gt;&gt;&gt; </code></pre>
6
2010-03-16T10:54:56Z
[ "python" ]
Python list is not the same reference
2,453,672
<p>This is the code:</p> <pre><code>L=[1,2] L is L[:] False </code></pre> <p>Why is this False?</p>
6
2010-03-16T10:49:29Z
2,453,778
<p>The <strong>getslice</strong> method of list, which is called when you to L[], returns a list; so, when you call it with the ':' argument, it doesn't behave differently, it returns a new list with the same elements as the original.</p> <pre><code>&gt;&gt;&gt; id(L) &gt;&gt;&gt; id(L[:]) &gt;&gt;&gt; L[:] == L True...
2
2010-03-16T11:05:40Z
[ "python" ]
Django QuerySet ordering by number of reverse ForeignKey matches
2,453,821
<p>I have the following Django models:</p> <pre><code>class Foo(models.Model): title = models.CharField(_(u'Title'), max_length=600) class Bar(models.Model): foo = models.ForeignKey(Foo) eg_id = models.PositiveIntegerField(_(u'Example ID'), default=0) </code></pre> <p>I wish to return a list of <code>Foo...
2
2010-03-16T11:14:01Z
2,454,022
<p>Use Django's lovely <a href="http://docs.djangoproject.com/en/1.1/topics/db/aggregation/">aggregation features</a>.</p> <pre><code>from django.db.models import Count qs = Foo.objects.filter( bar__eg_id__in=id_list ).annotate( bar_count=Count('bar') ).order_by('bar_count') </code></...
7
2010-03-16T11:50:25Z
[ "python", "django" ]
Django QuerySet ordering by number of reverse ForeignKey matches
2,453,821
<p>I have the following Django models:</p> <pre><code>class Foo(models.Model): title = models.CharField(_(u'Title'), max_length=600) class Bar(models.Model): foo = models.ForeignKey(Foo) eg_id = models.PositiveIntegerField(_(u'Example ID'), default=0) </code></pre> <p>I wish to return a list of <code>Foo...
2
2010-03-16T11:14:01Z
2,454,049
<p>You can do that by using <a href="http://docs.djangoproject.com/en/dev/topics/db/aggregation/" rel="nofollow">aggregation</a>, and more especifically <a href="http://docs.djangoproject.com/en/dev/topics/db/aggregation/#generating-aggregates-for-each-item-in-a-queryset" rel="nofollow">annotation</a> and <a href="http...
1
2010-03-16T11:54:16Z
[ "python", "django" ]
etree.findall: 'OR'-lookup?
2,453,891
<p>I want to find all stylesheet definitions in a XHTML file with <code>lxml.etree.findall</code>. This could be as simple as</p> <pre><code>elems = tree.findall('link[@rel="stylesheet"]') + tree.findall('style') </code></pre> <p>But the problem with CSS style definitions is that the order matters, e.g.</p> <pre><co...
1
2010-03-16T11:29:04Z
2,453,912
<p>Possible using XPATH:</p> <pre><code>data = """&lt;link rel="stylesheet" type="text/css" href="/media/css/first.css" /&gt; &lt;style&gt;body:{font-size: 10px;}&lt;/style&gt; &lt;link rel="stylesheet" type="text/css" href="/media/css/second.css" /&gt; """ from lxml import etree h = etree.HTML(data) h.xpath('//lin...
2
2010-03-16T11:32:56Z
[ "python", "xpath", "lxml", "elementtree" ]
Detect destination of shortened, or "tiny" url
2,454,149
<p>I have just scraped a bunch of Google Buzz data, and I want to know which Buzz posts reference the same news articles. The problem is that many of the links in these posts have been modified by URL shorteners, so it could be the case that many distinct shortened URLs actually all point to the same news article.</p>...
16
2010-03-16T12:11:10Z
2,454,175
<ol> <li><p>Do a list of the most used URL-shorteners and expand it while you discover new ones, then check a link for one item of the list.</p></li> <li><p>You do not know where the URL points to unless you follow it, so best way to do this should be to follow the shortened url and extract the http header of the respo...
1
2010-03-16T12:15:59Z
[ "python", "url", "redirect", "tinyurl" ]
Detect destination of shortened, or "tiny" url
2,454,149
<p>I have just scraped a bunch of Google Buzz data, and I want to know which Buzz posts reference the same news articles. The problem is that many of the links in these posts have been modified by URL shorteners, so it could be the case that many distinct shortened URLs actually all point to the same news article.</p>...
16
2010-03-16T12:11:10Z
2,454,196
<p>(AFAIK) Most url shorteners keep track of urls already shortened, so several requests to the same engine with the same URL will return the same short code.</p> <p>As has been suggested, the best way to extract the real url is to read the headers from a response to a request for the shortened URL. However, some sho...
3
2010-03-16T12:19:17Z
[ "python", "url", "redirect", "tinyurl" ]
Detect destination of shortened, or "tiny" url
2,454,149
<p>I have just scraped a bunch of Google Buzz data, and I want to know which Buzz posts reference the same news articles. The problem is that many of the links in these posts have been modified by URL shorteners, so it could be the case that many distinct shortened URLs actually all point to the same news article.</p>...
16
2010-03-16T12:11:10Z
2,454,303
<p>The easiest way to get the destination of a shortened URL is with <code>urllib</code>. Given that the short URL is valid (response code 200), the URL be returned to you.</p> <pre><code>&gt;&gt;&gt; import urllib &gt;&gt;&gt; resp = urllib.urlopen('http://bit.ly/bcFOko') &gt;&gt;&gt; resp.getcode() 200 &gt;&gt;&gt;...
14
2010-03-16T12:37:17Z
[ "python", "url", "redirect", "tinyurl" ]
Detect destination of shortened, or "tiny" url
2,454,149
<p>I have just scraped a bunch of Google Buzz data, and I want to know which Buzz posts reference the same news articles. The problem is that many of the links in these posts have been modified by URL shorteners, so it could be the case that many distinct shortened URLs actually all point to the same news article.</p>...
16
2010-03-16T12:11:10Z
23,549,094
<p>From what I have read, these answers addressed the second question. I was interested in the first question. After viewing a list of about 300 shorteners it seems the best way to detect them is to simply put them into a list or regex and look for a match with any of them. </p> <pre><code>"|".join(z1) '0rz.tw|1lin...
0
2014-05-08T17:52:36Z
[ "python", "url", "redirect", "tinyurl" ]
Detect destination of shortened, or "tiny" url
2,454,149
<p>I have just scraped a bunch of Google Buzz data, and I want to know which Buzz posts reference the same news articles. The problem is that many of the links in these posts have been modified by URL shorteners, so it could be the case that many distinct shortened URLs actually all point to the same news article.</p>...
16
2010-03-16T12:11:10Z
38,258,901
<p>The posted solution only work for Python 2.x, for Python 3.x you can do this</p> <blockquote> <pre><code>import urllib.request as urlreq link = urlreq.urlopen("http://www.google.com") fullURL = link.url </code></pre> </blockquote> <p>to get the full URL.</p>
1
2016-07-08T04:24:55Z
[ "python", "url", "redirect", "tinyurl" ]
Django '<object> matching query does not exist' when I can see it in the database
2,454,329
<p>My model looks like this:</p> <pre><code>class Staff(models.Model): StaffNumber = models.CharField(max_length=20,primary_key=True) NameFirst = models.CharField(max_length=30,blank=True,null=True) NameLast = models.CharField(max_length=30) SchoolID = models.CharField(max_length=10,blank=True,null=Tru...
9
2010-03-16T12:40:14Z
2,454,437
<p>I have run into similar issues before. </p> <p>I'm not entirely sure why but the raw 'get' tends to give me problems. So, I usually end up using 'filter' instead, then grabbing the first result.</p> <pre><code>a = Staff.objects.filter(NameFirst='ANDREA') result = a[0] </code></pre>
0
2010-03-16T12:55:21Z
[ "python", "django" ]
Django '<object> matching query does not exist' when I can see it in the database
2,454,329
<p>My model looks like this:</p> <pre><code>class Staff(models.Model): StaffNumber = models.CharField(max_length=20,primary_key=True) NameFirst = models.CharField(max_length=30,blank=True,null=True) NameLast = models.CharField(max_length=30) SchoolID = models.CharField(max_length=10,blank=True,null=Tru...
9
2010-03-16T12:40:14Z
2,454,448
<p>Try</p> <pre><code>a = Staff.objects.get(NameFirst=u'"ANDREA"') </code></pre> <p>The <code>u</code> tells Python/Django it's a Unicode string, not a plain old <code>str</code>, and in your <code>s[0].NameFirst</code> sample, it's showing the value as containing double quotes.</p>
9
2010-03-16T12:57:16Z
[ "python", "django" ]
Django '<object> matching query does not exist' when I can see it in the database
2,454,329
<p>My model looks like this:</p> <pre><code>class Staff(models.Model): StaffNumber = models.CharField(max_length=20,primary_key=True) NameFirst = models.CharField(max_length=30,blank=True,null=True) NameLast = models.CharField(max_length=30) SchoolID = models.CharField(max_length=10,blank=True,null=Tru...
9
2010-03-16T12:40:14Z
4,459,877
<p>I ran into the same issue, here's the solution:</p> <pre><code>from django.db import reset_queries, close_connection close_connection() reset_queries() </code></pre>
2
2010-12-16T10:45:10Z
[ "python", "django" ]
Django '<object> matching query does not exist' when I can see it in the database
2,454,329
<p>My model looks like this:</p> <pre><code>class Staff(models.Model): StaffNumber = models.CharField(max_length=20,primary_key=True) NameFirst = models.CharField(max_length=30,blank=True,null=True) NameLast = models.CharField(max_length=30) SchoolID = models.CharField(max_length=10,blank=True,null=Tru...
9
2010-03-16T12:40:14Z
8,905,867
<p>Name was stored in database with an extra redundant doublequotes. So, if you want to catch that record, correct code is:</p> <pre><code>a = Staff.objects.get(NameFirst='"ANDREA"') </code></pre> <p>…instead of:</p> <pre><code>a = Staff.objects.get(NameFirst='ANDREA') </code></pre> <p>If you can't be sure, that ...
2
2012-01-18T06:04:07Z
[ "python", "django" ]
Django '<object> matching query does not exist' when I can see it in the database
2,454,329
<p>My model looks like this:</p> <pre><code>class Staff(models.Model): StaffNumber = models.CharField(max_length=20,primary_key=True) NameFirst = models.CharField(max_length=30,blank=True,null=True) NameLast = models.CharField(max_length=30) SchoolID = models.CharField(max_length=10,blank=True,null=Tru...
9
2010-03-16T12:40:14Z
11,104,250
<p>A simliar thing happened to me. I was able to solve it by putting something in the db for the query to return. </p> <p>This isn't exactly like yours, but it was the first hit on Google, so I thought I'd share. </p>
-1
2012-06-19T15:25:18Z
[ "python", "django" ]
urllib2 multiple Set-Cookie headers in response
2,454,494
<p>I am using urllib2 to interact with a website that sends back multiple Set-Cookie headers. However the response header dictionary only contains one - seems the duplicate keys are overriding each other.</p> <p>Is there a way to access duplicate headers with urllib2?</p>
1
2010-03-16T13:06:23Z
2,454,613
<p>According to <a href="http://docs.python.org/library/urllib2.html" rel="nofollow">urllib2 docs</a>, the <code>.headers</code> attribute of the result URL object is an <code>httplib.HTTPMessage</code> (which appears to be undocumented, at least in the Python docs).</p> <p>However,</p> <pre><code>help(httplib.HTTPMe...
4
2010-03-16T13:23:37Z
[ "python", "header", "urllib2", "setcookie" ]
urllib2 multiple Set-Cookie headers in response
2,454,494
<p>I am using urllib2 to interact with a website that sends back multiple Set-Cookie headers. However the response header dictionary only contains one - seems the duplicate keys are overriding each other.</p> <p>Is there a way to access duplicate headers with urllib2?</p>
1
2010-03-16T13:06:23Z
39,896,162
<p><code>set-cookie</code> is different though. From RFC 6265:</p> <blockquote> <p>Origin servers SHOULD NOT fold multiple Set-Cookie header fields into a single header field. The usual mechanism for folding HTTP headers fields (i.e., as defined in [RFC2616]) might change the semantics of the Set-Coo...
0
2016-10-06T12:34:31Z
[ "python", "header", "urllib2", "setcookie" ]
video player with qt phonon (using python)
2,454,560
<p>I am working on Windows xp and am trying to get a simple video player running. </p> <p>I am trying to use Phonon::VideoPlayer module for this. I am connecting the signal as </p> <pre><code>connect(self.player,SIGNAL("finished()"),self.player.deleteLater) </code></pre> <p>and then , when the Play button is pressed...
1
2010-03-16T13:16:43Z
2,456,311
<p>Try writing</p> <pre><code>self.player.play(Phonon.MediaSource("C:\\vid.mp4")) </code></pre> <p>to escape the <code>\</code></p>
0
2010-03-16T16:45:04Z
[ "c++", "python", "qt", "pyqt", "phonon" ]
video player with qt phonon (using python)
2,454,560
<p>I am working on Windows xp and am trying to get a simple video player running. </p> <p>I am trying to use Phonon::VideoPlayer module for this. I am connecting the signal as </p> <pre><code>connect(self.player,SIGNAL("finished()"),self.player.deleteLater) </code></pre> <p>and then , when the Play button is pressed...
1
2010-03-16T13:16:43Z
2,801,274
<pre><code>Phonon::MediaSource mediaSource= Phonon::MediaSource("C:\\vid.mp4"); </code></pre> <p>Try creating media sources like this and also other Phonon objects..</p>
0
2010-05-10T08:25:45Z
[ "c++", "python", "qt", "pyqt", "phonon" ]
How do you run python scripts from other script and have their root in my root?
2,454,576
<p>I have a module "B", I want to run it from a script "C", and I want to call global variables in "B", as they were in the "C" root. Another problem is if I imported <code>sys</code> in "B" when I run "C" it doesn't see <code>sys</code></p> <p><code># NameError: global name 'sys' is not defined #</code></p> <p>What ...
0
2010-03-16T13:19:42Z
2,454,624
<p>When you import a module <code>B</code> (like <code>import B</code>), every line in <code>B</code> will be interpreted. I assume this is what you mean when you say you want to run it. To reference members in <code>B</code>'s namespace, you can get them like:</p> <p><code>B.something_defined_in_B</code>.</p> <p>I...
5
2010-03-16T13:25:18Z
[ "python", "import", "global-variables", "module" ]
How do you run python scripts from other script and have their root in my root?
2,454,576
<p>I have a module "B", I want to run it from a script "C", and I want to call global variables in "B", as they were in the "C" root. Another problem is if I imported <code>sys</code> in "B" when I run "C" it doesn't see <code>sys</code></p> <p><code># NameError: global name 'sys' is not defined #</code></p> <p>What ...
0
2010-03-16T13:19:42Z
2,454,902
<p>is it in your PYTHON_PATH?</p> <p>if not, in script C's <strong>init</strong>.py</p> <pre><code>import os, sys sys.path.append('/PATH/TO/MODULE/B') </code></pre> <p>then, in module C</p> <pre><code>from B import * something_defined_in_B() </code></pre>
1
2010-03-16T14:01:01Z
[ "python", "import", "global-variables", "module" ]
What is a Pythonic way to get a list of tuples of all the possible combinations of the elements of two lists?
2,454,626
<p>Suppose I have two differently-sized lists</p> <pre><code>a = [1, 2, 3] b = ['a', 'b'] </code></pre> <p>What is a Pythonic way to get a list of tuples <code>c</code> of all the possible combinations of one element from <code>a</code> and one element from <code>b</code>?</p> <pre><code>&gt;&gt;&gt; print c [(1, 'a...
3
2010-03-16T13:25:41Z
2,454,646
<p>Use a list comprehension:</p> <pre><code>&gt;&gt;&gt; a = [1, 2, 3] &gt;&gt;&gt; b = ['a', 'b'] &gt;&gt;&gt; c = [(x,y) for x in a for y in b] &gt;&gt;&gt; print c [(1, 'a'), (1, 'b'), (2, 'a'), (2, 'b'), (3, 'a'), (3, 'b')] </code></pre>
13
2010-03-16T13:28:20Z
[ "list", "python" ]
What is a Pythonic way to get a list of tuples of all the possible combinations of the elements of two lists?
2,454,626
<p>Suppose I have two differently-sized lists</p> <pre><code>a = [1, 2, 3] b = ['a', 'b'] </code></pre> <p>What is a Pythonic way to get a list of tuples <code>c</code> of all the possible combinations of one element from <code>a</code> and one element from <code>b</code>?</p> <pre><code>&gt;&gt;&gt; print c [(1, 'a...
3
2010-03-16T13:25:41Z
2,454,649
<p>Try <code>itertools.product</code>.</p>
9
2010-03-16T13:28:35Z
[ "list", "python" ]
How to use CrawlSpider from scrapy to click a link with javascript onclick?
2,454,998
<p>I want scrapy to crawl pages where going on to the next link looks like this:</p> <pre><code>&lt;a href="#" onclick="return gotoPage('2');"&gt; Next &lt;/a&gt; </code></pre> <p>Will scrapy be able to interpret javascript code of that?</p> <p>With <em>livehttpheaders</em> extension I found out that clicking Next g...
21
2010-03-16T14:12:28Z
6,423,542
<p>The actual methodology will be as follows: </p> <ol> <li>Post your request to reach the page (as you are doing)</li> <li>Extract link to the next page from that particular response</li> <li>Simple Request the next page if possible or use FormRequest again in applicable</li> </ol> <p>All this have to be streamlined...
3
2011-06-21T10:04:37Z
[ "javascript", "python", "onclick", "scrapy", "web-scraping" ]
How to use CrawlSpider from scrapy to click a link with javascript onclick?
2,454,998
<p>I want scrapy to crawl pages where going on to the next link looks like this:</p> <pre><code>&lt;a href="#" onclick="return gotoPage('2');"&gt; Next &lt;/a&gt; </code></pre> <p>Will scrapy be able to interpret javascript code of that?</p> <p>With <em>livehttpheaders</em> extension I found out that clicking Next g...
21
2010-03-16T14:12:28Z
24,981,218
<p>I built a quick crawler that executes JS via selenium. Feel free to copy / modify <a href="https://github.com/rickysahu/seleniumjscrawl" rel="nofollow">https://github.com/rickysahu/seleniumjscrawl</a></p>
0
2014-07-27T13:01:34Z
[ "javascript", "python", "onclick", "scrapy", "web-scraping" ]
How to create a custom admin configuration panel in Django?
2,455,018
<p>I would like to create a configuration panel for the homepage of the web-app I'm designing with Django. This configuration panel should let me choose some basic options like highlighting some news, setting a showcase banner, and so on. Basically I don't need an app with different rows, but just a panel page with som...
2
2010-03-16T14:13:53Z
2,455,815
<p>The automatically generated administration area created by Django is for data maintenance.<br> It provides forms to edit data in your models.</p> <p>If it doesn't "handle this feature", then it sounds like your "configuration panel" (configuration panel should let me choose some basic options like highlighting some...
0
2010-03-16T15:45:58Z
[ "python", "django", "panel", "admin" ]
How to create a custom admin configuration panel in Django?
2,455,018
<p>I would like to create a configuration panel for the homepage of the web-app I'm designing with Django. This configuration panel should let me choose some basic options like highlighting some news, setting a showcase banner, and so on. Basically I don't need an app with different rows, but just a panel page with som...
2
2010-03-16T14:13:53Z
2,456,313
<p>The admin area of Django features views and templates just like the rest of your Django site, so it's just a matter of customizing the relevant files.</p> <p><a href="http://www.djangobook.com/en/1.0/chapter17/" rel="nofollow">This should be a helpful read for you.</a></p> <p>In particular, the method that renders...
2
2010-03-16T16:45:11Z
[ "python", "django", "panel", "admin" ]
How to create a custom admin configuration panel in Django?
2,455,018
<p>I would like to create a configuration panel for the homepage of the web-app I'm designing with Django. This configuration panel should let me choose some basic options like highlighting some news, setting a showcase banner, and so on. Basically I don't need an app with different rows, but just a panel page with som...
2
2010-03-16T14:13:53Z
2,466,793
<p>it isnt eaxctly what you are looking for, but you might also be interested in something like <a href="http://bitbucket.org/izi/django-admin-tools/wiki/Home" rel="nofollow">django-admin-tools</a>!</p>
2
2010-03-18T00:06:41Z
[ "python", "django", "panel", "admin" ]
How to spell check python docstring with emacs?
2,455,062
<p>I'd like to run a spell checker on the docstrings of my Python code, if possible from within emacs. </p> <p>I've found the ispell-check-comments setting which can be used to spell check only comments in code, but I was not able to target only the docstrings which are a fairly python-specific thing. </p>
5
2010-03-16T14:20:02Z
2,455,436
<p>I recommend you to try flyspell-mode. You could use something like:</p> <p>(add-hook 'python-mode-hook 'flyspell-prog-mode)</p> <p>in your Emacs configuration.</p>
12
2010-03-16T15:01:12Z
[ "python", "emacs", "spell-checking", "docstring" ]
How to get the width of a string in pixels?
2,455,255
<p>I am using wxPython's HyperTreeList and I want to set the column width exactly equal to length of the largest string in it.</p> <p>To accomplish that, I'd like to to convert a python string size into pixels.</p> <p>For Example: If we have a string like </p> <pre><code>str = "python" len(str) = 6 </code></pre> <p...
7
2010-03-16T14:40:40Z
2,455,286
<p>It depends on how you are printing the text.</p> <p>You may be interested by <code>PIL ImageDraw</code> which has a <code>textsize</code> method. See <a href="http://effbot.org/imagingbook/imagedraw.htm">http://effbot.org/imagingbook/imagedraw.htm</a></p> <p>Update: This was answering the original question. It may...
8
2010-03-16T14:44:41Z
[ "python", "wxpython" ]
How to get the width of a string in pixels?
2,455,255
<p>I am using wxPython's HyperTreeList and I want to set the column width exactly equal to length of the largest string in it.</p> <p>To accomplish that, I'd like to to convert a python string size into pixels.</p> <p>For Example: If we have a string like </p> <pre><code>str = "python" len(str) = 6 </code></pre> <p...
7
2010-03-16T14:40:40Z
2,455,379
<p>You'll have to do <a href="http://bytes.com/topic/python/answers/693968-wxpython-status-bar-adjust-length-string">something</a> <a href="http://www.wxpython.org/docs/api/wx.DC-class.html#GetTextExtent">like</a> (see the <a href="http://docs.wxwidgets.org/2.8/wx_wxdc.html#wxdcgettextextent">documentation of wxWidgets...
12
2010-03-16T14:55:19Z
[ "python", "wxpython" ]
BasicHTTPServer, SimpleHTTPServer and concurrency
2,455,606
<p>I'm writing a small web server for testing purposes using python, BasicHTTPServer and SimpleHTTPServer. It looks like it's processing one request at a time. Is there any way to make it a little faster without messing around too deeply? Basicly my code looks as the following and I'd like to keep it this simple ;)</p>...
4
2010-03-16T15:21:26Z
2,455,756
<p>You can make your own threading or forking class with a mixin inheritance from <a href="http://docs.python.org/library/socketserver.html" rel="nofollow">SocketServer</a>:</p> <pre><code>import SocketServer import BaseHTTPServer class ThreadingHTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer): ...
7
2010-03-16T15:39:11Z
[ "python", "concurrency", "simplehttpserver" ]
BasicHTTPServer, SimpleHTTPServer and concurrency
2,455,606
<p>I'm writing a small web server for testing purposes using python, BasicHTTPServer and SimpleHTTPServer. It looks like it's processing one request at a time. Is there any way to make it a little faster without messing around too deeply? Basicly my code looks as the following and I'd like to keep it this simple ;)</p>...
4
2010-03-16T15:21:26Z
2,455,850
<p>Depending on what your requirements are, another option might be to hook in <a href="http://pythonpaste.org/do-it-yourself-framework.html" rel="nofollow">Paste</a>. Though, based on your example, it may be overkill. Something to keep in the toolbox.</p>
0
2010-03-16T15:49:28Z
[ "python", "concurrency", "simplehttpserver" ]
BasicHTTPServer, SimpleHTTPServer and concurrency
2,455,606
<p>I'm writing a small web server for testing purposes using python, BasicHTTPServer and SimpleHTTPServer. It looks like it's processing one request at a time. Is there any way to make it a little faster without messing around too deeply? Basicly my code looks as the following and I'd like to keep it this simple ;)</p>...
4
2010-03-16T15:21:26Z
2,456,421
<p>You might also look at <a href="http://cherrypy.org" rel="nofollow">CherryPy</a> -- it's pretty simple, too, and has multiple request threads with no additional effort. Although your needs may be modest now, CP has a lot of nice capabilities that may benefit you in the future.</p>
1
2010-03-16T16:58:06Z
[ "python", "concurrency", "simplehttpserver" ]
Reordering matrix elements to reflect column and row clustering in naiive python
2,455,761
<p>I'm looking for a way to perform clustering separately on matrix rows and than on its columns, reorder the data in the matrix to reflect the clustering and putting it all together. The clustering problem is easily solvable, so is the dendrogram creation (for example in <a href="http://www.janeriksolem.net/2009/04/hi...
20
2010-03-16T15:39:32Z
2,467,457
<p>I'm not sure completely understand, but it appears you are trying to re-index each axis of the array based on sorts of the dendrogram indicies. I guess that assumes there is some comparative logic in each branch delineation. If this is the case then would this work(?):</p> <pre><code>&gt;&gt;&gt; x_idxs = [(0,1,0...
5
2010-03-18T03:59:58Z
[ "python", "statistics", "numpy", "cluster-analysis", "scipy" ]
Reordering matrix elements to reflect column and row clustering in naiive python
2,455,761
<p>I'm looking for a way to perform clustering separately on matrix rows and than on its columns, reorder the data in the matrix to reflect the clustering and putting it all together. The clustering problem is easily solvable, so is the dendrogram creation (for example in <a href="http://www.janeriksolem.net/2009/04/hi...
20
2010-03-16T15:39:32Z
3,017,704
<p>See my <a href="http://stackoverflow.com/questions/2982929/plotting-results-of-hierarchical-clustering-ontop-of-a-matrix-of-data-in-python/3011894#3011894">recent answer</a>, copied in part below, to <a href="http://stackoverflow.com/questions/2982929/">this related question</a>.</p> <pre><code>import scipy import ...
30
2010-06-10T19:21:41Z
[ "python", "statistics", "numpy", "cluster-analysis", "scipy" ]
Reordering matrix elements to reflect column and row clustering in naiive python
2,455,761
<p>I'm looking for a way to perform clustering separately on matrix rows and than on its columns, reorder the data in the matrix to reflect the clustering and putting it all together. The clustering problem is easily solvable, so is the dendrogram creation (for example in <a href="http://www.janeriksolem.net/2009/04/hi...
20
2010-03-16T15:39:32Z
31,397,582
<p>I know this is very late to the game, but I made a plotting object based on the code from the post on this page. It's registered on pip, so to install you just have to call</p> <pre><code>pip install pydendroheatmap </code></pre> <p>check out the project's github page here : <a href="https://github.com/themantalop...
1
2015-07-14T04:20:11Z
[ "python", "statistics", "numpy", "cluster-analysis", "scipy" ]
how to build good python web application
2,455,996
<p>hello <br> i never worked with web programming and i've been asked lately to write a web-based software to manage assets and tasks. to be used by more than 900 persons <br> what are the recommended modules , frameworks , libraries for this task. and it will be highly appreciated if you guyz recommend some books a...
2
2010-03-16T16:06:42Z
2,456,021
<p>Check out <a href="http://www.djangoproject.com/" rel="nofollow">Django</a>. I would say it is the most comprehensive and easy to use python web framework.</p> <p>They have a <a href="http://www.djangobook.com/en/2.0/" rel="nofollow">book</a> and <a href="http://docs.djangoproject.com/en/dev/intro/tutorial01/" rel=...
11
2010-03-16T16:10:29Z
[ "python", "web-applications" ]
how to build good python web application
2,455,996
<p>hello <br> i never worked with web programming and i've been asked lately to write a web-based software to manage assets and tasks. to be used by more than 900 persons <br> what are the recommended modules , frameworks , libraries for this task. and it will be highly appreciated if you guyz recommend some books a...
2
2010-03-16T16:06:42Z
2,456,032
<p>I've never built web application with python-based framework but if I had to I would try <a href="http://www.djangoproject.com/" rel="nofollow">Django</a><br> I know people who worked with it and were very satisfied</p>
0
2010-03-16T16:12:08Z
[ "python", "web-applications" ]
how to build good python web application
2,455,996
<p>hello <br> i never worked with web programming and i've been asked lately to write a web-based software to manage assets and tasks. to be used by more than 900 persons <br> what are the recommended modules , frameworks , libraries for this task. and it will be highly appreciated if you guyz recommend some books a...
2
2010-03-16T16:06:42Z
2,456,392
<p>I've really enjoyed working with <a href="http://www.cherrypy.org/" rel="nofollow" title="CherryPy">CherryPy</a> in my project. Django had a little more of a CMS feel than I needed. As a Python novice, CherryPy was very approachable to me. After several months of working with it, I often find interesting ways to us...
2
2010-03-16T16:54:48Z
[ "python", "web-applications" ]
how to build good python web application
2,455,996
<p>hello <br> i never worked with web programming and i've been asked lately to write a web-based software to manage assets and tasks. to be used by more than 900 persons <br> what are the recommended modules , frameworks , libraries for this task. and it will be highly appreciated if you guyz recommend some books a...
2
2010-03-16T16:06:42Z
2,456,428
<p><a href="http://www.djangoproject.com/" rel="nofollow">Django</a> is a great place to start since it is the most widely used web framework for Python. You could also look at <a href="http://pinaxproject.com/" rel="nofollow">Pinax</a> which is build off of Django. Pinax is typically used for rapid development. Its te...
0
2010-03-16T16:58:52Z
[ "python", "web-applications" ]
how to build good python web application
2,455,996
<p>hello <br> i never worked with web programming and i've been asked lately to write a web-based software to manage assets and tasks. to be used by more than 900 persons <br> what are the recommended modules , frameworks , libraries for this task. and it will be highly appreciated if you guyz recommend some books a...
2
2010-03-16T16:06:42Z
2,456,770
<p>I've been working with <a href="http://pylonshq.com/" rel="nofollow">Pylons</a> for a while now and I highly recommend it. Before using it I evaluated Django as well. I found Pylons was a better fit due to how easy it was to customize and fit into my work flow. Django seemed to be great for quickly starting proje...
1
2010-03-16T17:47:36Z
[ "python", "web-applications" ]
how to build good python web application
2,455,996
<p>hello <br> i never worked with web programming and i've been asked lately to write a web-based software to manage assets and tasks. to be used by more than 900 persons <br> what are the recommended modules , frameworks , libraries for this task. and it will be highly appreciated if you guyz recommend some books a...
2
2010-03-16T16:06:42Z
2,456,881
<p>I haven't used it but one of my co-workers has used the <a href="http://code.google.com/p/gdata-python-client/" rel="nofollow">Python Google Data API</a> and has said good things. Not positive of everything it can do but it might be helpful to you.</p>
0
2010-03-16T18:03:52Z
[ "python", "web-applications" ]
how to build good python web application
2,455,996
<p>hello <br> i never worked with web programming and i've been asked lately to write a web-based software to manage assets and tasks. to be used by more than 900 persons <br> what are the recommended modules , frameworks , libraries for this task. and it will be highly appreciated if you guyz recommend some books a...
2
2010-03-16T16:06:42Z
2,456,886
<p>let's just get all the frameworks mentioned again.</p> <p><a href="http://turbogears.org/" rel="nofollow">Turbogears</a></p> <p><a href="http://bfg.repoze.org" rel="nofollow">bfg</a></p> <p><a href="http://blog.ianbicking.org/2010/03/12/a-webob-app-example/" rel="nofollow">webob</a></p> <p><a href="http://web2py...
1
2010-03-16T18:05:12Z
[ "python", "web-applications" ]
python print end=' '
2,456,148
<p>I have this python script where I need to run <code>gdal_retile.py</code></p> <p>but I get an exception on this line:</p> <pre><code>if Verbose: print("Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ') </code></pre> <p>The <code>end=''</code> is invalid syntax. I am curious as to why, and...
50
2010-03-16T16:26:54Z
2,456,162
<p>How about this:</p> <pre><code>#Only for use in Python 2.6.0a2 and later from __future__ import print_function </code></pre> <p>This allows you to use the Python 3.0 style <code>print</code> function without having to hand-edit all occurrences of <code>print</code> :)</p>
27
2010-03-16T16:28:55Z
[ "python" ]
python print end=' '
2,456,148
<p>I have this python script where I need to run <code>gdal_retile.py</code></p> <p>but I get an exception on this line:</p> <pre><code>if Verbose: print("Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ') </code></pre> <p>The <code>end=''</code> is invalid syntax. I am curious as to why, and...
50
2010-03-16T16:26:54Z
2,456,163
<p>I think the author probably meant:</p> <pre><code>if Verbose: print("Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ') </code></pre> <p>He's missing an initial quote after <code>print(</code>.</p> <p>Note that as of <a href="http://docs.python.org/release/3.0.1/whatsnew/3.0.html#print-is-...
1
2010-03-16T16:28:57Z
[ "python" ]
python print end=' '
2,456,148
<p>I have this python script where I need to run <code>gdal_retile.py</code></p> <p>but I get an exception on this line:</p> <pre><code>if Verbose: print("Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ') </code></pre> <p>The <code>end=''</code> is invalid syntax. I am curious as to why, and...
50
2010-03-16T16:26:54Z
2,456,177
<p>It looks like you're just missing an opening double-quote. Try:</p> <pre><code>if Verbose: print("Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ') </code></pre>
2
2010-03-16T16:30:22Z
[ "python" ]
python print end=' '
2,456,148
<p>I have this python script where I need to run <code>gdal_retile.py</code></p> <p>but I get an exception on this line:</p> <pre><code>if Verbose: print("Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ') </code></pre> <p>The <code>end=''</code> is invalid syntax. I am curious as to why, and...
50
2010-03-16T16:26:54Z
2,456,179
<p>I think he's using Python 3.0 and you're using Python 2.6.</p>
2
2010-03-16T16:30:32Z
[ "python" ]
python print end=' '
2,456,148
<p>I have this python script where I need to run <code>gdal_retile.py</code></p> <p>but I get an exception on this line:</p> <pre><code>if Verbose: print("Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ') </code></pre> <p>The <code>end=''</code> is invalid syntax. I am curious as to why, and...
50
2010-03-16T16:26:54Z
2,456,240
<p>First of all, you're missing a quote at the beginning but this is probably a copy/paste error.</p> <p>In Python 3.x, the <code>end=' '</code> part will place a space after the displayed string instead of a newline. To do the same thing in Python 2.x, you'd put a comma at the end:</p> <pre><code>print "Building int...
5
2010-03-16T16:36:04Z
[ "python" ]
python print end=' '
2,456,148
<p>I have this python script where I need to run <code>gdal_retile.py</code></p> <p>but I get an exception on this line:</p> <pre><code>if Verbose: print("Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ') </code></pre> <p>The <code>end=''</code> is invalid syntax. I am curious as to why, and...
50
2010-03-16T16:26:54Z
2,456,292
<p>Are you sure you are using Python 3.x? The syntax isn't available in Python 2.x because <code>print</code> is still a statement.</p> <p><code>print("foo" % bar, end=" ")</code></p> <p>in Python 2.x is identical to</p> <p><code>print ("foo" % bar, end=" ")</code></p> <p>or</p> <p><code>print "foo" % bar, end=" "...
67
2010-03-16T16:43:04Z
[ "python" ]
python print end=' '
2,456,148
<p>I have this python script where I need to run <code>gdal_retile.py</code></p> <p>but I get an exception on this line:</p> <pre><code>if Verbose: print("Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ') </code></pre> <p>The <code>end=''</code> is invalid syntax. I am curious as to why, and...
50
2010-03-16T16:26:54Z
14,185,322
<p><em>Even I was getting that same error today. And I've experienced an interesting thing. If you're using python 3.x and still getting the error, it might be a reason:</em></p> <blockquote> <p>You have multiple python versions installed on same drive. And when you're presing the f5 button the python shell windo...
0
2013-01-06T18:28:03Z
[ "python" ]
python print end=' '
2,456,148
<p>I have this python script where I need to run <code>gdal_retile.py</code></p> <p>but I get an exception on this line:</p> <pre><code>if Verbose: print("Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ') </code></pre> <p>The <code>end=''</code> is invalid syntax. I am curious as to why, and...
50
2010-03-16T16:26:54Z
17,494,175
<p>USE :: <strong><code>python3 filename.py</code></strong> </p> <p>I had such error , this occured because i have two versions of python installed on my drive namely python2.7 and python3 . Following was my code :</p> <pre><code>#!usr/bin/python f = open('lines.txt') for line in f.readlines(): print(line,en...
0
2013-07-05T17:32:17Z
[ "python" ]
python print end=' '
2,456,148
<p>I have this python script where I need to run <code>gdal_retile.py</code></p> <p>but I get an exception on this line:</p> <pre><code>if Verbose: print("Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ') </code></pre> <p>The <code>end=''</code> is invalid syntax. I am curious as to why, and...
50
2010-03-16T16:26:54Z
24,141,055
<p>we need to import a header before using <code>end=''</code>, as it is not included in the python's normal runtime.</p> <p><code>**from** __future__ **import** print_function</code></p> <p>it shall work perfectly now</p>
0
2014-06-10T12:30:49Z
[ "python" ]
python print end=' '
2,456,148
<p>I have this python script where I need to run <code>gdal_retile.py</code></p> <p>but I get an exception on this line:</p> <pre><code>if Verbose: print("Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ') </code></pre> <p>The <code>end=''</code> is invalid syntax. I am curious as to why, and...
50
2010-03-16T16:26:54Z
30,793,138
<p>This is just a version thing. Since Python 3.x the print is actually a function, so it now takes arguments like any normal function.</p> <p>The <code>end=' '</code> is just to say that you want a space after the end of the statement instead of a new line character. In Python 2.x you would have to do this by placing...
0
2015-06-11T23:32:04Z
[ "python" ]
python print end=' '
2,456,148
<p>I have this python script where I need to run <code>gdal_retile.py</code></p> <p>but I get an exception on this line:</p> <pre><code>if Verbose: print("Building internam Index for %d tile(s) ..." % len(inputTiles), end=' ') </code></pre> <p>The <code>end=''</code> is invalid syntax. I am curious as to why, and...
50
2010-03-16T16:26:54Z
31,709,208
<p><strong>In python 2.7 here is how you do it</strong> </p> <pre><code>mantra = 'Always look on the bright side of life' for c in mantra: print c, #output A l w a y s l o o k o n t h e b r i g h t s i d e o f l i f e </code></pre> <p><strong>In python 3.x</strong></p> <pre><code>myjob= 'hacker' for c...
2
2015-07-29T19:14:31Z
[ "python" ]
Using Python, what's the best way to create a set of files on disk for testing?
2,456,226
<p>I'm looking for a way to create a tree of test files to unit test a packaging tool. Basically, I want to create some common file system structures -- directories, nested directories, symlinks within the selected tree, symlinks outside the tree, &amp;c.</p> <p>Ideally I want to do this with as little boilerplate as ...
2
2010-03-16T16:35:07Z
2,456,527
<p>Automated in what way?</p> <p>You could write a simple format to define a basic file structure using nested dictionaries:</p> <pre><code>## if you saved this as tree.py ## you could use it by doing: # from tree import * ## then following the examples at the bottom of this file import os, shutil, time class Node:...
1
2010-03-16T17:11:33Z
[ "python", "unit-testing", "automation" ]
Using Python, what's the best way to create a set of files on disk for testing?
2,456,226
<p>I'm looking for a way to create a tree of test files to unit test a packaging tool. Basically, I want to create some common file system structures -- directories, nested directories, symlinks within the selected tree, symlinks outside the tree, &amp;c.</p> <p>Ideally I want to do this with as little boilerplate as ...
2
2010-03-16T16:35:07Z
2,456,703
<p>I do this type of thing for testing Unix user creation and home directory copies. The Zip suggestion is a good one. </p> <p>I personally keep two directory structures -- one is a source and one becomes the test structure. I just sync the source to the destination via shutil.copytree as part of the test setup. </...
1
2010-03-16T17:35:15Z
[ "python", "unit-testing", "automation" ]
GAE-mechanize sourcecode
2,456,321
<p>i saw a project that made mechanize compatible to google app engine. But I couldn't find the sourcecode to it</p> <p>It would be very nice if someone can give me the source of it, because I most likely need this in the app I'm creating currently.</p>
0
2010-03-16T16:46:14Z
2,456,409
<p>See <a href="http://stackoverflow.com/questions/1389893/mechanize-and-google-app-engine">http://stackoverflow.com/questions/1389893/mechanize-and-google-app-engine</a></p> <p>I got this by googling <a href="http://www.google.com/search?q=mechanize+google+app+engine" rel="nofollow">mechanize google app engine</a>.</...
1
2010-03-16T16:56:38Z
[ "python", "google-app-engine", "mechanize" ]
UTF-8 HTML and CSS files with BOM (and how to remove the BOM with Python)
2,456,380
<p>First, some background: I'm developing a web application using Python. All of my (text) files are currently stored in UTF-8 with the BOM. This includes all my HTML templates and CSS files. These resources are stored as binary data (BOM and all) in my DB.</p> <p>When I retrieve the templates from the DB, I decode th...
9
2010-03-16T16:53:14Z
2,456,524
<p>You can use something similar to remove BOM:</p> <pre><code>import os, codecs def remove_bom_from_file(filename, newfilename): if os.path.isfile(filename): # open file f = open(filename,'rb') # read first 4 bytes header = f.read(4) # check if we have BOM... bom_...
0
2010-03-16T17:11:26Z
[ "python", "file", "utf-8", "byte-order-mark" ]
UTF-8 HTML and CSS files with BOM (and how to remove the BOM with Python)
2,456,380
<p>First, some background: I'm developing a web application using Python. All of my (text) files are currently stored in UTF-8 with the BOM. This includes all my HTML templates and CSS files. These resources are stored as binary data (BOM and all) in my DB.</p> <p>When I retrieve the templates from the DB, I decode th...
9
2010-03-16T16:53:14Z
2,456,686
<p>Check the first character after decoding to see if it's the BOM:</p> <pre><code>if u.startswith(u'\ufeff'): u = u[1:] </code></pre>
8
2010-03-16T17:33:19Z
[ "python", "file", "utf-8", "byte-order-mark" ]
UTF-8 HTML and CSS files with BOM (and how to remove the BOM with Python)
2,456,380
<p>First, some background: I'm developing a web application using Python. All of my (text) files are currently stored in UTF-8 with the BOM. This includes all my HTML templates and CSS files. These resources are stored as binary data (BOM and all) in my DB.</p> <p>When I retrieve the templates from the DB, I decode th...
9
2010-03-16T16:53:14Z
2,458,718
<p><strong>The previously-accepted answer is WRONG.</strong></p> <p><code>u'\ufffe'</code> is not a character. If you get it in a unicode string somebody has stuffed up mightily.</p> <p>The BOM (aka ZERO WIDTH NO-BREAK SPACE) is <code>u'\ufeff'</code></p> <pre><code>&gt;&gt;&gt; UNICODE_BOM = u'\N{ZERO WIDTH NO-BREA...
-1
2010-03-16T22:50:32Z
[ "python", "file", "utf-8", "byte-order-mark" ]
UTF-8 HTML and CSS files with BOM (and how to remove the BOM with Python)
2,456,380
<p>First, some background: I'm developing a web application using Python. All of my (text) files are currently stored in UTF-8 with the BOM. This includes all my HTML templates and CSS files. These resources are stored as binary data (BOM and all) in my DB.</p> <p>When I retrieve the templates from the DB, I decode th...
9
2010-03-16T16:53:14Z
2,459,793
<p>Since you state:</p> <blockquote> <p>All of my (text) files are currently stored in UTF-8 with the BOM</p> </blockquote> <p>then use the 'utf-8-sig' codec to decode them:</p> <pre><code>&gt;&gt;&gt; s = u'Hello, world!'.encode('utf-8-sig') &gt;&gt;&gt; s '\xef\xbb\xbfHello, world!' &gt;&gt;&gt; s.decode('utf-...
19
2010-03-17T03:47:42Z
[ "python", "file", "utf-8", "byte-order-mark" ]
Serialize a message format to xml
2,456,722
<p>I have a python list as</p> <pre><code> [ (A,{'a':1,'b':2,'c':3,'d':4}), B,{'a':1,'b':2,'c':3,'d':4}), ... ] </code></pre> <p>I want to know if there is a standard library of serializing this kind of list to xml or should I hand code it to a file.</p> <p>Edit : Added Detail</p> <p>Assuming th...
0
2010-03-16T17:39:05Z
2,456,776
<p>Does it need to be XML? This is the usual domain of the <code>pickle</code> module.</p> <p>But, no, there's no standard serialize-Python-object-to-XML library. (I have one I wrote a while ago, it's not published, much less "standard".) There are libraries like <code>lxml</code> for converting XML to Python object...
4
2010-03-16T17:48:16Z
[ "python", "xml", "xml-serialization" ]
Serialize a message format to xml
2,456,722
<p>I have a python list as</p> <pre><code> [ (A,{'a':1,'b':2,'c':3,'d':4}), B,{'a':1,'b':2,'c':3,'d':4}), ... ] </code></pre> <p>I want to know if there is a standard library of serializing this kind of list to xml or should I hand code it to a file.</p> <p>Edit : Added Detail</p> <p>Assuming th...
0
2010-03-16T17:39:05Z
2,456,789
<ul> <li>Why are you using XML? There are often better solutions, like JSON, which is plenty portable and standard.</li> <li>The easiest way might be to use YAML. YAML's main representation is not XML, but there is a canonical way (YAXML) to represent YAML serialized data as XML.</li> </ul>
1
2010-03-16T17:50:46Z
[ "python", "xml", "xml-serialization" ]
Serialize a message format to xml
2,456,722
<p>I have a python list as</p> <pre><code> [ (A,{'a':1,'b':2,'c':3,'d':4}), B,{'a':1,'b':2,'c':3,'d':4}), ... ] </code></pre> <p>I want to know if there is a standard library of serializing this kind of list to xml or should I hand code it to a file.</p> <p>Edit : Added Detail</p> <p>Assuming th...
0
2010-03-16T17:39:05Z
2,456,914
<p>"use json/yaml/whitespace" comments aside (I suppose you have your reasons to do so, instead go for pickle/json), </p> <p>you can try the very pythonic elementtree library (in the standardlib), or even use some advice from google : search "converting python dictionary to xml"</p> <p>(not to sound too rude .. take ...
2
2010-03-16T18:08:50Z
[ "python", "xml", "xml-serialization" ]
Can I avoid a threaded UDP socket in Python dropping data?
2,456,727
<p>First off, I'm new to Python and learning on the job, so be gentle!</p> <p>I'm trying to write a threaded Python app for Windows that reads data from a UDP socket (thread-1), writes it to file (thread-2), and displays the live data (thread-3) to a widget (gtk.Image using a gtk.gdk.pixbuf). I'm using queues for comm...
3
2010-03-16T17:39:30Z
2,456,945
<p>UDP doesn't verify the target received it (like TCP does) - you must implement retransmission and such in your applications if you want to ensure all of the data arrives. Do you control the sending UDP source?</p>
4
2010-03-16T18:13:37Z
[ "python", "multithreading", "sockets", "gtk", "pygtk" ]
Can I avoid a threaded UDP socket in Python dropping data?
2,456,727
<p>First off, I'm new to Python and learning on the job, so be gentle!</p> <p>I'm trying to write a threaded Python app for Windows that reads data from a UDP socket (thread-1), writes it to file (thread-2), and displays the live data (thread-3) to a widget (gtk.Image using a gtk.gdk.pixbuf). I'm using queues for comm...
3
2010-03-16T17:39:30Z
2,457,044
<p><strong>Edit</strong> - Struck out listen/accept sentence, thanks Daniel, I was just coming to remove it when I saw your comment :)</p> <p>I'd suggest that this is a network programming issue, rather than python per-se.</p> <p>You've set a packet-per-second rate and a duration to define the number of recv calls yo...
-1
2010-03-16T18:27:09Z
[ "python", "multithreading", "sockets", "gtk", "pygtk" ]
Can I avoid a threaded UDP socket in Python dropping data?
2,456,727
<p>First off, I'm new to Python and learning on the job, so be gentle!</p> <p>I'm trying to write a threaded Python app for Windows that reads data from a UDP socket (thread-1), writes it to file (thread-2), and displays the live data (thread-3) to a widget (gtk.Image using a gtk.gdk.pixbuf). I'm using queues for comm...
3
2010-03-16T17:39:30Z
2,460,705
<p>Firstly; can you set the recv buffer size for the socket? If so, set it to something very large as this will let the UDP stack buffer more datagrams for you. </p> <p>Secondly; if you can use asynchronous I/O then post multiple recv calls at once (again this allows the stack to service more datagrams before it start...
-1
2010-03-17T08:17:32Z
[ "python", "multithreading", "sockets", "gtk", "pygtk" ]
Can I avoid a threaded UDP socket in Python dropping data?
2,456,727
<p>First off, I'm new to Python and learning on the job, so be gentle!</p> <p>I'm trying to write a threaded Python app for Windows that reads data from a UDP socket (thread-1), writes it to file (thread-2), and displays the live data (thread-3) to a widget (gtk.Image using a gtk.gdk.pixbuf). I'm using queues for comm...
3
2010-03-16T17:39:30Z
2,464,283
<p>It seems that the problem is with the source. There are two issues:</p> <ol> <li><p>Looking at Wireshark the source is not consistently transmitting 1200 packets-per-second. Possibly, as Len pointed out, a problem with the outbound stack dropping data. BTW the source is a programmable card with an ethernet port con...
-1
2010-03-17T17:05:35Z
[ "python", "multithreading", "sockets", "gtk", "pygtk" ]
Can I avoid a threaded UDP socket in Python dropping data?
2,456,727
<p>First off, I'm new to Python and learning on the job, so be gentle!</p> <p>I'm trying to write a threaded Python app for Windows that reads data from a UDP socket (thread-1), writes it to file (thread-2), and displays the live data (thread-3) to a widget (gtk.Image using a gtk.gdk.pixbuf). I'm using queues for comm...
3
2010-03-16T17:39:30Z
2,526,685
<p>UDP is, by definition, <em>unreliable</em>. You <strong>must not</strong> write programs that expect UDP datagrams to always get through.</p> <p>Packets are dropped all the time in TCP too, but your program does not need to care, because TCP applications cannot process <em>packets</em>; the TCP stack shows your ap...
2
2010-03-26T20:55:55Z
[ "python", "multithreading", "sockets", "gtk", "pygtk" ]
Extract substructure from a text file using bash or python
2,456,813
<p>I have a huge text file, which follows the structure:</p> <pre><code>SET TAG1 ... ... SET ... SET TAG2 ... ... SET ... ... </code></pre> <p>I would like to extract for a specific TAG, (i.e. TAG54) its individual "substructure", which would be</p> <pre><code>SET TAG54 ... ... SET </code></pre> <p>Each substructur...
0
2010-03-16T17:54:16Z
2,456,911
<p>Here's a Python approach: you pass in the open file handle as the first argument, the tag number as second argument, and get back as the result a list of the relevant lines (including newline characters), or an empty line if the tag is not found in the file:</p> <pre><code>def lookfor(f, tagnum): tag = 'TAG%s\n' ...
1
2010-03-16T18:08:29Z
[ "python", "bash" ]
Extract substructure from a text file using bash or python
2,456,813
<p>I have a huge text file, which follows the structure:</p> <pre><code>SET TAG1 ... ... SET ... SET TAG2 ... ... SET ... ... </code></pre> <p>I would like to extract for a specific TAG, (i.e. TAG54) its individual "substructure", which would be</p> <pre><code>SET TAG54 ... ... SET </code></pre> <p>Each substructur...
0
2010-03-16T17:54:16Z
2,457,015
<p>If your system's <code>grep</code> supports <code>-P</code> for perl regexp:</p> <pre><code>grep -P 'SET\nTAG54\n[.\n]*\nSET' file.txt </code></pre>
0
2010-03-16T18:22:51Z
[ "python", "bash" ]
Extract substructure from a text file using bash or python
2,456,813
<p>I have a huge text file, which follows the structure:</p> <pre><code>SET TAG1 ... ... SET ... SET TAG2 ... ... SET ... ... </code></pre> <p>I would like to extract for a specific TAG, (i.e. TAG54) its individual "substructure", which would be</p> <pre><code>SET TAG54 ... ... SET </code></pre> <p>Each substructur...
0
2010-03-16T17:54:16Z
2,457,019
<pre><code>csplit -f tags input.txt '%^TAG54$%-1' '/^SET$/+1' '%.*%' '{*}' </code></pre>
0
2010-03-16T18:23:05Z
[ "python", "bash" ]
Extract substructure from a text file using bash or python
2,456,813
<p>I have a huge text file, which follows the structure:</p> <pre><code>SET TAG1 ... ... SET ... SET TAG2 ... ... SET ... ... </code></pre> <p>I would like to extract for a specific TAG, (i.e. TAG54) its individual "substructure", which would be</p> <pre><code>SET TAG54 ... ... SET </code></pre> <p>Each substructur...
0
2010-03-16T17:54:16Z
2,457,033
<p>gawk:</p> <pre><code>BEGIN { state=0 } state==0 &amp;&amp; $0=="TAG54" { print "SET" state=1 } state==1 { print } state==1 &amp;&amp; $0=="SET" { exit } </code></pre>
0
2010-03-16T18:25:48Z
[ "python", "bash" ]
Extract substructure from a text file using bash or python
2,456,813
<p>I have a huge text file, which follows the structure:</p> <pre><code>SET TAG1 ... ... SET ... SET TAG2 ... ... SET ... ... </code></pre> <p>I would like to extract for a specific TAG, (i.e. TAG54) its individual "substructure", which would be</p> <pre><code>SET TAG54 ... ... SET </code></pre> <p>Each substructur...
0
2010-03-16T17:54:16Z
2,459,024
<pre><code>$ awk -vRS="SET" '/TAG54/{print RT$0RT}' file SET TAG54 ... ... SET </code></pre> <p>if you are doing it with shell scripting, pass your shell variable to <code>awk</code> using <code>-v</code>. eg</p> <pre><code>#!/bin/bash read -r -p "what's your tag? " tag awk -vRS="SET" -vt="$tag" '$0~tag{print RT$0RT}...
0
2010-03-16T23:53:23Z
[ "python", "bash" ]
Reading object tree from file into Python
2,456,828
<p>I have a Python app that contains an object structure that the user can manipulate. What I want to do is allow the user to create a file declaring how the object structure should be created.</p> <p>For example, I would like the user to be able to create the following file:</p> <pre><code>foo.bar.baz = true x.y.z =...
1
2010-03-16T17:55:54Z
2,456,905
<p>Typically problems like this one are solved with XML. However in your case you can do something even easier.</p> <p>Assuming the dots represent hierarchy delimiters, you could read in the left hand side of the <code>=</code> sign (<code>input.split('=')[0]</code>), and then perform a <code>split('.')</code> on the ...
1
2010-03-16T18:07:41Z
[ "python" ]
Checkboxes with pylons
2,456,926
<p>I have been trying to add some check boxes in a pylons mako. However I don't know how to get their values in the controller. It seems that it can only get the first value of the check boxes. I tried using form encode but i got several errors. Is there an easier way to do this?</p> <p>Thanks</p>
1
2010-03-16T18:11:15Z
2,457,303
<p>I'm assuming that "I can only get the first value" means you've got a series of checkboxes with the same value for the 'name' attribute within your form? </p> <p>Now, if that's the case and you're wanting a list of boolean values based on whether or not the boxes are checked or not, you'll need to do two things:...
0
2010-03-16T19:07:56Z
[ "python", "pylons" ]
fastest way to search through this data object? (python)
2,457,064
<p>I have a data object that looks like this:</p> <pre><code> { 'node-16': { 'tags': ['cuda'], 'localNodes': [ { 'name': 'nC', 'consumesFrom': ['nA', 'nB'], 'classType': 'VectorAdder.VectorAdder' ...
0
2010-03-16T18:30:19Z
2,457,170
<pre><code>namedict = dict((x['name'], y) for y in data for x in data[y]['localNodes']) proddict = dict((z['name'], [y for y in z['consumesFrom'] if namedict[y] != x]) for x in data for z in data[x]['localNodes'] if z['consumesFrom'] is not None) print 'nA' in proddict['nC'] </code></pre>
1
2010-03-16T18:47:07Z
[ "python" ]
Using IDLE to run Python PyUnit unit tests
2,457,068
<p>Is there a way, within IDLE, to run the PyUnit (unittest module) unit tests directly?</p> <p>I ask because I have a short test module and when I run it with python mymodule.py from the Cygwin shell I get all tests passed, but when I use Run->Run Module from IDLE the tests pass but then I get an exception (SystemExi...
8
2010-03-16T18:30:49Z
2,457,281
<p>No one answered (I find that if there aren't any answers in the first few minutes, the likelihood of an answer goes down significantly :), so I kept researching this myself.</p> <p>Not sure if this is the most elegant solution or not, but changing:</p> <pre><code>if __name__ == '__main__': unittest.main() </co...
7
2010-03-16T19:04:32Z
[ "python", "unit-testing", "python-idle" ]
Using IDLE to run Python PyUnit unit tests
2,457,068
<p>Is there a way, within IDLE, to run the PyUnit (unittest module) unit tests directly?</p> <p>I ask because I have a short test module and when I run it with python mymodule.py from the Cygwin shell I get all tests passed, but when I use Run->Run Module from IDLE the tests pass but then I get an exception (SystemExi...
8
2010-03-16T18:30:49Z
3,695,937
<p>Something like this should also work:</p> <pre><code>suite = unittest.TestLoader().loadTestsFromTestCase( fooTests ) unittest.TextTestRunner(verbosity=2).run( suite ) </code></pre> <p>I found that <a href="http://bugs.python.org/issue2821" rel="nofollow">here</a>, and it worked for me.</p>
1
2010-09-12T18:11:00Z
[ "python", "unit-testing", "python-idle" ]
Using IDLE to run Python PyUnit unit tests
2,457,068
<p>Is there a way, within IDLE, to run the PyUnit (unittest module) unit tests directly?</p> <p>I ask because I have a short test module and when I run it with python mymodule.py from the Cygwin shell I get all tests passed, but when I use Run->Run Module from IDLE the tests pass but then I get an exception (SystemExi...
8
2010-03-16T18:30:49Z
9,140,610
<p>You can also do</p> <pre><code>if __name__ == '__main__': unittest.main(exit=False) </code></pre> <p>if you're using Python >= 2.7</p>
8
2012-02-04T11:46:06Z
[ "python", "unit-testing", "python-idle" ]
Looping through columns in a .csv files in Python
2,457,193
<p>I want to be able to use Python to open a <code>.csv</code> file like this:</p> <pre><code>5,26,42,2,1,6,6 </code></pre> <p>and then perform some operation on them like addition. </p> <pre><code>total = 0 with open("file.csv") as csv_file: for row in csv.reader(csv_file, delimiter=','): for nu...
3
2010-03-16T18:51:15Z
2,457,220
<p>You can just say</p> <pre><code>for col in row: total += int(col) </code></pre> <p>For example:</p> <pre><code>import csv from StringIO import StringIO total = 0 for row in csv.reader(StringIO("1,2,3,4")): for col in row: total += int(col) print total # prints 10 </code></pre> <p>The reason ...
7
2010-03-16T18:55:25Z
[ "python", "csv", "sum" ]
Looping through columns in a .csv files in Python
2,457,193
<p>I want to be able to use Python to open a <code>.csv</code> file like this:</p> <pre><code>5,26,42,2,1,6,6 </code></pre> <p>and then perform some operation on them like addition. </p> <pre><code>total = 0 with open("file.csv") as csv_file: for row in csv.reader(csv_file, delimiter=','): for nu...
3
2010-03-16T18:51:15Z
2,457,267
<p>You can iterate over a list of columns just as you iterate over the rows in a csv reader:</p> <pre><code>total = 0 with open("file.csv") as csv_file: for row in csv.reader(csv_file, delimiter=','): for col in row: total += int(col) </code></pre> <p>Or you can add the sum of each row on each ...
3
2010-03-16T19:01:28Z
[ "python", "csv", "sum" ]
Python | efficiency and performance
2,457,363
<p>Lets say I'm going to save 100 floating point numbers in a list by running a single script, most probably it will take some memory to process.So if this code executes every time as a requirement of an application there will be performance hits, so my question is how to maintain efficiency in order to gain performanc...
-1
2010-03-16T19:16:33Z
2,457,414
<p>If generate_lglt() is going to be called a lot of different times, you may want to keep from regenerating the same range(100,0,-1) with every call of the code. You may want to cache that generated range somewhere and use it over and over again.</p> <p>Also, if you are going to be exiting a for loop without complet...
2
2010-03-16T19:23:31Z
[ "python", "optimization", "premature-optimization" ]
Python | efficiency and performance
2,457,363
<p>Lets say I'm going to save 100 floating point numbers in a list by running a single script, most probably it will take some memory to process.So if this code executes every time as a requirement of an application there will be performance hits, so my question is how to maintain efficiency in order to gain performanc...
-1
2010-03-16T19:16:33Z
2,457,674
<p><strong>Bottlenecks occur at unexpected places</strong>, so <em>never</em> optimize code just because you <em>think</em> it might be the right code to try to improve. What you need to do is</p> <ol> <li>Write your program so that it runs completely.</li> <li>Develop tests to make sure your program is correct.</li> ...
9
2010-03-16T20:01:20Z
[ "python", "optimization", "premature-optimization" ]
Do Django Models inherit managers? (Mine seem not to)
2,457,364
<p>I have 2 models:</p> <pre><code>class A(Model): #Some Fields objects = ClassAManager() class B(A): #Some B-specific fields </code></pre> <p>I would expect <code>B.objects</code> to give me access to an instance of <code>ClassAManager</code>, but this is not the case....</p> <pre><code>&gt;&gt;&gt; A....
4
2010-03-16T19:16:43Z
2,457,404
<p>Your base class will need to be an abstract base class in order for the custom manager to be inherited, as described <a href="http://docs.djangoproject.com/en/dev/topics/db/managers/#custom-managers-and-model-inheritance" rel="nofollow">here</a></p>
1
2010-03-16T19:21:12Z
[ "python", "django", "django-models", "django-managers" ]
How efficient is Python substring extraction?
2,457,367
<p>I've got the entire contents of a text file (at least a few KB) in string <code>myStr</code>.</p> <p>Will the following code create a copy of the string (less the first character) in memory?</p> <p><code>myStr = myStr[1:]</code></p> <p>I'm hoping it just refers to a different location in the same internal buffer....
3
2010-03-16T19:16:59Z
2,457,449
<p>At least in 2.6, slices of strings are always new allocations; string_slice() calls PyString_FromStringAndSize(). It doesn't reuse memory--which is a little odd, since with invariant strings, it should be a relatively easy thing to do.</p> <p>Short of the buffer API (which you probably don't want), there isn't a m...
4
2010-03-16T19:30:03Z
[ "python", "memory", "performance", "substring" ]
How efficient is Python substring extraction?
2,457,367
<p>I've got the entire contents of a text file (at least a few KB) in string <code>myStr</code>.</p> <p>Will the following code create a copy of the string (less the first character) in memory?</p> <p><code>myStr = myStr[1:]</code></p> <p>I'm hoping it just refers to a different location in the same internal buffer....
3
2010-03-16T19:16:59Z
2,457,480
<p>As with most garbage collected languages, strings are created as often as needed, which is very often. The reason for this is because tracking substrings as described would make garbage collection more difficult.</p> <p>What is the actual algorithm you are trying to implement. It might be possible to give you adv...
3
2010-03-16T19:35:31Z
[ "python", "memory", "performance", "substring" ]
How efficient is Python substring extraction?
2,457,367
<p>I've got the entire contents of a text file (at least a few KB) in string <code>myStr</code>.</p> <p>Will the following code create a copy of the string (less the first character) in memory?</p> <p><code>myStr = myStr[1:]</code></p> <p>I'm hoping it just refers to a different location in the same internal buffer....
3
2010-03-16T19:16:59Z
2,457,597
<p>One (albeit slightly hacky) solution would be something like this:</p> <pre><code>f = open("test.c") f.read(1) myStr = f.read() print myStr </code></pre> <p>It will skip the first character, and then read the data into your string variable. </p>
1
2010-03-16T19:50:39Z
[ "python", "memory", "performance", "substring" ]
How efficient is Python substring extraction?
2,457,367
<p>I've got the entire contents of a text file (at least a few KB) in string <code>myStr</code>.</p> <p>Will the following code create a copy of the string (less the first character) in memory?</p> <p><code>myStr = myStr[1:]</code></p> <p>I'm hoping it just refers to a different location in the same internal buffer....
3
2010-03-16T19:16:59Z
2,458,894
<p>Depending on what you are doing, <code>itertools.islice</code> <em>may</em> be a suitable memory-efficient solution (should one become necessary).</p>
1
2010-03-16T23:21:58Z
[ "python", "memory", "performance", "substring" ]
Strange python error
2,457,529
<p>I am trying to write a python program that calculates a histogram, given a list of numbers like:</p> <pre><code>1 3 2 3 4 5 3.2 4 2 2 </code></pre> <p>so the input parameters are the filename and the number of intervals. </p> <p>The program code is:</p> <pre><code>#!/usr/bin/env python import os, sys, re, string...
-1
2010-03-16T19:41:13Z
2,457,591
<p>On the last line you access Histogram with a too big index. You should make sure that 'int_number' is at most <pre>len(Histogram) - 1</pre></p> <p>There's probably a bug, which causes this problem.</p>
0
2010-03-16T19:49:55Z
[ "python" ]
Strange python error
2,457,529
<p>I am trying to write a python program that calculates a histogram, given a list of numbers like:</p> <pre><code>1 3 2 3 4 5 3.2 4 2 2 </code></pre> <p>so the input parameters are the filename and the number of intervals. </p> <p>The program code is:</p> <pre><code>#!/usr/bin/env python import os, sys, re, string...
-1
2010-03-16T19:41:13Z
2,457,965
<p>I believe the problem may be a peculiar off-by one in the line:</p> <pre><code>int_number = 1 + int((item-lmin)/width) </code></pre> <p>Why that <code>1 +</code>? Python indices on an array of length N are from 0 to N-1 included. The <code>1 +</code> here makes int_number go from 1 to <code>1 + (lmax-lmin)/width...
1
2010-03-16T20:41:41Z
[ "python" ]
Strange python error
2,457,529
<p>I am trying to write a python program that calculates a histogram, given a list of numbers like:</p> <pre><code>1 3 2 3 4 5 3.2 4 2 2 </code></pre> <p>so the input parameters are the filename and the number of intervals. </p> <p>The program code is:</p> <pre><code>#!/usr/bin/env python import os, sys, re, string...
-1
2010-03-16T19:41:13Z
2,457,971
<p>I just removed code that loads from file and rewrite to something more readable </p> <pre><code>from math import floor Lista = [1,3,2,3,4,5,3.2,4,2,2] ic=0 nintervals= 3 lmin=min(Lista) print "min= ",lmin lmax=max(Lista) print "max= ",lmax width=1.0*(lmax-lmin)/nintervals print "width= ",width nelements=len(L...
0
2010-03-16T20:42:02Z
[ "python" ]
Strange python error
2,457,529
<p>I am trying to write a python program that calculates a histogram, given a list of numbers like:</p> <pre><code>1 3 2 3 4 5 3.2 4 2 2 </code></pre> <p>so the input parameters are the filename and the number of intervals. </p> <p>The program code is:</p> <pre><code>#!/usr/bin/env python import os, sys, re, string...
-1
2010-03-16T19:41:13Z
2,459,128
<p>Here is a more Pythonic approach.</p> <pre><code>from itertools import groupby from math import floor data = [1,3,2,3,4,5,3.2,4,2,2,3.6] data.sort() nintervals = 3 lmax = max(data) lmin = min(data) width = 1.0*(lmax-lmin)/nintervals def grouper(item): return floor(1.0*(item-lmin)/width) for i, b in gro...
1
2010-03-17T00:18:55Z
[ "python" ]
python gui events out of order
2,458,026
<pre><code>from Tkinter import * from tkMessageBox import * class Gui: def __init__(self, root): self.container = Frame(root) self.container.grid() self.inputText = Text(self.container, width=50, height=8) self.outputText = Text(self.container, width=50, height=8, bg='#E0E0E0', state=DISABLED) self.inputTex...
1
2010-03-16T20:49:23Z
2,472,992
<p>This is how bindings work (and that's a good thing), but your problem is easily solved. </p> <p>Bindings are fired in the order specified by a widgets bindtags. Unless you specify otherwise, the bindings happen in the following order:</p> <ol> <li>if there is a binding directly on the widget it will be fired befor...
4
2010-03-18T20:03:09Z
[ "python", "user-interface", "events", "tkinter" ]